| Author |
RE: Timed 1 in Python |
x_5631
Member
Posts: 156
Location: Uk
Joined: 22.06.07 Rank: Mad User |
|
Yeah I know it doesn't 'open' it, I'm using urllib2.urlopen() along with Request. Thanks for mentioning that, though. I should've pointed out I was using .urlopen too, sorry.
and Sure, I'll PM you with my code 
|
|
| Author |
RE: Timed 1 in Python |
x_5631
Member
Posts: 156
Location: Uk
Joined: 22.06.07 Rank: Mad User |
|
Okay, not sure if you got my PM.
Anyway, after reading your old post on the same subject. I've read through and figured I seem to be having the exact same problem as you (the second one in that thread, not the original one).
Would you be able to give me a hint of what you did?
|
|
| Author |
RE: Timed 1 in Python |
SwartMumba
Member

Posts: 292
Location: TX <--- I'm here
Joined: 18.09.07 Rank: Uber Elite |
|
I had a problem with the cookies. Anyway, I pmed you.
|
|
| Author |
RE: Timed 1 in Python |
x_5631
Member
Posts: 156
Location: Uk
Joined: 22.06.07 Rank: Mad User |
|
Thanks a lot SwartMumba 
Helped a lot. 
|
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
Hey, I'm doing the same thing as you (using python) I'm just wondering how you got yourself logged in using urlencode
userpass = {'user_name':'The_Gman',
'user_pass':'*******',
'remember_me':'y'}
logininfo = urllib.urlencode(userpass)
doesn't seem to work.
Also, once you have requested the document, how did you quickly search for the string properly and parse?
Thanks |
|
| Author |
RE: Timed 1 in Python |
stdio
Member
Posts: 375
Location: omnipresent
Joined: 06.04.08 Rank: God |
|
|
login_data = urllib.urlencode({'user_name' : 'stdio',
'user_pass' : 'mypassword',
'login' : 'Login'
})
Though doing it this way you have to have a cookie jar set up, and as usual you must still set the headers like user agent and referrer
Yeah I just noticed you didnt have the login set, you need that, and I wouldnt worry about the remember me
I'm sorry, I cant hear you over the sound of how awesome I am!
Edited by stdio on 02-09-08 02:42 |
|
| Author |
RE: Timed 1 in Python |
SwartMumba
Member

Posts: 292
Location: TX <--- I'm here
Joined: 18.09.07 Rank: Uber Elite |
|
The_Gman: It would also help if you used the correct password.
******* does not seem to be your correct password.
|
|
| Author |
RE: Timed 1 in Python |
jjbutler88
Colemak User

