This is a web challenge from htb, very intresting one š
First I’ve started my Instance and viewed that page
And here’s the challenge we need to encrypt that string to md5, super easy š
i just used simple echo and md5sum to do it
I tried submitting and it said Too Slow!
Then I tried submitting as much fast I can, but It said me same thing š¦
We need to automate this task to submit faster, so I’m gonna use python to do it š
Here’s my full code It’s very simple and small, So I put whole code here and explain it
import requests
from bs4 import BeautifulSoup
import hashlib
url = "http://168.128.41.22:32135" # change it
ses = requests.session()
res = ses.get(url)
sp = BeautifulSoup(res.content, "lxml")
str = sp.h3.string
hash = hashlib.md5(str.encode()).hexdigest()
enc = {'hash': hash}
response = ses.post(url, data = enc)
print(response.text)
I’m using request module for GET and POST requests, using hashlib to perform hashing and using Beautifulsoup to get the HTML code of the website, we need cookie so I’m using requests.session function.
I’m getting content with BeautifulSoup and sorting the hash using h3.string which sorts only the h3 tag of HTML code,( we know the hash is located at that line so we directly mentioned it here) and doing md5sum then sending the data and printing the response
ok fine let’s run it, I run it for the first time and it showed me the response too slow š¦
nvm then I run it again and got the flag š
HTB{N1c3_ScrIpt1nG_B0i!}
ha ha š nice scripting I hope you liked my writeup, Follow this blog for more cool writeups
and subscribe to get instant post notifications in your mail š