blob: c36881c41cbeaa45faa0ed62201ec4e527176d84 (
plain)
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
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/bash
#monitor interfaces [type] [name] traffic
#monitor interfaces [type] [name] traffic save [filename]
#monitor interfaces [type] [name] traffic detail
#monitor interfaces [type] [name] traffic detail filter
#monitor interfaces [type] [name] traffic detail unlimited
#monitor interfaces [type] [name] traffic detail unlimited filter
#monitor interfaces [type] [name] traffic filter
#monitor interfaces [type] [name] traffic unlimited
#monitor interfaces [type] [name] traffic unlimited filter
declare -a types=(
"ethernet" \
"bonding" \
)
for type in "${types[@]}"; do
mkdir -p $type/node.tag/vif/node.tag/traffic/save/node.tag
mkdir -p $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag
mkdir -p $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag
mkdir -p $type/node.tag/vif/node.tag/traffic/filter/node.tag
mkdir -p $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag
#node.tag
echo "help: Monitor specified $type interface" > $type/node.tag/vif/node.tag/node.def
echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type --vif \${COMP_WORDS[COMP_CWORD-2]}" >> $type/node.tag/vif/node.tag/node.def
echo "run: \${vyatta_bindir}/vyatta-show-interfaces.pl --intf=\"$4.$6\"" >> $type/node.tag/vif/node.tag/node.def
# standard
echo "help: Montior captured traffic on specified $type interface" > $type/node.tag/vif/node.tag/traffic/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6' >> $type/node.tag/vif/node.tag/traffic/node.def
# save
echo 'help: Save monitored traffic to a file' > $type/node.tag/vif/node.tag/traffic/save/node.def
echo -e 'help: Save monitored traffic to a file\nrun: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --save "${@:9}"' > $type/node.tag/vif/node.tag/traffic/save/node.tag/node.def
# detail
echo -e "help: Monitor detailed traffic for the specified $type interface"> $type/node.tag/vif/node.tag/traffic/detail/node.def
echo -e 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail' >> $type/node.tag/vif/node.tag/traffic/detail/node.def
# detail filter
echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/filter/node.def
echo -e "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def
echo -e "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def
# detail unlimited
echo -e "help: Monitor detailed traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def
# detail unlimited filter
echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.def
echo "help: Monitor detailed filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited --filter "${@:11}"' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def
#filter
echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/filter/node.def
echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --filter "${@:9}"' >> $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def
# unlimited
echo "help: Monitor traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited' >> $type/node.tag/vif/node.tag/traffic/unlimited/node.def
# unlimited filter
echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.def
echo "help: Monitor filtered traffic for the specified $type interface" > $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def
echo "allowed: echo -e '<pcap-filter>'" >> $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def
echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def
done
|