| Author |
Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
Hi all,
I'm currently messing about with cURL and am having a problem with cookie validation. At the moment i am wanting to display HBH as if i went to it direct. So for this i need a valid cookie and user agent right? Any help with why the following code isn't working (i've starred my specific details out)?
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.hellboundhackers.org/index.php");
curl_setopt($curl, CURLOPT_COOKIE, "PHPSESSID=************; fusion_user=*****.*****************");
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
$page = curl_exec($curl);
curl_close($curl);
echo $page;
?>
|
|
| Author |
RE: Some cURL help? |
GTADarkDude
Member

Posts: 142
Location: The Netherlands
Joined: 23.02.08 Rank: God |
|
Well I can't directly see a flaw in the scblockedript or anything... You are a 100% certain you have the CURL library installed correctly? If in doubt, check phpinfo().
Please try with an URL like 'http://www.google.com/' and skip the cookie line and see if it that works.
... |
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
|
Yes, defo installed and if i remove the cookie line it does fetch the page but with "please register etc". With the cookie line in i just get a blank page, no error or anything. |
|
| Author |
RE: Some cURL help? |
SySTeM
-=[TheOutlaw]=-
Posts: 1524
Location: England, UK
Joined: 27.07.05 Rank: The Overlord |
|
Try adding CURLOPT_FOLLOWLOCATION, TRUE
|
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
|
Its not the cookie ID and i've tried adding that and still no joy system? |
|
| Author |
RE: Some cURL help? |
SySTeM
-=[TheOutlaw]=-
Posts: 1524
Location: England, UK
Joined: 27.07.05 Rank: The Overlord |
|
|
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.hellboundhackers.org/index.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_COOKIE, "PHPSESSID=session; fusion_user=id.hash");
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
curl_setopt($curl, CURLOPT_VERBOSE, 1);
$page = curl_exec($curl);
curl_close($curl);
echo $page;
?>
That works fine for me.
|
|
| Author |
RE: Some cURL help? |
454447415244
Member
Posts: 156
Location:
Joined: 20.04.08 Rank: God |
|
If he is not running it from his computer then he will surely encounter a cookie problem... Because cookies are ip based...
I have the same problem, and I couldn't do the timed challenges here since I can't do it from my computer because of my slow internet connection...
Awesome! |
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
|
Ahhh how stupid of me, no i have been running the scblockedript from my external web server. Thanks for the help guys, ill get php installed on my local and give it a bash. |
|
| Author |
RE: Some cURL help? |
hacker2k
Member
Posts: 126
Location:
Joined: 11.07.07 Rank: Active User |
|
|
MrMayhem wrote:
Ahhh how stupid of me, no i have been running the scblockedript from my external web server. Thanks for the help guys, ill get php installed on my local and give it a bash.
You could do that, or you can make your scblockedript login to the server. Not sure if CURL has a Post request function (don't use it), but if it doesn't, here's the rfc that should help:
http://www.w3.org/Protocols/rfc2616/rfc2616.html |
|
| Author |
RE: Some cURL help? |
root_op
Lord Abortion

Posts: 467
Location: Sweden, Lidköping
Joined: 21.03.07 Rank: God |
|
Easy, just install XAMPP (LAMPP in Linux), enable curl in apache/bin/php.ini and give it a spin on your local machine.
Seriously, do you even care? |
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
|
Yep did that the other day and got a couple of the timed challenges done now! |
|
| Author |
RE: Some cURL help? |
root_op
Lord Abortion

Posts: 467
Location: Sweden, Lidköping
Joined: 21.03.07 Rank: God |
|
Awesome! Keep it coming^^
Seriously, do you even care? |
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
|
It's actually quite addictive but frustrating at the same time, best way to learn though. And for anyone that says they cant attempt the timed challenges...I only started learning PHP a couple of weeks ago so there's no excuse! |
|
| Author |
RE: Some cURL help? |
454447415244
Member
Posts: 156
Location:
Joined: 20.04.08 Rank: God |
|
No there is an excuse at least for me...
I'm on a 64kbps down and 8kbps up connection...
So what do you expect?!!!
Awesome! |
|
| Author |
RE: Some cURL help? |
MrMayhem
Member

Posts: 35
Location: Here, there and everywhere..
Joined: 13.09.08 Rank: God |
|
Okay okay that's fair enough! But you know what I mean |
|
| Author |
RE: Some cURL help? |
spyware
Member

Posts: 4190
Location: The Netherlands
Joined: 14.04.07 Rank: God Warn Level: 90
|
|
|
454447415244 wrote:
No there is an excuse at least for me...
I'm on a 64kbps down and 8kbps up connection...
So what do you expect?!!!
Get a remote shell. Or, complain .

"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 |
|
| Author |
RE: Some cURL help? |
454447415244
Member
Posts: 156
Location:
Joined: 20.04.08 Rank: God |
|
Hehe, brute forcing the database would be easier! 
By the way, why the login form is not anti-bots?!
Anyone can try and brute force any account!
Awesome! |
|
| Author |
RE: Some cURL help? |
elmiguel
Member

Posts: 132
Location: Your Computer
Joined: 12.12.07 Rank: God |
|
I decided to try PHP and cURL. I thought it would be good practice to redo the timed challenges. (note: i have completed all but timed 7, almost done.) But, when I try this scblockedript I get a blank page:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.hellboundhackers.org/challenges/timed/timed1/index.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_COOKIE, "PHPSESSID=session; fusion_user=id.hash;");
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)");
curl_setopt($curl, CURLOPT_VERBOSE, 1);
$page = curl_exec($curl);
curl_close($curl);
echo $page;
?>
I also tried using fsockopen(). But, it will not insert the fusion_user. It inserts the cookie: PHPSESSID.
<?php
$url = "/challenges/timed/timed1/index.php";
$fp = fsockopen("www.hellboundhackers.org", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET $url HTTP/1.1\r\n";
$out .= "Host: www.hellboundhackers.org\r\n";
$out .= "Cookie: PHPSESSID=session\r\n";
$out .= "Cookie: fusion_user=id.hash\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}
?>
The philosophy of one century is the common sense of the next. -Fortune Cookie
I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor
|
|
| Author |
RE: Some cURL help? |
korg
Admin from hell

Posts: 1704
Location: ENDING YOUR ONLINE EXPERIENCE!
Joined: 01.01.06 Rank: The Master |
|
Use:
$page = curl_exec($curl);
echo $page
Your closing curl before it echoes.
I deal in pain, All life I drain, I dominate, I seal your fate.
|
|
| Author |
RE: Some cURL help? |
-Kurt-
Member

Posts: 52
Location: 74.64.93.220
Joined: 29.08.06 Rank: God |
|
|
korg wrote:
Use:
$page = curl_exec($curl);
echo $page
Your closing curl before it echoes.
Hm, would that really matter though? As long as the call to curl_exec is made before the connection closes, and the return of that gets stored in $page, it shouldn't matter when $page is used, even after curl_close is called. Unless I'm mistaken.
@OP: elmiguel, you don't need the verbose, followlocation, or useragent options for the timed challenges. So I think your problem is how you're sending cookies. The only cookie you need to send is your fusionid. The PHPSESSID (except for Timed 7) and _csuid cookies are unnecessary, so you might as well not include the PHPSESSID cookie in the cookie option.

Edited by -Kurt- on 10-08-09 19:32 |
|