Open the question and find that this is a 20-point web question
Tip: Can you encrypt fast enough? (Are you encrypt fast enough)
Go to webpage
Encrypt using md5 encrypted website
He actually said I was too slow
I tried several times and found that I have to take out my pycharm to write code
Idea: Get the source code -> regular matching encrypted string -> MD5 encryption -> post send.
#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: maple
@file: md5.py
@time: 2021/1/22 12:49
@desc:
"""
import requests
import hashlib
import re
url = 'http://178.128.41.22:30979/'
r = requests.session()
html = r.get(url)
text = html.text
output = re.search(r'<h3 align=\'center\'>[a-z|A-Z|0-9]+</h3>', text).group()
output = output.split('>')
output = output[1].split('<')
target = output[0]
final = hashlib.md5(target.encode(encoding='utf-8')).hexdigest()
data = {'hash':final}
posthtml = r.post(url, data=data)
print(posthtml.text)
final result
D:\python\venv\Scripts\python.exe D:/python/hackthebox/md5.py
<html>
<head>
<title>emdee five for life</title>
</head>
<body style="background-color:powderblue;">
<h1 align='center'>MD5 encrypt this string</h1><h3 align='center'>bEjMenXY3q9Uu84ZIzSG</h3><p align='center'>HTB{N1c3_ScrIpt1nG_B0i!}</p><center><form action="" method="post">
<input type="text" name="hash" placeholder="MD5" align='center'></input>
</br>
<input type="submit" value="Submit"></input>
</form></center>
</body>
</html>
Process finished with exit code 0
flag:HTB{N1c3_ScrIpt1nG_B0i!}