Join us at IRC!
It is never to LATE to become what you never WERE.
Friday, May 25, 2012
Navigation
Members Online
Total Online: 36
Web Spiders: 13
Guests Online: 36
Members Online: 0

Registered Members: 70209
Newest Member: KalareShou
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Python + urllib2

mrfirebug
Member

Posts: 2
Location:
Joined: 17.08.09
Rank:
Hacker Level 2
Posted on 25-08-09 16:57
I'm working on the timed challenges with python but I am running into a few pretty big problems. This question isn't directly related to any of the timed problems so I posted here...

I have a python scblockedript that should solve timed1 but my internet connection over is MUCH MUCH too slow and there is no chance of finding a faster one for six months so I tried to put the python scblockedript on my website that is hosted in the states.

I have a very simple scblockedript that will send my cookie info and fetch the main HBH page. It works fine on my laptop but when I run it on the webserver I keep getting 302 errors thrown back. You can see it at http://www.mrfirebug.com/hellbound/timed/timed.py but I doubt my phpsessionid will stay valid for much longer. It will probably be broken when the vast majority of people visit.

My laptop is running XP and the server is running a variant of linux. I don't think the OS variance has anything to do with my problem since I'm not using any OS-specific calls.

Something with the remote server + HBH + my code doesn't seem to be mixing well. Does anyone have any ideas? I can pm the code if you want to take a look but I don't want to post here in case there are any unintentional/inadvertent spoilers.
http://www.mrfirebug.com
Author

RE: Python + urllib2

COM
Banned



Posts: 800
Location:
Joined: 31.08.07
Rank:
God
Posted on 25-08-09 17:05
302 isn't an error, it's a redirect. HBH's cookies are IP based, if it doesn't match (which in your case it won't) then it won't recognize you. It's that simple.


K'aem'nhi kh'rn, K'aem'nhi kh'r, K'aem'nhi kh'rmnu.
I'a Y'gs-Othoth!
Author

RE: Python + urllib2

ynori7
Future Emperor of Earth



Posts: 1481
Location: #valhalla
Joined: 08.10.07
Rank:
Diabolical
Posted on 25-08-09 17:27
Indeed, have your scblockedript login with your username and password rather than just using a premade cookie value.

cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append( ('Referer', 'http://www.hellboundhackers.org/index.php') )

login_data = urllib.urlencode({'user_name' : 'username',
'user_pass' : 'password',
'login' : 'Login'
})

resp = opener.open('http://www.hellboundhackers.org/index.php', login_data)
resp.close()

That should fix it.




ynori7 http://halls-of-valhalla.org
Author

RE: Python + urllib2

mrfirebug
Member

Posts: 2
Location:
Joined: 17.08.09
Rank:
Hacker Level 2
Posted on 26-08-09 18:25
Thank you. That was exactly what I needed.
http://www.mrfirebug.com
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.