Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
This one seems easy enough. dictionary to get the 'seventh' = 7 part.
simple parsing for the number.
I'm just having a hard time with the RE to grab a line of html.
I don't wanna spoil, but the html is
<a href="[URL]" class=l onmousedown="return clk(this.href,'','','res','[nth result]','' ">
My RE is HIDEOUS.
having " and ' and needing python escapes as weel as re escape makes it worse. Anyone have a relatively simple RE for this? |
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
a good way to do this is the HTMLParser class in python.
And theres a good article and code bank bit for this particular challenge.
read
http://www.hellbo. . .class.html
http://www.hellbo. . .hp?id=1145
as for the capturing of the item needed you could do something like this
google_term=re.findall('<strong>[a-z\s\w]+</strong>', source)[-2]
Edited by on 05-09-08 05:28 |
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Yes, i have it all.
I use the HTMLParser to find all class=l a href links, then i grab the nth.
I base64.encode() it, then throw it in as an argument, but it does work. I then tried adding some extra info, but i kept that info blank, hoping it would change the method to POST, but it's either not changing it to POST or it's still not working. |
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
You dont sound like you are doing this in python....
|
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
You're right, I don't know what language I'm programming in.
:right:
Code
from HTMLParser import HTMLParser
import base64
...
b64url = base64.b64encode(url)
...
result = opener.open("http://www.hellboundhackers.org/challenges/timed/timed6/index.php?url=%s" % b64url, blankdata)
|
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
The_Gman wrote:
You're right, I don't know what language I'm programming in.
:right:
Code
from HTMLParser import HTMLParser
import base64
...
b64url = base64.b64encode(url)
...
result = opener.open("http://www.hellboundhackers.org/challenges/timed/timed6/index.php?url=%s" % b64url, blankdata)
You are using a GET request. Try reading this: http://mail.pytho. . .68493.html
|
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
stdio wrote:
The_Gman wrote:
You're right, I don't know what language I'm programming in.
:right:
Code
from HTMLParser import HTMLParser
import base64
...
b64url = base64.b64encode(url)
...
result = opener.open("http://www.hellboundhackers.org/challenges/timed/timed6/index.php?url=%s" % b64url, blankdata)
You are using a GET request. Try reading this: http://mail.pytho. . .68493.html
But I'm including some url encoded data, the manual said it should work as post.
should i even url encode the url=? part?
Thanks |
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
The_Gman wrote:
You're right, I don't know what language I'm programming in.
:right:
Code
from HTMLParser import HTMLParser
import base64
...
b64url = base64.b64encode(url)
...
result = opener.open("http://www.hellboundhackers.org/challenges/timed/timed6/index.php?url=%s" % b64url, blankdata)
Alright sorry man.... try using urllib2's Request class.
|
 |
Author | RE: Timed 6 |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
I made it so it posts.
This is the header
POST /challenges/timed/timed6/index.php HTTP/1.1
Accept-Encoding: identity
Content-Length: 52
Connection: close
User-Agent: Python-urllib/2.5
Host: www.hellboundhackers.org
Cookie:cookiestuff
Referer: http://www.hellboundhackers.org/index.php
Content-Type: application/x-www-form-urlencoded
url=aHR0cDovL3d3dy5tb3ppbGxhLm9yZy9kb3dubG9hZC5odG1s
The word i got was firefox
4th entry
http://www.mozilla.org/download.html
Does that look right?
Thanks, |
 |