Join us at IRC!
I'd prefer to die standing, than to live on my knees - Che Guevara
Wednesday, May 23, 2012
Navigation
Members Online
Total Online: 36
Web Spiders: 16
Guests Online: 31
Members Online: 5

Registered Members: 70162
Newest Member: Windows-2012
Latest Articles
View Thread

HellBound Hackers | Challenges | Timed Challenges

Author

Best way to parse http response body

Larika
Member



Posts: 318
Location: Italy
Joined: 17.01.06
Rank:
God
Posted on 29-07-07 15:42
Hello all, in each timed challenge we need to keep the http response body,
serach a string on it, do some operations and do a new request with the result value.
Now i already did real 11 and i had no problems parsing the response to find the number between the two tags <h1></h1>. Now the challenge is a bit different so we have to use regular expresblockedsion to find the right string.
Im here to ask suggestions on the better/easy way to parse the response body and search that string:
Im using a curl php scblockedript that save the http response headers in a array then im using a regular expresblockedsion in a preg match that find the string. Im having a lot of problems parsing the response body and finding the needed string.

Any help/suggestion will be appreciated, thanks.



Vivi come se dovessi morire il giorno dopo
Pensa come se non dovessi morire mai
larikagm@gmail.com COMING SOON
Author

RE: Best way to parse http response body

mido
Member

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
God
Posted on 29-07-07 16:53
You can use :
substr and indexOf if youre using javascblockedript...



mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body

Larika
Member



Posts: 318
Location: Italy
Joined: 17.01.06
Rank:
God
Posted on 29-07-07 17:02
Well im tring to set up a php/cURL scblockedript that is able to store the response body and then make operations on it, so i can use it as a base for all the challenges. My problem is that i cant store the body of the response to a string or in a array.



Vivi come se dovessi morire il giorno dopo
Pensa come se non dovessi morire mai
larikagm@gmail.com COMING SOON
Author

RE: Best way to parse http response body

mikispag
Member



Posts: 43
Location: Italy
Joined: 14.11.06
Rank:
God
Posted on 29-07-07 17:08
Hi,

with cURL/PHP do like this:


$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,"http://www.hellboundhackers.org/challenges/timed/timed3/index.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_COOKIE,"PHPSESSID=5b1sXXXXo5niv5p0t24ntbh56X;fusion_user=13XXX.cXXX282138afbe9066b8be1cb426841d");
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5");

$result = curl_exec ($curl);
curl_close ($curl);
print $result;


The variable $result will have the HTML body of the page. Remember, you must spoof the Useragent because HBH doesn't allow cURL traffic!



Code is written, future is not


Edited by mikispag on 29-07-07 17:09
http://www.trovatel.net
Author

RE: Best way to parse http response body

mido
Member

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
God
Posted on 29-07-07 18:19
Well, to be honest, i forgot to thank mikispag :)
he who helped me ...



mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body

LanceUppercut
Member



Posts: 7
Location: Your Mom's Box
Joined: 25.01.06
Rank:
God
Posted on 30-07-07 03:42
Hey Larika,
I've knocked out two of these fuckers so far using perl and some regexes. PM if you need help on the first one...I've got just the regex you're looking for to parse the b64 string that is in between "string: " and " and" :p


Don't Just Stare At It...Eat It!!!

Author

RE: Best way to parse http response body

The_Cell
Member



Posts: 306
Location: Belgium
Joined: 07.04.05
Rank:
God
Posted on 31-07-07 13:36
I did 1,2 and 3 using PHP, cURL and regexes. If you use those 3 technologies, you'll beat them within an hour ;)



Made by Monster
Hacking is creativity. - The_Cell

<none> <ask me> <none>
Author

RE: Best way to parse http response body

contmp
Member



Posts: 36
Location: behind shadows of proxy servers and redirectors
Joined: 27.01.07
Rank:
Newbie
Warn Level: 5
Posted on 20-09-07 15:08
you can use python (the way I do it)

url = 'http://www.hellboundhackers.org/challenges/timed/timed4/index.php'
footer = 'Your word is: <strong>'
trailer = '</strong><br /><br /><form action='

... some urllib code here....

f = data.find(footer)
t = data.find(trailer)
data = data[f:t]
data = data.split(':')
data = data[1].replace(' ', '')
data = data.replace('<strong>', '')

simple, not very elegant, but it works! :-)

please feel free to PM me.

Edited by contmp on 20-09-07 15:10
http://2130706433
Author

RE: Best way to parse http response body

darksun
Member



Posts: 254
Location: the netherlands
Joined: 15.08.06
Rank:
God
Warn Level: 10
Posted on 21-09-07 12:30
i did a few with cURL and php.not even using regex(),just explode()
and substr() :happy:


c12h17n2o4p -> c12h16Nn2o -> O_O
When you make the campfire bigger, more darkness is revealed.
I found more questions then answers in my search.

