Last active
January 6, 2021 17:56
-
-
Save madsc13ntist/02096c39373f7e1241e3f634d712b9fd to your computer and use it in GitHub Desktop.
https://www.hackthebox.eu/home/challenges/Web. (Flag md5: 337e1ded05a871779beec0a9636f23bd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| """ | |
| Solution for HTB EU Challenge: "Emdee five for life" [by L4mpje] | |
| """ | |
| import sys | |
| import hashlib | |
| import requests | |
| from requests_html import HTMLSession # pip3 install requests-html | |
| if len(sys.argv) < 2: | |
| print("use the server ip:port as a parameter.\n Example: ./emdeefive.py 206.189.118.190:31421") | |
| exit(0) | |
| url = "http://" + sys.argv[1] | |
| headers = requests.utils.default_headers() | |
| headers.update( | |
| { | |
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', | |
| } | |
| ) | |
| session = HTMLSession() | |
| r = session.get(url, headers=headers) | |
| if r.ok: | |
| characters = r.html.find('body > h3', first=True).text | |
| md5hash = hashlib.md5(characters.encode('utf-8')).hexdigest() | |
| r = session.post(url, headers=headers, data={"hash": md5hash}) | |
| #print(r.text) # Print the page source | |
| print(r.html.find('body > p', first=True).text) | |
| else: | |
| print("The server may have been closed or need to be (re)started.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment