当前位置:网站首页>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 .
边栏推荐
- Penetration test information collection - App information
- Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
- Celery best practices
- POJ 2208 six lengths of tetrahedron are known, and the volume is calculated
- ORACLE进阶(四)表连接讲解
- 安装及管理程序
- Recommend easy-to-use backstage management scaffolding, everyone open source
- Mathematics in machine learning -- common probability distribution (XIII): Logistic Distribution
- Excellent open source fonts for programmers
- 從交互模型中蒸餾知識!中科大&美團提出VIRT,兼具雙塔模型的效率和交互模型的性能,在文本匹配上實現性能和效率的平衡!...
猜你喜欢
测试行业的小伙伴,有问题可以找我哈。菜鸟一枚~
SAP Fiori 应用索引大全工具和 SAP Fiori Tools 的使用介绍
关于npm install 报错问题 error 1
ORACLE进阶(四)表连接讲解
基于ppg和fft神经网络的光学血压估计【翻译】
Numerical analysis: least squares and ridge regression (pytoch Implementation)
Self-supervised Heterogeneous Graph Neural Network with Co-contrastive Learning 论文阅读
The role of applet in industrial Internet
There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed
小程序在产业互联网中的作用
随机推荐
Test 1234
Penetration test information collection - App information
Use cpolar to build a business website (1)
2022 Summer Project Training (II)
DOM简要
The role of applet in industrial Internet
Compilation Principle -- C language implementation of prediction table
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
SAP Fiori 应用索引大全工具和 SAP Fiori Tools 的使用介绍
Cocos2d Lua 越来越小样本 内存游戏
Five data structures of redis
Alibaba cloud international ECS cannot log in to the pagoda panel console
From 2022 to 2024, the list of cifar azrieli global scholars was announced, and 18 young scholars joined 6 research projects
二叉搜索树
2022/02/12
UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
Easy to use PDF to SVG program
Reprint: defect detection technology of industrial components based on deep learning
使用block实现两个页面之间的传统价值观
Shangsilicon Valley JUC high concurrency programming learning notes (3) multi thread lock