You recognize but you ain't seen nothing. Experience is the best teacher.
CRIT9JGbG1Riw CRJmLyD9U1pvg CRIT9JGbG1Riw http://valleywag.com/tech/svug/svug-2-do-tech-people-do-drugs-219309.php
Author

RE: Best way to parse http response body

mido
Member

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
God
Posted on 21-09-07 12:37
There are many ways, ereg(), preg_matches(), etc etc...



mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body

WhiteAcid
Member



Posts: 123
Location: UK
Joined: 08.05.05
Rank:
Elite
Posted on 21-09-07 13:26
heh. I did them all with only greasemonkey scblockedripts :D


-Sid
sakaru@gmail.com http://www.whiteacid.org
Author

RE: Best way to parse http response body

SySTeM
-=[TheOutlaw]=-

Posts: 1524
Location: England, UK
Joined: 27.07.05
Rank:
The Overlord
Posted on 21-09-07 13:42
I used PHP and cURL, didn't take too long to do.




http://www.elites0ft.com/
Author

RE: Best way to parse http response body

mr noob
Member

Posts: 553
Location:
Joined: 22.01.06
Rank:
HBH Guru
Warn Level: 1
Posted on 21-09-07 17:26
darksun wrote:
i did a few with cURL and php.not even using regex(),just explode()
and substr() :happy:


<3 explode, i dont have to learn regex b*llocks :)


as DigitalFire kindly pointed out, he is a grammar nazi :p
sucks. ask me. ask me. www.securewebdev.org
Author

RE: Best way to parse http response body

The_Gman
Member

Posts: 30
Location:
Joined: 02.09.08
Rank:
Mad User
Posted on 11-09-08 00:49
contmp wrote:
you can use python (the way I do it)

url = 'http://www.hellboundhackers.org/challenges/timed/timed4/index.php'
footer = 'Your word is: <strong>'
trailer = '</strong><br /><br /><form action='

... some urllib code here....

f = data.find(footer)
t = data.find(trailer)
data = data[f:t]
data = data.split(':';)
data = data[1].replace(' ', '';)
data = data.replace('<strong>', '';)

simple, not very elegant, but it works! :-)

please feel free to PM me.


word = re.findall('\<strong\>[A-Za-z0-9 ]+</strong>', html)[0].replace('<strong>','';).replace('</strong>', '';)
Author

RE: Best way to parse http response body

Zephyr_Pure
Member



Posts: 2402
Location:
Joined: 15.09.06
Rank:
God
Posted on 11-09-08 00:58
Don't bump YEAR OLD THREADS, asshat.


I still check PMs from time to time.




Our responses were moronic, why shouldn't he follow suit? - Futility
Author

RE: Best way to parse http response body

The_Gman
Member

Posts: 30
Location:
Joined: 02.09.08
Rank:
Mad User
Posted on 15-09-08 03:25
It was still on the front page, shithead
Author

RE: Best way to parse http response body

spyware
Member



Posts: 4190
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 15-09-08 03:26
The_Gman wrote:
It was still on the front page, shithead


No it wasn't.




"The chowner of property." - Zeph
“Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.”
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
http://bitsofspy.net
Author

RE: Best way to parse http response body

Zephyr_Pure
Member



Posts: 2402
Location:
Joined: 15.09.06
Rank:
God
Posted on 15-09-08 03:30
The_Gman wrote:
It was still on the front page, shithead


The post before yours was from a year ago, fucktard. Pay attention and shut the hell up if you don't know what you're talking about.


I still check PMs from time to time.




Our responses were moronic, why shouldn't he follow suit? - Futility
Author

RE: Best way to parse http response body

The_Gman
Member

Posts: 30
Location:
Joined: 02.09.08
Rank:
Mad User
Posted on 17-09-08 00:19
Zephyr_Pure wrote:
The_Gman wrote:
It was still on the front page, shithead


The post before yours was from a year ago, fucktard. Pay attention and shut the hell up if you don't know what you're talking about.

I wasn't denying that it was a year old, I was saying it was on the front page. Does it really bother you that a topic was moved up twenty lines?

Especially when I contributed something that can benefit others.

I'm glad you wasted your time posting :angry:
Author

RE: Best way to parse http response body

Zephyr_Pure
Member



Posts: 2402
Location:
Joined: 15.09.06
Rank:
God
Posted on 17-09-08 00:35
Dude, SHUT UP. You bumped a year-old thread... that's a no-no. Doesn't matter if what you said would help, because the OP has already forgotten about the topic. When the topic is long dead, the OP obviously isn't interested anymore. When the OP leaves a thread for dead, leave it dead. It's not fucking rocket science.


I still check PMs from time to time.




Our responses were moronic, why shouldn't he follow suit? - Futility
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.