|
Posted by deerhack@gmail.com on 01/31/08 04:21
Well ... I using a function by me (deerme)
The which allows me to perform ussing Protocol http (GET o POST) and
Capture de Cookie ...
This a Example.
1.- Login in Forum IPB in aq2chile.cl vi user ZeTTa 311286
2.- Capture Info of Post (http://www.aq2chile.cl/foro/index.php?
showtopic=2738) To which can only be accessed Login in the Forum.
<?
// Login de un Foro IPB
// by deerme.org
function get($host,$puerto,$patch,$referer,$cookie)
{
$fp = fsockopen($host,$puerto,$errno, $errstr,3);
fputs($fp,
"GET $patch HTTP/1.1
Host: $host
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:
1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: *
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: $referer
Cookie: $cookie
Connection: Close\r\n\r\n
");
while (!feof($fp))
{
$salida .= fread($fp, 8192);
}
fclose($fp);
return $salida;
}
function post($host,$puerto,$patch,$referer,$cookie,$data_lenght,
$data)
{
$fp = fsockopen($host,$puerto,$errno, $errstr,3);
fputs($fp,
"POST $patch HTTP/1.1
Host: $host
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:
1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: *
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: $referer
Cookie: $cookie
Content-Type: application/x-www-form-urlencoded
Content-Length: $data_lenght
$data
Connection: Close\r\n\r\n
");
while (!feof($fp))
{
$salida .= fread($fp, 8192);
}
fclose($fp);
return $salida;
}
$user = "ZeTTa";
$pass = "311286";
$datos = "UserName=".$user."&PassWord=".$pass."&x=23&y=17";
$salida = post("www.aq2chile.cl",80,"/foro/index.php?
act=Login&CODE=01&CookieDate=1","http://www.aq2chile.cl/foro/
index.php?","session_id=f3325bc0e30a7fa2dc1f2020e04b7cf2;
ipb_stronghold=c5c4abb621f984b5a72597ea0bc24369; member_id=0;
pass_hash=0; coppa=0; anonlogin=-1", strlen($datos),$datos );
// Capturamo la Cookie del Servidor
// Creamos Parse para la Cookie
$parser="|Set-Cookie: (.*?)\n|is";
if( preg_match_all($parser, $salida, $capturado) )
{
// Guardamos Cookie
for($i=0;$i<count($capturado[1]);$i++)
{
if ( $i == (count($capturado[1]) -1 ) )
$cookie .= $capturado[1][$i];
else
$cookie .= $capturado[1][$i].'; ';
}
// Eliminamos Enters
$cookie = str_replace("\r","",$cookie);
}
echo $cookie;
// Entramos a la URL para la Cookie
$salida = get("www.aq2chile.cl",80,"/foro/index.php?
showtopic=2738","http://www.aq2chile.uni.cc/foro/index.php?",$cookie);
echo $salida;
//echo "Vamos a Comenzar<br>";
//echo $salida;
?>
Navigation:
[Reply to this message]
|