This commit is contained in:
Nofel Yaseen 2020-09-09 17:02:41 -04:00
Родитель 7a001a73d1
Коммит 89e6fbbf71
12 изменённых файлов: 127 добавлений и 39 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -1,6 +1,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
Setup/servers.txt
throughputExp/*.txt
graphFiles/graphs/
graphFiles/averageGraphs/

Просмотреть файл

@ -5,10 +5,11 @@ if [ "$#" -ne 2 ]; then
exit 1
fi
LOCAL=ifconfig | grep -B1 10.10 | grep -o "^\w*"
LOCAL=$(ifconfig | grep -B1 10.10 | grep -o "^\w*")
mkdir traffic
sudo ifconfig $LOCAL 10.10.$1.$2
sudo ip route add 10.10.1.0/24 via 10.10.$1.100 dev $LOCAL
sudo apt update
sudo apt install -y socat

Просмотреть файл

@ -36,6 +36,7 @@ sudo cp /usr/share/doc/conntrackd/examples/sync/primary-backup.sh /etc/conntrack
cd $HOME/aaragog/C++Verifier/
chmod u+x setup.sh
./setup.sh
make
@ -88,4 +89,8 @@ nohup sudo keepalived -l &
cd /etc/conntrackd
nohup sudo conntrackd -d &
cd
cd aaragog/runme
chmod u+x runFirewall.sh
wait

Просмотреть файл

@ -5,8 +5,8 @@ if [ "$#" -ne 1 ]; then
exit 1
fi
INT=ifconfig | grep -B1 128.* | grep -o "^\w*"
LOCAL=ifconfig | grep -B1 10.10 | grep -o "^\w*"
INT=$(ifconfig | grep -B1 128.* | grep -o "^\w*")
LOCAL=$(ifconfig | grep -B1 10.10 | grep -o "^\w*")
sudo ifconfig $LOCAL 10.10.1.$1
@ -34,8 +34,10 @@ mvn clean package
cd
cd kafka_2.12-2.5.0/
# Change server.properties
# Change zookeeper properties
sed -i -e s@\#listeners=PLAINTEXT://@listeners=PLAINTEXT://10.10.1.$1@g $HOME/kafka_2.12-2.5.0/config/server.properties
cd
cd aaragog/runme/
chmod u+x runGlobal.sh

Просмотреть файл

@ -5,7 +5,7 @@ if [ "$#" -ne 1 ]; then
exit 1
fi
LOCAL=ifconfig | grep -B1 10.10 | grep -o "^\w*"
LOCAL=$(ifconfig | grep -B1 10.10 | grep -o "^\w*")
mkdir traffic
sudo ifconfig $LOCAL 10.10.1.$1
@ -14,4 +14,5 @@ sudo ip route add 10.10.5.0/24 via 10.10.1.50 dev $LOCAL
sudo apt update
sudo apt install -y socat
sudo
sudo apt install -y python3-pip
pip3 install psutil

3
Setup/setup.sh Normal file → Executable file
Просмотреть файл

@ -23,6 +23,7 @@ do
scp internalSetup.sh ${myArray[$i]}:./
ssh ${myArray[$i]} "chmod u+x internalSetup.sh; ./internalSetup.sh $(($i+1))"
scp ../traffic/* ${myArray[$i]}:./traffic/
ssh ${myArray[$i]} "cd traffic; chmod u+x start_background.sh"
done
for i in 4 5 6 7
@ -36,6 +37,7 @@ do
scp externalSetup.sh ${myArray[$i]}:./
ssh ${myArray[$i]} "chmod u+x externalSetup.sh; ./externalSetup.sh 4 $(($i-7))"
scp ../traffic/* ${myArray[$i]}:./traffic/
ssh ${myArray[$i]} "cd traffic; chmod u+x start_background.sh"
done
for i in 10 11
@ -43,6 +45,7 @@ do
scp externalSetup.sh ${myArray[$i]}:./
ssh ${myArray[$i]} "chmod u+x externalSetup.sh; ./externalSetup.sh 5 $(($i-9))"
scp ../traffic/* ${myArray[$i]}:./traffic/
ssh ${myArray[$i]} "cd traffic; chmod u+x start_background.sh"
done
scp globalSetup.sh ${myArray[12]}:./

Просмотреть файл

@ -206,8 +206,8 @@ def parse_line(line):
flowList.append('')
else:
flow['flow_state'] = "UNKNOWN"
flowList.append('')
flowList.append('')
flowList.append(0)
flowList.append('UNKNOWN')
flow['srcIp'] = current_entry[index].split('=')[1]
index += 1
@ -219,36 +219,38 @@ def parse_line(line):
if flow['proto'] == 'icmp':
flow['type'] = int(current_entry[index].split('=')[1])
index +=1
flowList.append(flow['type'])
# if flow['proto'] == 'icmp':
# flow['type'] = int(current_entry[index].split('=')[1])
# index +=1
# flowList.append(flow['type'])
flow['code'] = int(current_entry[index].split('=')[1])
index +=1
flowList.append(flow['code'])
# flow['code'] = int(current_entry[index].split('=')[1])
# index +=1
# flowList.append(flow['code'])
flow['id'] = int(current_entry[index].split('=')[1])
index +=1
flowList.append(flow['id'])
else:
flowList.append('')
flowList.append('')
flowList.append('')
# flow['id'] = int(current_entry[index].split('=')[1])
# index +=1
# flowList.append(flow['id'])
# else:
# flowList.append('')
# flowList.append('')
# flowList.append('')
if 'sport' in current_entry[index]:
flow['srcL4Port'] = int(current_entry[index].split('=')[1])
index +=1
flowList.append(flow['srcL4Port'])
else:
flowList.append('')
flow['srcL4Port'] = 0
flowList.append(0)
if 'dport' in current_entry[index]:
flow['dstL4Port'] = int(current_entry[index].split('=')[1])
index +=1
flowList.append(flow['dstL4Port'])
else:
flowList.append('')
flow['dstL4Port'] = 0
flowList.append(0)
# if 'REPLIED' in current_entry[index]:
# flow['replied'] = current_entry[index][1:-1]

43
runme/killme.sh Executable file
Просмотреть файл

@ -0,0 +1,43 @@
#!/bin/bash
if [ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]
then
echo "This script requires Bash version >= 4"
exit 1
fi
mapfile -t myArray < ../Setup/servers.txt
# printf '%s\n' "${myArray[@]}"
NUMSERVERS=${#myArray[@]}
if [ $NUMSERVERS -lt 16 ]; then
echo "Not enough servers"
exit 1
fi
for i in 0 1 2 3
do
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python; sudo killall python3"
done
for i in 8 9 10 11
do
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python; sudo killall python3"
done
for i in 4 5 6 7
do
ssh ${myArray[$i]} "sudo killall runFirewall; sudo killall start_background && sudo killall python; sudo killall python3"
done
for i in 4 5 6 7
do
ssh ${myArray[$i]} "sudo iptables -D FORWARD -s 10.10.4.0/24 -d 10.10.1.0/24 -m conntrack --ctstate NEW -j ACCEPT"
done
scp ${myArray[12]}:./aaragog/out/*.txt .
ssh ${myArray[12]} "cd; cd kafka_2.12-2.5.0/ ; ./bin/kafka-server-stop.sh ; ./bin/zookeeper-server-stop.sh; cd /tmp/ ; sudo rm -r kafka-logs/ ; sudo rm -r zookeeper ; cd ; cd flink-1.9.3/ ; ./bin/stop-cluster.sh ; cd log ; rm *"

8
runme/runFirewall.sh Normal file → Executable file
Просмотреть файл

@ -1,17 +1,19 @@
#!/bin/bash
cd $HOME/MBVerifier/firewall
cd $HOME/aaragog/firewall
sudo conntrack -E conntrack -o timestamp | python3 firewallTracker.py $1 &
cd $HOME/MBVerifier/C++Verifier
cd $HOME/aaragog/C++Verifier
./build/main.out --filesOrKafka kafka --KafkaAddress 10.10.1.10:9092 --numberOfChannels 4 --inputType socket &
cd $HOME/aaragog/firewall
python3 measureCpuMem.py $1 &
echo "global started"
sleep 10m
sleep 6000
pkill -P $$
echo "global ended, terminating programs"

23
runme/runGlobal.sh Normal file → Executable file
Просмотреть файл

@ -5,25 +5,38 @@ cd kafka_2.12-2.5.0/
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
./bin/kafka-server-start.sh -daemon config/server.properties
cd
cd flink-1.9.3
./bin/start-cluster.sh
sleep 10
cd $HOME/MBVerifier
cd $HOME/aaragog
$HOME/flink-1.9.3/bin/flink run verification/target/verification-0.1.jar --config_dir out/ --out_path out/ --mode GLOBAL_KAFKA --broker_address 10.10.1.10:9092 --channel_per_invariant 1 &
cd $HOME/MBVerifier/firewall
cd $HOME/aaragog/firewall
python3 measureCpuMem.py g &
echo "global started"
sleep 10m
sleep 6000
pkill -P $$
cd
cd kafka_2.12-2.5.0/
./bin/kafka-server-stop.sh
./bin/zookeeper-server-stop.sh
cd /tmp/
sudo rm -r kafka-logs/
sudo rm -r zookeeper
cd
cd flink-1.9.3/
./bin/stop-cluster.sh
cd log
rm *
echo "global ended"

17
runme/runme.sh Normal file → Executable file
Просмотреть файл

@ -18,7 +18,7 @@ if [ $NUMSERVERS -lt 16 ]; then
exit 1
fi
ssh ${myArray[12]} "nohup ./aaragog/runme/runGlobal.sh"
ssh ${myArray[12]} "nohup ./aaragog/runme/runGlobal.sh > /dev/null 2> /dev/null &"
sleep 10
@ -37,28 +37,33 @@ do
ssh ${myArray[$i]} "cd traffic; sudo nohup ./start_background.sh $(($i-4)) 8 traffic_5e9_ </dev/null >/dev/null 2>&1 &"
done
sleep 5m
sleep 300
for i in 4 5 6 7
do
ssh ${myArray[$i]} "sudo iptables -A FORWARD -s 10.10.4.0/24 -d 10.10.1.0/24 -m conntrack --ctstate NEW -j ACCEPT"
done
sleep 5m
sleep 300
for i in 0 1 2 3
do
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python"
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python; sudo killall python3"
done
for i in 8 9 10 11
do
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python"
ssh ${myArray[$i]} "sudo killall socat; sudo killall start_background; sudo killall python; sudo killall python3"
done
for i in 4 5 6 7
do
ssh ${myArray[$i]} "sudo killall runFirewall; sudo killall start_background && sudo killall python"
ssh ${myArray[$i]} "sudo killall runFirewall; sudo killall start_background && sudo killall python; sudo killall python3"
done
for i in 4 5 6 7
do
ssh ${myArray[$i]} "sudo iptables -D FORWARD -s 10.10.4.0/24 -d 10.10.1.0/24 -m conntrack --ctstate NEW -j ACCEPT"
done
scp ${myArray[12]}:./aaragog/out/*.txt .

10
traffic/servers.json Normal file
Просмотреть файл

@ -0,0 +1,10 @@
{
"1" : "10.10.1.1",
"2" : "10.10.1.2",
"3" : "10.10.1.3",
"4" : "10.10.1.4",
"5" : "10.10.4.1",
"6" : "10.10.4.2",
"7" : "10.10.5.1",
"8" : "10.10.5.2"
}