· 6 years ago · Jul 09, 2019, 05:28 PM
1#!/bin/sh
2#Initialize the experiment and make the proper links
3echo "Starting simulation..."
4echo "Starting imunes..."
5eID=4322
6imunes -b -e $eID ~/Desktop/ReactorControl/TempNetworkMODBUS.imn
7
8echo "Initializing God Database..."
9sqlite3 ~/sync/logs.db "CREATE TABLE IF NOT EXISTS Reactor (timestamp LONG PRIMARY KEY, neutronPop LONG, rodHeight1 double, rodHeight2 double, rodHeight3 double, rodHeight4 double, rodHeight5 double, temp double);"
10sqlite3 ~/sync/logs.db "CREATE TABLE IF NOT EXISTS Sensors (timestamp LONG, type STRING, id INT, reading STRING, PRIMARY KEY(timestamp, type, id));"
11sqlite3 ~/sync/logs.db "CREATE TABLE IF NOT EXISTS SCRAM (timestamp LONG PRIMARY KEY, reactor INT, temp INT, seismic INT, period INT, manual INT, hv INT, flux INT, lognhv INT, cicHV INT, seismicReading STRING, tempReadings STRING);";
12
13routerNode=5
14FIRST=0
15LAST=20
16c=0
17echo "Copying /etc/hosts..."
18while [ $c -le $LAST ]
19do
20echo -n "$c "
21if [ "$c" -ne "$routerNode" ]; then
22 \cp ~/hosts/"$c"/hosts /var/imunes/$eID/n"$c"/etc
23fi
24c=$((c+1))
25done
26echo ""
27echo "Linking folders..."
28c=0
29#for((c=$FIRST; c<$LAST; c++));
30while [ $c -le $LAST ]
31do
32echo -n "$c "
33mount_nullfs ~/sync /var/imunes/$eID/n"$c"/sync
34c=$((c+1))
35done
36echo ""
37echo "Starting firewall..."
38hcp setupFW.sh router1:
39sleep 1
40#screen -S firewall -mL -d himage router1 sh setupFW.sh
41sleep 30
42echo ""
43echo "Starting simulation modules..."
44#Start simulation modules
45himage Reactor screen -S Reactor -mL -d java -jar ReactorControl.jar 8 1111
46sleep 3
47himage tempReader1 screen -S tempReader1 -mL -d java -jar ReactorControl.jar 1 1111 1
48himage tempReader2 screen -S tempReader2 -mL -d java -jar ReactorControl.jar 1 1111 2
49himage seismicReader1 screen -S seismicReader1 -mL -d java -jar ReactorControl.jar 4 1111 1
50sleep 3
51screen -s SCRAM -ml -d startxcmd SCRAM java -Xmx512m -jar ReactorControl.jar 2 1111
52screen -S controlConsole -ml -d startxcmd controlConsole java -jar ReactorControl.jar 6 1111
53
54echo "Simulation running."
55echo "Waiting 90 seconds to launch attack"
56sleep 10
57sh moveRods.sh
58sleep 80
59
60echo "Launching attack..."
61sh settemp1to600.sh
62echo "Letting sim run for 30 seconds..."
63sleep 30
64echo "Stopping sim..."
65imunes -b -e 4322
66echo "Merging databases..."
67sh dbSync.sh