Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Timed 3 - Python Code Bank


Timed 3
This is a python script to complete Timed 3. You will need to save the data.txt in the same directory.
                import urllib, urllib2, re, hashlib

#Create a Dictionary that will hold the words in data.txt
#and their md5 hash conversion.
my_dict = {}
f = open('data.txt', 'r')
encoded_list = ((f.read()).strip()).split(',')
for item in encoded_list:
    object_hash = hashlib.md5(item.encode())
    my_dict.update({object_hash.hexdigest() : item})

#hashlib.md5(b'word') creates an object to md5 hash of the word.
#object_hash.hexdigest() returns the md5 hash of the word

#================================================#

#Now comes the part where we connect to the HBH site.

opener = urllib2.build_opener()
#We are going to login using our cookies
#Replace value with their corresponding values
opener.addheaders.append(('cookie', 'fusion_visited=TRUE; _ga=value; PHPSESSID=value; fusion_user=value; fusion_lastvisit=value'))
opener.addheaders.append(('User Agent', 'Mozilla/4.0'))
opener.addheaders.append(('Referer','http://www.hellboundhackers.org/index.php'))
response = opener.open('https://www.hellboundhackers.org/challenges/timed/timed3/', '')
text = response.read()
#Now text contains the source code of the site.

extract = re.search('string is: (.{32})', text)
string = extract.group(1)
#Now string contains the hash which we have to decode.

answer = my_dict[string]
ans = {'ans':answer, 'submit':'Check'}
ans = urllib.urlencode(ans)
#This encodes the ansewr before posting it to the site.
response = opener.open('https://www.hellboundhackers.org/challenges/timed/timed3/index.php?check', ans)

#The challenge is done
#================================================#
#This part is just to make sure

print (string)
print (answer)
with open('result.html', 'w') as f:
    f.write(response.read())

            
Comments
Sorry but there are no comments to display