forked from c2dc/aBFF-sbseg2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1_Extract_Features.sh
73 lines (58 loc) · 1.4 KB
/
1_Extract_Features.sh
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
#!/bin/bash
fileList=($(ls ${1:-"./"}*.pcap))
fileList=${fileList[@]}
PATH=$PATH':/usr/local/zeek/bin:~/.local/bin'
pCheck=`which python`
if [ -z "$pCheck" ]
then
echo "ERROR: This script requires python."
exit 255
fi
pCheck=`which argus`
if [ -z "$pCheck" ]
then
echo "ERROR: This script requires Argus."
exit 255
fi
pCheck=`which zeek`
if [ -z "$pCheck" ]
then
echo "ERROR: This script requires Zeek."
exit 255
fi
pCheck=`which cicflowmeter`
if [ -z "$pCheck" ]
then
echo "ERROR: This script requires CICFlowMeter."
# exit 255
fi
if [ ! -e ./csv ]
then
mkdir ./csv
fi
echo Reading files: ${fileList}
echo
for file in ${fileList}
do
name=${file:0:-5}
name=${name##*/}
echo "File: $name"
echo
if [ ! -e ./csv/$name ]
then
mkdir ./csv/$name
fi
echo "reading PCAP 2 Argus"
argus -J -r ./$file -w ./csv/$name/$name.argus
echo "reading Argus 2 CSV"
ra -nn -u -r ./csv/$name/$name.argus -c ',' -s saddr sport daddr dport proto state dur sbytes dbytes sttl dttl sloss dloss service sload dload spkts dpkts swin dwin stcpb dtcpb smeansz dmeansz sjit djit stime ltime sintpkt dintpkt tcprtt synack ackdat trans min max sum -M dsrs=+time,+flow,+metric,+agr,+jitter > ./csv/$name/argus.csv
cd ./csv/$name
echo "reading Zeek"
zeek -C -r ../../$file
cd ../../
#echo "reading CICFlowMeter"
#cicflowmeter -f ./$file -c ./csv/$name/cic.csv
echo "File: $name complete"
echo
done
echo "Done!"