Last active
August 29, 2015 14:26
-
-
Save rubo77/102dd5011137783e89e5 to your computer and use it in GitHub Desktop.
analyses the number of clients that cause traffic during a given time on a Freifunk gateway
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
duration=$1 | |
tmp=/tmp/traffic.tmp | |
localnet="10.116.128.0/17" | |
iface=br-ffki | |
echo capturing for $duration seconds | |
( | |
sleep $duration | |
pkill -f tcpdump | |
) & | |
tcpdump -q -n -i $iface src net $localnet and dst net ! $localnet and dst net ! 224.0.0.0/4 and ! arp | \ | |
cut -d" " -f3 | \ | |
cut -d"." -f1-4 | \ | |
sort | uniq -c | sort -nr > $tmp; | |
cat $tmp | |
echo -n "clients that caused traffic during the last $duration seconds: " | |
wc -l < $tmp | |
rm $tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment