-
Notifications
You must be signed in to change notification settings - Fork 15
/
launch_bot.sh
executable file
·99 lines (87 loc) · 2 KB
/
launch_bot.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
time="30"
SECS=300
source lib/color.sh
source lib/functions.sh
path=`pwd`
source $path/bots/reset.sh
level=`cat .level`
echo -e $bold
start_test
next_step=$[$SECS-$time]
win=false
game_over=false
bad_response=0
step=1
consigne $step
while [[ 0 -ne $SECS ]]; do
if [ $win == true ]
then
if [ $level_selected -eq $level ]
then
level=$[$level_selected+1]
fi
echo -e $green"YOU WIN, TRY THE LEVEL "$level$reset_color
echo -e "$level" > $path"/.level"
sleep 2
menu
fi
if [ $game_over == true ]
then
echo -e $red"You lose, Game Over$reset_color"
exit
fi
if [ $verif ]
then
if [ $read_input ]
then
if [ $time == ${bad_response:-0} ]
then
echo -e $red"Game over"$reset_color$bold
game_over=true
break
fi
echo "Quelle est la commande à taper pour faire cela ?"
read
response$step
else if [ $test ]
then
case $test in
"search")
search_grep "$val_test" "$search_in"
if [ -n "$result" ]
then
#next_step
# win=true
test=""
search_in=""
result=""
val_test=""
else
next_try
fi
;;
"acl")
droit=`stat -c%A /tmp/contact.html`
val_test=" \"${droit:4:2}\" == \"rw\" "
if [ $val_test ]
then
next_step
else
next_try
fi
;;
esac
else
next_step
fi
fi
else
next_try
fi
if [ $SECS == "$next_step" ]
then
game_over=true
fi
done
echo "Time is up, clown."