Пример #1
0
def recoverGrouped(addresses,data):
	#change the given addresses -> 0d0a to 0a
	newData = "";
	lastIndex=0
	for index in xrange(0,len(addresses)):

		newData = newData + data[lastIndex:addresses[index]]+data[addresses[index]+2:addresses[index]+4];
		lastIndex = addresses[index]+4;


	newData = newData + data[lastIndex:len(data)];

	# bz2.decompress does the cyclic redundancy check first and throws an exception if the file 
	# doesn't pass the check. If it does pass the check then we have recovered the file
	try:
		dec = bz2.decompress(binascii.unhexlify(newData));
		print('\nRecovered the file. Check recovered.png and enter the password\n');
		pngRecFile = open('recovered.png','wb');
		pngRecFile.write(dec);
		pngRecFile.close();
		solution = raw_input("password: "******"sending solution")
		payload = {'solution' : solution, 'submitbutton' : 'submit'};
		HTS.postPage("https://www.hackthissite.org/missions/prog/5/index.php",payload);

		sys.exit(0);

	except IOError:
		return;
Пример #2
0
def recoverAllCombinations(addresses,currentAddress,data):

	# obtains all 2^n combinations and check if the the file is recovered. As anticipated 
	# this function won't be able to brute-force the solution under the time limit which is
	# 10 minutes
	#

	global processedBranches;
	
	if (currentAddress >= len(addresses)):
		processedBranches += 1;

		
		try:
  			dec = bz2.decompress(binascii.unhexlify(data));
  			print('\nrecovered @ recover.png\n');
  			pngRecFile = open('recover.png','wb');
  			pngRecFile.write(dec);
  			solution = raw_input("password: "******"sending solution")
			payload = {'solution' : solution, 'submitbutton' : 'submit'};
			HTS.postPage("https://www.hackthissite.org/missions/prog/5/index.php",payload);

  			sys.exit(0);

		except IOError:
			return;

  	else:
  		constructTreeRecursive(addresses,currentAddress+1,data); #unchanged
  		#update the addresses
  		newData = data[0:addresses[currentAddress]]+data[addresses[currentAddress]+2:len(data)];
  		addresses = updateAddresses(addresses,addresses[currentAddress]);
  		constructTreeRecursive(addresses,currentAddress+1,newData); #changed
Пример #3
0
def sendSolution(solution):
	print("sending solution");
	payload = {'solution' : solution, 'submitbutton' : 'submit'};
	response = HTS.postPage("https://www.hackthissite.org/missions/prog/11/index.php",payload);
	print("solution response: \n");
	print(response.content);
	return;
Пример #4
0
def sendResponse(decodedText):
	#send back the decoded text

	print(decodedText);
	print("sending solution")
	payload = {'solution' : decodedText, 'submitbutton' : 'submit'};
	return HTS.postPage("https://www.hackthissite.org/missions/prog/2/index.php",payload);
Пример #5
0
def sendResponse(solution):
    print("sending solution")
    payload = {
        'solution': solution,
        'submitbutton': 'submit'
    }
    return HTS.postPage(
        "https://www.hackthissite.org/missions/prog/4/index.php", payload)
Пример #6
0
def sendSolution(solution):
    print("sending solution")
    payload = {
        'solution': solution,
        'submitbutton': 'submit'
    }
    response = HTS.postPage(
        "https://www.hackthissite.org/missions/prog/6/index.php", payload)
    print("solution response: \n")
    print(response.content)
Пример #7
0
def sendResponse(decodedText):
    #send back the decoded text

    print(decodedText)
    print("sending solution")
    payload = {
        'solution': decodedText,
        'submitbutton': 'submit'
    }
    return HTS.postPage(
        "https://www.hackthissite.org/missions/prog/2/index.php", payload)
Пример #8
0
def sendResponse(solution):
	print("sending solution")
	payload = {'solution' : solution, 'submitbutton' : 'submit'};
	return HTS.postPage("https://www.hackthissite.org/missions/prog/4/index.php",payload);