当前位置:网站首页>Solve DoS attack production cases
Solve DoS attack production cases
2022-07-06 18:39:00 【JohnnyFang】
The requirements of this experiment are : according to web Number of log or network connections , Monitor when a IP Number of concurrent connections or in a short time PV achieve 100, Call the firewall command to block the corresponding IP, Monitoring frequency every 5 minute . The firewall command is :iptables -A INPUT -s IP -j REJECT.
Because the monitoring frequency is every 5 Minutes at a time , We can use scripts + Plan tasks to operate .
- Create script
First, create two files to store the ip Situation and forbidden ip Information , Then create the script dos.sh. Script ,ss -nt | awk -F" +|:" '/ESTAB/{print $6}' | sort | uniq -c The command can filter out the currently connected hosts Ip And number of connections , We input this information into dos.txt in , And then use it exec Command from the dos.txt The information is read from the file ; At the same time, we will single ip Number of connections and ip Set as variables respectively $nums and $ip, When reading line by line , If $nums achieve 100( Greater than or equal to -ge), Will ip Prohibition , At the same time dos_drop.txt write in $ip is dorpped( Here's the picture ).
perform chmod +x dos.sh Command gives script execution permission , perform bash dos.sh Command view effect , Because of the problem of the author's experiment , So for the time being, there is only dos.txt There are records in the document ( Here's the picture ).
In order to see the effect as soon as possible , The author first sets the upper limit of the number of connections to 3, After execution ,dos_drop.txt There are also records in the document ( Here's the picture ).
* So in the above script , Better add “sleep 10” Or a longer time limit , Otherwise, it will be banned all the time ip Enter information into dos_drop.txt In file , It may cause the remote connection to crash .
- Create a scheduled task
The creation of planned tasks was mentioned in the homework of last week , I won't go into details here , perform crontab -e Command to create a scheduled task , In case of unclear , Write directly above PATH route , Because it's every 5 Once per minute , The first part of the planning task is */5( Here's the picture ).
To this step , We can let the host check by itself according to the time ip Connection , And count the information into the corresponding file to view .
边栏推荐
- Self-supervised Heterogeneous Graph Neural Network with Co-contrastive Learning 论文阅读
- Reprint: defect detection technology of industrial components based on deep learning
- Maixll dock camera usage
- Automatic reservation of air tickets in C language
- atcoder它A Mountaineer
- 阿里云国际版ECS云服务器无法登录宝塔面板控制台
- 关于npm install 报错问题 error 1
- Distill knowledge from the interaction model! China University of science and Technology & meituan proposed virt, which combines the efficiency of the two tower model and the performance of the intera
- Wchars, coding, standards and portability - wchars, encodings, standards and portability
- Penetration test information collection - CDN bypass
猜你喜欢
Maixll dock camera usage
287. 寻找重复数
线代笔记....
Prophet模型的简介以及案例分析
Grafana 9.0 is officially released! It's the strongest!
使用cpolar建立一个商业网站(1)
人体骨骼点检测:自顶向下(部分理论)
Distiller les connaissances du modèle interactif! L'Université de technologie de Chine & meituan propose Virt, qui a à la fois l'efficacité du modèle à deux tours et la performance du modèle interacti
Medical image segmentation
MySQL查询请求的执行过程——底层原理
随机推荐
[the 300th weekly match of leetcode]
Numerical analysis: least squares and ridge regression (pytoch Implementation)
2022 Summer Project Training (II)
UFIDA OA vulnerability learning - ncfindweb directory traversal vulnerability
二叉搜索树
Compilation Principle -- C language implementation of prediction table
复现Thinkphp 2.x 任意代码执行漏洞
随着MapReduce job实现去加重,多种输出文件夹
2022/02/12
Rb157-asemi rectifier bridge RB157
Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
深度循环网络长期血压预测【翻译】
CSRF vulnerability analysis
STM32+ENC28J60+UIP协议栈实现WEB服务器示例
Common - magic number 7
线代笔记....
SAP Fiori 应用索引大全工具和 SAP Fiori Tools 的使用介绍
win10系统下插入U盘有声音提示却不显示盘符
Maixll dock camera usage
Cocos2d Lua 越来越小样本 内存游戏