File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # (C) 2008-2012, 2023 by Jim Klimov
4
+
5
+ # ## Capture NUM packets and print who makes traffic
6
+ # ## Senders show as IPs, destinations show with colon ':' in the end
7
+ [ x" $NUM " = x ] && NUM=10000
8
+ # [ x"$INT" = x ] && INT=bge126000
9
+ # [ x"$INT" = x ] && INT=vlan126
10
+ [ x" $INT " = x ] && INT=vioif1
11
+
12
+ # Collect packet metadata:
13
+ time tcpdump -n -e -i " $INT " | grep IPv4 | head -n " $NUM " > /tmp/x0 || exit
14
+
15
+ # Pick out IP and PORT (single token), using this as template for numbered fields:
16
+ # 10:27:03.899040 fe:00:00:00:01:01 > 1a:83:3c:db:1c:12, ethertype IPv4 (0x0800),
17
+ # length 56: 86.49.231.135.5564 > 139.159.158.160.22251:
18
+ # Flags [.], ack 352, win 1022, length 0
19
+ # OLD#cat /tmp/x0 | awk '{ print $16"\n"$18 }' \
20
+ cat /tmp/x0 | awk ' { print $10"\n"$12 }' \
21
+ | sort -n | uniq -c | sort -n > /tmp/x \
22
+ && cat /tmp/x
23
+
24
+ echo " ` date` : REMINDER: destinations show with colon ':' in the end" >&2
You can’t perform that action at this time.
0 commit comments