Posts: 590
Location:
Joined: 22.04.07 Rank: Guru |
|
I find using urllib2.Request to be the easiest way, the syntax is something like:
Request(<url>,<data>,<headers>)
so you can do this (assume your details are urlencoded in a variable called 'login':
import urllib2
req = urllib2.Request('http://www.hellboundhackers.org/challenges/timed/timed1/index.php?b64='+b64val,None,login)
Then just urlopen the request
|
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
stdio wrote:
login_data = urllib.urlencode({'user_name' : 'stdio',
'user_pass' : 'mypassword',
'login' : 'Login'
})
Though doing it this way you have to have a cookie jar set up, and as usual you must still set the headers like user agent and referrer
Yeah I just noticed you didnt have the login set, you need that, and I wouldnt worry about the remember me
Didn't have the login set? You mean like... set which form I was submitting? I'm not too sure what the header looks like in that case. I also have no idea what I would set as the referrer/user-agent in that case, but i don't know how
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
Here's what i have for the login
userpass = {'user_name':'The_Gman',
'user_pass':'myrealpasswordthistime',
'remember_me':'y'}
logininfo = urllib.urlencode(userpass)
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
request = urllib2.Request("http://www.hellboundhackers.org/index.php", logininfo, headers)
response = urllib2.urlopen(request)
print response.read()
|
|
| Author |
RE: Timed 1 in Python |
stdio
Member
Posts: 375
Location: omnipresent
Joined: 06.04.08 Rank: God |
|
The_Gman wrote:
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
Here's what i have for the login
userpass = {'user_name':'The_Gman',
'user_pass':'myrealpasswordthistime',
'remember_me':'y'}
logininfo = urllib.urlencode(userpass)
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
request = urllib2.Request("http://www.hellboundhackers.org/index.php", logininfo, headers)
response = urllib2.urlopen(request)
print response.read()
Now let me again correct your login scblockedript
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' : 'stdio',
'user_pass' : 'password',
'login' : 'Login'
})
resp = opener.open('http://www.hellboundhackers.org/index.php', login_data)
resp.close()
Understand?
Edit: Smileys really need to be disabled between code tags :(
I'm sorry, I cant hear you over the sound of how awesome I am!
Edited by stdio on 04-09-08 03:40 |
|
| Author |
RE: Timed 1 in Python |
SwartMumba
Member

Posts: 292
Location: TX <--- I'm here
Joined: 18.09.07 Rank: Uber Elite |
|
Or if you wanted to do it the leet way: http://leeturl.net/qxd 
You could use that scblockedript to complete the challenges. There is an example of a GET, POST request, and quick string parsing.
The first request is a POST request which basically 'logs you in.'
The second request is just a GET request to get the index.php of HBH, to show that you are logged in.
To test the scblockedript, just change the user name and password to yours. Make sure to encode the proper chars, if there are any.
|
|
| Author |
RE: Timed 1 in Python |
stdio
Member
Posts: 375
Location: omnipresent
Joined: 06.04.08 Rank: God |
|
I actually like that code a lot SwartMumba
I'm sorry, I cant hear you over the sound of how awesome I am! |
|
| Author |
RE: Timed 1 in Python |
slpctrl
Member
Posts: 945
Location: 2147483647
Joined: 19.04.07 Rank: God |
|
SwartMumba wrote:
the leet way: http://leeturl.net/qxd 
Very nice, good sir. *Tips hat* .
|
|
| Author |
RE: Timed 1 in Python |
Infam0us
Member

Posts: 153
Location: 0x080484c6
Joined: 06.09.07 Rank: HBH Guru |
|
SwartMumba wrote:
Or if you wanted to do it the leet way: http://leeturl.net/qxd
Impressive, why dont you submit that to the code bank?
"Never memorize what you can look up in books." -Albert Einstein


[img]javasc ript:alert(document.cookie);[/img]
Edited by Infam0us on 04-09-08 15:09 |
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
stdio wrote:
The_Gman wrote:
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
Here's what i have for the login
userpass = {'user_name':'The_Gman',
'user_pass':'myrealpasswordthistime',
'remember_me':'y'}
logininfo = urllib.urlencode(userpass)
headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
request = urllib2.Request("http://www.hellboundhackers.org/index.php", logininfo, headers)
response = urllib2.urlopen(request)
print response.read()
Now let me again correct your login sc blockedript
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' : 'stdio',
'user_pass' : 'password',
'login' : 'Login'
})
resp = opener.open('http://www.hellboundhackers.org/index.php', login_data)
resp.close()
Understand?
Edit: Smileys really need to be disabled between code tags :(
kk I'll try that, thanks for the help |
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
SwartMumba wrote:
Or if you wanted to do it the leet way: http://leeturl.net/qxd
You could use that sc blockedript to complete the challenges. There is an example of a GET, POST request, and quick string parsing.
The first request is a POST request which basically 'logs you in.'
The second request is just a GET request to get the index.php of HBH, to show that you are logged in.
To test the sc blockedript, just change the user name and password to yours. Make sure to encode the proper chars, if there are any.
That code is really nice and clean. I had to program a proxy in c and had to hand build some headers like that. That said, I've done it, I just want to become more familiar with urllib2. I'm making a little application that can be used for (hopefully) all the timed challenges. |
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
Hm, it should work, but I'm getting 'Wrong string, try again!'. I'm guessing it's a speed issue though, because i think my re is good. I sent the code to one stdio because I obviously can't just post it here though.
How does the re look?
code = re.findall('[A-Za-z0-9]+\=\=', html)[0]
decoded = base64.b64decode(code)
|
|
| Author |
RE: Timed 1 in Python |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
Holy multipost..
stdio, you inbox was full
I realized my problem. I was passing the decoded string as an argument and not feeding the token in the first string argument (", string vs " % string)
Now i get the too slow error I'll try it at work or something. |
|
| Author |
RE: Timed 1 in Python |
deathalive
Member

Posts: 84
Location:
Joined: 06.06.06 Rank: HBH Guru |
|
My scblockedript is too slow too... 
btw to easily input cookies into the request, use req.add_header("Cookie", "your cookies here" , it is much simplier than your way :0
 |
|
| Author |
RE: i'm stuck |
ro9
Member

Posts: 5
Location:
Joined: 12.08.08 Rank: Hacker Level 1 |
|
i used cookielib, opener, urlencode, and user-agent & referer headers
still get YOU MUST BE LOGGED IN TO PLAY! (no login)
Basicly i copy and paste the posted code and change user & pass.
|
|