1
mirror of git://git.acid.vegas/random.git synced 2024-11-14 20:16:40 +00:00
random/ddosmonit

14 lines
425 B
Plaintext
Raw Normal View History

2019-06-28 02:39:56 +00:00
#!/bin/sh
2023-09-12 20:44:54 +00:00
while true; do
pkt_old=$(grep eth0: /proc/net/dev | cut -d ':' -f2 | awk '{ print $2 }')
2019-06-28 02:39:56 +00:00
sleep 1
2023-09-12 20:44:54 +00:00
pkt_new=$(grep eth0: /proc/net/dev | cut -d ':' -f2 | awk '{ print $2 }')
pkt=$(( $pkt_new - $pkt_old ))
2019-06-28 02:39:56 +00:00
echo -ne "\r$pkt packets/s\033[0K"
if [ $pkt -gt 5000 ]; then
2023-09-12 20:44:54 +00:00
echo "\nDDoS detected"
tcpdump -n -s0 -c 5000 -w /home/acidvegas/dumps/dump.$(date +"%Y%m%d-%H%M%S").cap
2019-06-28 02:39:56 +00:00
sleep 300
fi
2023-09-12 20:44:54 +00:00
done