-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathALL.sh
executable file
·62 lines (52 loc) · 1.26 KB
/
ALL.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
#!/bin/bash
#
# This code runs all parts of Entropy/IP in one shot.
#
# Copyright (c) 2015-2016 Akamai Technologies, Inc.
# See file "LICENSE" for licensing information.
# Author: Pawel Foremski
#
function ips()
{
if [ "${IPS##*.}" = "gz" ]; then
cat $IPS | zcat
else
cat $IPS
fi
}
if [ $# -ne 2 ]; then
echo "usage: ALL.sh ips target"
echo
echo "Entropy/IP: do all steps and prepare a web report on IPv6 addrs"
echo
echo " ips IPv6 addresses in hex ip format"
echo " target target directory for the report"
echo
echo "Copyright (c) 2015-2016 Akamai Technologies, Inc."
echo "See file LICENSE for licensing information."
echo "Author: Pawel Foremski"
exit 1
fi >&2
IPS="$1"
DIR="$2"
set -o pipefail
set -o errexit
set -o nounset
mkdir -p $DIR
[ -d "$DIR" ] || exit 1
echo "1. segments"
ips | ./a1-segments.py /dev/stdin \
>$DIR/segments || exit 2
echo -e "\n2. segment mining"
ips | ./a2-mining.py /dev/stdin $DIR/segments \
>$DIR/analysis || exit 3
echo -e "\n3. bayes model"
ips | ./a3-encode.py /dev/stdin $DIR/analysis \
| ./a4-bayes-prepare.sh /dev/stdin \
>$DIR/bnfinput || exit 4
./a5-bayes.sh $DIR/bnfinput \
>$DIR/cpd || exit 5
echo -e "\n4. web report"
./b1-webreport.sh $DIR $DIR/segments $DIR/analysis $DIR/cpd \
|| exit 6
exit 0