Permanent Programming 11

Put your programming skills to the test in these challenges.

Re: Permanent Programming 11

Post by Whiteshadowz on Mon Oct 21, 2013 12:38 pm
([msg=77807]see Re: Permanent Programming 11[/msg])

Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/
Whiteshadowz
New User
New User
 
Posts: 1
Joined: Wed Jul 25, 2012 8:09 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by -Ninjex- on Mon Oct 21, 2013 4:41 pm
([msg=77815]see Re: Permanent Programming 11[/msg])

Whiteshadowz wrote:Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/


Not quite sure what you are using to to connect to HTS, but there should be a way to manually set the referer. It might be something like HTTP_REFERER or HTTPReferer or similar.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1199
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by Amazingred on Tue Oct 22, 2013 5:12 am
([msg=77824]see Re: Permanent Programming 11[/msg])

Whiteshadowz wrote:Hey guys.. writing this code in python 3.x... I'm using the requests module.. I've successfully been able to get the source code by opening the url with the right cookie... I've processed all the data and came to an answer... but when I try to post the 'solution' I get an error back saying Invalid refer, I've tried posting the data with the same cookie that allowed me the source code but my program is still considered an Invalid refer... idk where to go from here >:| .. any help would be greatly appreciated :/


If you're using a urllib2.opener object you'll do this:
Code: Select all
opener.addheaders.append(('Referer','https://www.hackthissite.org/missions/prog/11/index.php'))


for mechanize:
Code: Select all
br.addheaders = [('Referer', 'https://www.hackthissite.org/missions/prog/11/index.php')]


and for your requests library I'm pretty sure its something like this:
Code: Select all
headers = {'Referer': 'https://www.hackthissite.org/missions/prog/11/index.php'}
data={'solution':YOURSOLUTIONSTRINGHERE}
r = requests.post(url, data=data, headers=headers)


that may not be exactly right from my memory but you can figure it from there I think.


I'm pretty sure thats it. I'll check it real quick to be sure.
There are 10 types of people in the world. Those who understand binary and those who don't.
User avatar
Amazingred
Experienced User
Experienced User
 
Posts: 73
Joined: Wed Jul 25, 2012 7:10 pm
Location: Wayyyyyy out there
Blog: View Blog (0)


Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests