-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchfagent.remote.capture
63 lines (57 loc) · 1.6 KB
/
chfagent.remote.capture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
Red=''
Green=''
Cyan=''
Yellow=''
White=''
NC=''
bold=''
normal=''
echo -e "${Cyan}Select network interface to capture from ${White}";
array=($(ls /sys/class/net));
array=("any" "${array[@]}");
select ifs in "${array[@]}"
do
break;
done
echo "";
echo -e "${Cyan}Select capture type ${White}";
options=("Flow" "CHFAgent" "BGP" "SNMP" "ALL" "Custom Filter");
select opt in "${options[@]}"
do
case $opt in
"Flow")
filter="port 20013";
break;
;;
"CHFAgent")
filter="port 9995";
break;
;;
"BGP")
filter="port 179";
break;
;;
"SNMP")
filter="port 161";
break;
;;
"ALL")
filter="";
break;
;;
"Custom Filter")
echo"#? ";
read filter;
break;
;;
*)
echo "Invalid option";
;;
esac
done
filename="$HOSTNAME.$RANDOM.pcap"
echo -e "";
echo -e "${Green}Caprturing $filter on $ifs as ${bold}$filename${normal} ${Yellow}";
tcpdump $filter -c 10 -i $ifs -w - | curl -X PUT --upload-file - https://www.cloudshark.org/api/v1/66cfc108b9b56c5cae33d8eea64abbf7/upload\?filename=$filename
echo -e "${NC}";