| Author |
Has anyone actually done timed 1 in python? |
jjbutler88
Colemak User

Posts: 590
Location:
Joined: 22.04.07 Rank: Guru |
|
Ive come close but everything ive coded takes far far too long. Heres the rough steps im taking:
Opening the index of HBH with cookiejar to log me in
Getting the source of the timed 1 page
Matching the string with a regexp
b64 decoding it and sending it back
All these seem to take longer than a second on they're own. I tried it with PHP/cUrl but I dont know enough PHP, and had loads of problems with the curl stuff. Id prefer to stick with python, but im not sure its even possible.
Note: Please dont send me source code answers, I wanna work this one out on my own, but does anybody know if this is at least possible. Am I over-complicating things?
Cheers
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Uber0n
Member

Posts: 1963
Location: Sweden
Joined: 13.06.06 Rank: God |
|
I think you're doing it the right way, although your connection might be too slow. Bring the application to school or something and try it there.
I've beaten it both in VB6 and in GML (with a DLL made in C++), and I know a lot of people did it in PHP. Python should definately be able to beat it as well 

http://uber0n.webs.com/ |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Mouzi
Member

Posts: 144
Location: Finland
Joined: 08.08.06 Rank: God |
|
I still think people are making this too complicated ;P I did all of them with JS. Of course it's good programming experience though to try doing them in different languages.
EDIT: Oops, I haven't done that fourth one yet.
EDIT2: Now I have (and with JS again).

Steganographs
Edited by Mouzi on 18-05-08 12:48 |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
jjbutler88
Colemak User

Posts: 590
Location:
Joined: 22.04.07 Rank: Guru |
|
YES!
Did it! Took me far too long (3 hours) but I learnt loads about urllib and python in general. Timed 2 here I come.... 
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Demons Halo
Member

Posts: 261
Location: Sweden
Joined: 26.03.09 Rank: Hacker Level 1 |
|
how the heck did you do it? :S I can't get it to work under 1.3 sec!! The requests take 1.2 sec and 0.1 for decoding... :/
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
clone4
Member

Posts: 586
Location: He is back and he's bad!
Joined: 25.11.07 Rank: God |
|
|
Demons Halo wrote:
how the heck did you do it? :S I can't get it to work under 1.3 sec!! The requests take 1.2 sec and 0.1 for decoding... :/
Your request takes ages, I think it's a slow connection. And the decoding takes way too much time as well, maybe some code optimization
[img][/img]

spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
COM
Banned

Posts: 800
Location:
Joined: 31.08.07 Rank: God |
|
Well I don't know any python, but in case it works as in many other languages and you gather the information sent to you in chunks then it might be quicker to just get roughly enough to include the data you're after then not care to receive the rest. Should save you a bit of time.
K'aem'nhi kh'rn, K'aem'nhi kh'r, K'aem'nhi kh'rmnu.
I'a Y'gs-Othoth! |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Demons Halo
Member

Posts: 261
Location: Sweden
Joined: 26.03.09 Rank: Hacker Level 1 |
|
I've looked through urllib and urllib2. The easiest way to handle cookies is by using the request class with cookies in the headers.
I'm using a 24mbit/s connection so... I doubt the speed thingy :/
best I could do was 1.3sec @ 07.00 before I went to work while there was 5-6 members online.
@COM. hmm you must be right... I'm using read() [15000:-10000] to minimize the search area, although there must be a way to receive only a bit of the source code right away. I'll check it out 
//D.H.
Edited by Demons Halo on 20-04-09 12:08 |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
s3r1al
Member

Posts: 11
Location:
Joined: 06.03.06 Rank: Elite |
|
i think the fastest way would be by using sockets directly; construct the headers by hand...
Sanity calms, but madness is more interesting. |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Demons Halo
Member

Posts: 261
Location: Sweden
Joined: 26.03.09 Rank: Hacker Level 1 |
|
O.o
what difference would it make? the socket requests the URL anyway, which the request class does as well. What I need is some kind a syntax (which I've been googling for), where I can specify what chunk of the source I want to retrieve.
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
s3r1al
Member

Posts: 11
Location:
Joined: 06.03.06 Rank: Elite |
|
Why would you want to get part of the source, it wouldnt be significantly faster than getting the whole source...
Sanity calms, but madness is more interesting. |
|
| Author |
RE: Has anyone actually done timed 1 in python? |
Demons Halo
Member

Posts: 261
Location: Sweden
Joined: 26.03.09 Rank: Hacker Level 1 |
|
what is the problem then? :( :(
I was thinking like: request less data -> less work time.
Reading the full source, sorting out the string and decode it takes less than 0,1 second. It's the requesting and submitting parts that are slow, and they are pretty much as short as they can be:
from urllib2 import *
url='http://www.hellboundhackers.org/challenges/timed/timed1/index.php'
headers = {'COOKIE': 'xxx', 'Referer': 'http://www.hellboundhackers.org/'}
req = Request(url, None, headers)
response = urlopen(req)
It can't be any simpler than that :S the same thing goes for submitting with a little url editing!
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
s3r1al
Member

Posts: 11
Location:
Joined: 06.03.06 Rank: Elite |
|
idk... i used sockets and it took me a couple of tries...
Sanity calms, but madness is more interesting. |
|
| Author |
RE: Timed 1 |
ro9
Member

Posts: 5
Location:
Joined: 12.08.08 Rank: Hacker Level 1 |
|
Need some help...
Keep getting YOU MUST BE LOGGED IN TO PLAY!
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
stdio
Member
Posts: 375
Location: omnipresent
Joined: 06.04.08 Rank: God |
|
|
ro9 wrote:
Need some help...
Keep getting YOU MUST BE LOGGED IN TO PLAY!
Did you even read the forum on "Timed 1 in python" The answer to log in isnt even hinted, its blatantly there in more than 1 way to do it.
http://www.hellboundhackers.org/forum/timed_1_in_python-69-12936_0.html
I'm sorry, I cant hear you over the sound of how awesome I am! |
|
| Author |
RE: still need help |
ro9
Member

Posts: 5
Location:
Joined: 12.08.08 Rank: Hacker Level 1 |
|
i did login with the code on the thread the one with cookielib
but when i open the challenge index
i still get ' YOU MUST BE LOGGED IN TO PLAY!'
did try HBH class from the link provided, everything okay except time limit
and with HBH class i got 2 line of Set-Cookie and urllib2 just 1 with PHPSESSID
i'm trying to understang the difference
|
|
| Author |
RE: Has anyone actually done timed 1 in python? |
ynori7
Future Emperor of Earth

Posts: 1481
Location: #valhalla
Joined: 08.10.07 Rank: Diabolical |
|
Use the code from stdio's post in that thread, and then when you access the timed challenge page use the "opener" variable which contains the all the headers and cookies and stuff.
|
|