Emdee five for life
Σε γενικές γραμμές.
Αν ασχολείσαι με το shell scripting τότε δεν είναι δύσκολο challenge. Εκεί που μπορω να πω πως είναι η παγίδα του είναι η διαφορά του request.session()
και του request.get()
το παρακάτω σχολειο στο github θα λύσει την απορία.
Το πρώτο πράγμα που θα κάνουμε είναι απο το request να απομονόσουμε το string που χρειάζεται να κάνουμε encrypt
1
2
3
4
5
6
7
8
9
10
11
import requests
from bs4 import BeautifulSoup
import hashlib
##get the string
url = 'http://docker.hackthebox.eu:30731'
s = requests.Session()
responce = s.get(url)
soup = BeautifulSoup(responce.text,'html.parser')
string = soup.find("h3").text
print (string)
Έπειτα έχοντας το string θα το κανουμε encrypt σε md5.
1
2
##convert to md5
hash = hashlib.md5(string.encode()).hexdigest()
Τελευταίο κομματι ειναι το post request.
Έχοντας ολα τα κομμάτια του puzzle το μόνο που μένει είναι τα βάλουμε στο post request. Για να δούμε τι parameter ζητά το request φυσικα θα χρησημοποιήσουμε το burp suite.
Βλέπουμε οτι η parameter ειναι το hash. Φτάντοντας κοντα στο τέλος στέλνουμε το post request θέτοντας ως value στην hash την variable hash.
1
2
3
myobj = {'hash': hash}
x = s.post(url, data = myobj)
print(x.text)
Ο κώδικας ολόκληρος ειναι παρακάτω:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import requests
from bs4 import BeautifulSoup
import hashlib
##get the string
url = 'http://docker.hackthebox.eu:30731'
s = requests.Session()
responce = s.get(url)
soup = BeautifulSoup(responce.text,'html.parser')
string = soup.find("h3").text
print (string)
##convert to md5
hash = hashlib.md5(string.encode()).hexdigest()
print(hash)
myobj = {'hash': hash}
x = s.post(url, data = myobj)
print(x.text)
This post is licensed under
CC BY 4.0
by the author.