Follow us on Twitter!
Become the change you seek in the world. - Gandhi
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 16
Guests Online: 16
Members Online: 0

Registered Members: 82876
Newest Member: bhl1986
Latest Articles
View Thread

HellBound Hackers | Challenges | Timed Challenges

Author

Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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 expression 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 script that save the http response headers in a array then im using a regular expression 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.


Author

RE: Best way to parse http response body

mido
Member

Your avatar

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


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 29-07-07 17:02
Well im tring to set up a php/cURL script 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.


Author

RE: Best way to parse http response body

mikispag
Member



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

with cURL/PHP do like this:

Code

$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!


www.trovatel.net/img/userbar.gif
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

Your avatar

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


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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" Pfft


Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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 Wink


Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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 on 20-09-07 15:10
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-09-07 12:30
i did a few with cURL and php.not even using regex(),just explode()
and substr() :happy:


Author

RE: Best way to parse http response body

mido
Member

Your avatar

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


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-09-07 13:26
heh. I did them all with only greasemonkey scripts Grin


Author

RE: Best way to parse http response body

SySTeM
Member

Your avatar

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


img138.imageshack.us/img138/6527/sig2ak1.jpg
www.hellboundhackers.org/sig/r/2783.png

http://www.elites0ft.com/
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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 Smile


Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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(':'Wink
data = data[1].replace(' ', ''Wink
data = data.replace('<strong>', ''Wink

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>',''Wink.replace('</strong>', ''Wink
Author

RE: Best way to parse http response body


Member

Your avatar

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


Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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: 4192
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.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
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
[/s
http://bitsofspy.net
Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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.


Author

RE: Best way to parse http response body


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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.