RingZer0-13 Hash me please
Coding
Hash me if you can
We need to read the page, take a specific part then hash it and send it back.
Decided to do it in python. Looks terrible but it works.
#!/usr/bin/env python3
import re
import requests
import hashlib
def connect_to_website(username,password):
payload = {'username': username, 'password': password}
login_url = 'https://ringzer0ctf.com/login'
regex = re.compile('----- BEGIN.*?\t\t(.*?)<',re.DOTALL)
s = requests.Session()
s.post(login_url, data=payload)
stuff = s.get('https://ringzer0ctf.com/challenges/13').content
find_message = re.findall(regex, stuff.decode('utf-8'))
answer = hashlib.sha512(find_message[0].encode('utf-8')).hexdigest()
print (s.post('https://ringzer0ctf.com/challenges/13/'+str(answer)).content)
connect_to_website('myusername','mypassword')
The answer is in the response.
I could have refined it but i didn’t. I used re to search for the string, could have or should have used beautifulsoup to parse it better.