Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reverse Engineering Team: Login Proxy

Eddy Stryker
libsecondlife Developer
Join date: 6 Jun 2004
Posts: 353
05-11-2006 02:39
CODE
<?php

// Login Proxy
// v1.0.0
// Author: John Hurliman (Eddy Stryker)
//
// This is a man in the middle "attack" on the TLS encryption used by the
// client to login to Second Life. Set the client to connect to the URL of
// this PHP script with -loginuri http://www.mywebsite.com/thisscript.php.
// The client will initialize an unencrypted (or encrypted, if your address
// is an https) connection to the script, which will forward the POST contents
// from the client to the main grid login server. The reply is sent back to the
// client so a login can be completed. This is useful for comparing values sent
// during login to a packet capture of how the client responds with things
// such as the session_id and secure_session_id

function log_message($message) {
$filename = 'output.txt';
$fp = fopen($filename, "a");
$write = fputs($fp, $message);
fclose($fp);
}

log_message("Transaction initiated from $REMOTE_ADDR (" . strlen($HTTP_RAW_POST_DATA) . " bytes): " . $HTTP_RAW_POST_DATA . "\n");

ob_start();

$ch = curl_init();

$headers[0] = "Accept-Encoding: gzip";
$headers[1] = "Content-Type: text/xml";

curl_setopt($ch, CURLOPT_URL, "https://login.agni.lindenlab.com/cgi-bin/login.cgi");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 9);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $HTTP_RAW_POST_DATA);
curl_setopt($ch, CURLOPT_POSTFIELDSIZE, strlen($HTTP_RAW_POST_DATA));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);

$string = ob_get_contents();

if (curl_errno($ch)) {
log_message("Error: " . curl_error($ch) . "\n");
return;
}

log_message("Server reply: $string\n");

curl_close($ch);
ob_end_clean();

header('Content-type: text/xml');
echo $string;

?>
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
05-15-2006 07:23
/54/c7/123365/1.html
_____________________
i've got nothing. ;)