-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfast_reset_evo_statistics.sh
executable file
·74 lines (62 loc) · 2.28 KB
/
fast_reset_evo_statistics.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
74
#!/bin/bash
function command_netcat(){
RES=$( echo "./kernel_sieve $cand > res/$(basename $cand) && cat res/$(basename $cand)" | nc -nN 127.0.0.1 44444 )
if [ -z $RES ]
then
echo "error" > ./res/$(basename $cand)
else
echo $RES > ./res/$(basename $cand)
fi
}
function quit_vm(){
echo "quit" | nc -N 127.0.0.1 55555 >/dev/null && ./qemu_startup_qcow2.sh 2>&1 >/dev/null &
}
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
TARGET_DISTANCE=-96
ITERATIONS=1000
RESULT_FILES=./res/*
TRIES_FILE=./tries.log
CURRENT_BEST=999999999
NUMBER_OF_TRIES=0
#GLOBAL_RUNS=100
GLOBAL_RUNS=1
echo -e "Number of generations:" > $TRIES_FILE
./qemu_startup_qcow2.sh &
#echo "savevm savestate" | nc -N 127.0.0.1 55555
for (( global_counter=1; global_counter <= GLOBAL_RUNS; global_counter++ ))
do
NUMBER_OF_TRIES=0
# Delete old tries
rm ./ins/*
rm ./res/*
rm ./raw/*
echo -e "[*] Starting try number $global_counter"
for (( counter=1; counter <= ITERATIONS; counter++ ))
do
python3 ./algorithms/evoheap.py -a ksieve -n 3
if [ $? -ne 0 ];
then
echo -e "$NUMBER_OF_TRIES" >> $TRIES_FILE
continue 2
fi
scp -i ./bullseye.id_rsa -P 10021 -r -o "StrictHostKeyChecking no" ./ins root@localhost:/root/ > /dev/null && \
echo "savevm savestate" | nc -N 127.0.0.1 55555 > /dev/null
CANDIDATES="./ins"/*
for cand in $CANDIDATES
do
#ssh -i ../../kernel_virtualisation/linux-5.9.7/image/bullseye.id_rsa -p 10021 root@localhost -o "StrictHostKeyChecking no" "cd /home/ && ./kernel_sieve $cand > res/$(basename $cand)" > /dev/null
command_netcat
#scp -i ../../kernel_virtualisation/linux-5.9.7/image/bullseye.id_rsa -P 10021 -r -o "StrictHostKeyChecking no" root@localhost:/home/res/$(basename $cand) ./res/$(basename $cand) > /dev/null
#echo "cat res/$(basename $cand)" | nc -nN 127.0.0.1 44444 > ./res/$(basename $cand)
quit_vm
echo "Ping..."
sleep 0.1s
done
NUMBER_OF_TRIES=$((NUMBER_OF_TRIES + 1))
echo -e "Going into next gen after $NUMBER_OF_TRIES tries"
done
echo -e "${RED}Couldn't find solution${NC}"
echo -e "-1" >> $TRIES_FILE
done