! DOCTYPEhtmlPUBLIC-// W3C // DTDXHTML1.0Transitional // ENhttp: // Configure:
MSN test
# Filename: fm. php
# Purpose: get MSN contact list
# Author: http://qartis.com /? Qmsn modified by Druggo
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['password'];
$ Debug = 0;
$ Trid = 0;
$ Proto = "MSNP10 ";
# Start here
Echo "communication protocol $ proto
";
Echo "start logging on
";
# Login now
$ Sbconn = fsockopen ("messenger.hotmail.com", 1863) or die ("Can't connect to MSN server ");
Flush ();
Data_out ("VER $ trid $ proto CVR0 ");
Data_in ();
Data_out ("CVR $ trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $ username ");
Data_in ();
Data_out ("USR $ trid twn I $ username ");
$ Temp = data_in ();
If (! Stristr ($ temp ,":")){
If (substr ($ temp, 0, 3) = 601 ){
# Echo "Error: The MSN servers are currently unavailable .";
Echo "Unfortunately, the MSN server crashes again>. <
";
Die ();
} Else {
Echo "connection failed!
";
Fclose ($ sbconn );
Die ();
}
}
@ Fclose ($ sbconn );
$ Temp_array = explode ("", $ temp );
$ Temp_array = explode (":", $ temp_array [3]);
Flush ();
$ Sbconn = fsockopen ($ temp_array [0], $ temp_array [1]) or die ("error -_-#");
Data_out ("VER $ trid $ proto CVR0 ");
Data_in ();
Flush ();
Data_out ("CVR $ trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $ username ");
Data_in ();
Data_out ("USR $ trid twn I $ username ");
$ Temp = data_in ();
$ Temp_array = explode ("", $ temp );
Flush ();
$ TOKENSTRING = trim (end ($ temp_array ));
# Echo "authenticating ";
Echo "authentication ......
";
Flush ();
$ Nexus_socket = fsockopen ("ssl: // nexus.passport.com", 443 );
Fputs ($ nexus_socket, "GET/rdr/pprdr. asp HTTP/1.0/r \ n \ r \ n ");
While ($ temp! = "\ R \ n "){
$ Temp = fgets ($ nexus_socket, 1024 );
If (substr ($ temp, 0,12) = "PassportURLs "){
$ Urls = substr ($ temp, 14 );
}
}
$ Temp_array = explode (",", $ urls );
$ Temp = $ temp_array [1];
$ Temp = substr ($ temp, 8 );
$ Temp_array = explode ("/", $ temp );
@ Fclose ($ nexus_socket );
$ Ssl_conn = fsockopen ("ssl: //". $ temp_array [0], 443 );
Fputs ($ ssl_conn, "GET/{$ temp_array [1]} HTTP/1.1/r \ n ");
Fputs ($ ssl_conn, "Authorization: Passport1.4 OrgVerb = GET, OrgURL = http % 3A % 2F % 2 Fmessenger % 2 Emsn % 2 Ecom, sign-in = ". urlencode ($ username ). ", pwd = $ password, $ TOKENSTRING \ r \ n ");
Fputs ($ ssl_conn, "User-Agent: MSMSGS \ r \ n ");
Fputs ($ ssl_conn, "Host: {$ temp_array [0]} \ r \ n ");
Fputs ($ ssl_conn, "Connection: Keep-Alive \ r \ n ");
Fputs ($ ssl_conn, "Cache-Control: no-cache \ r \ n ");
$ Temp = fgets ($ ssl_conn, 512 );
If (rtrim ($ temp) = "HTTP/1.1 302 Found "){
# Echo "redirection ";
Echo "start redirection
";
Flush ();
While ($ temp! = "\ R \ n "){
$ Temp = fgets ($ ssl_conn, 256 );
If (substr ($ temp, 0, 9) = "Location :"){
$ Temp_array = explode (":", $ temp );
$ Temp_array = explode ("/", trim (end ($ temp_array )));
Break;
}
}
@ Fclose ($ ssl_conn );
$ Ssl_conn = fsockopen ("ssl: //". $ temp_array [2], 443 );
Fputs ($ ssl_conn, "GET/{$ temp_array [3]} HTTP/1.1/r \ n ");
Fputs ($ ssl_conn, "Authorization: Passport1.4 OrgVerb = GET, OrgURL = http % 3A % 2F % 2 Fmessenger % 2 Emsn % 2 Ecom, sign-in = ". urlencode ($ username ). ", pwd = $ password, $ TOKENSTRING \ r \ n ");
Fputs ($ ssl_conn, "User-Agent: MSMSGS \ r \ n ");
Fputs ($ ssl_conn, "Host: {$ temp_array [2]} \ r \ n ");
Fputs ($ ssl_conn, "Connection: Keep-Alive \ r \ n ");
Fputs ($ ssl_conn, "Cache-Control: no-cache \ r \ n ");
} Elseif (rtrim ($ temp) = "HTTP/1.1 401 Unauthorized "){
# Echo "invalidcreds ";
Echo "verification failed!
";
@ Fclose ($ ssl_conn );
Die ();
} Else {
If (rtrim ($ temp )! = "HTTP/1.1 200 OK "){
# Echo "Unknown HTTP status code: $ temp
";
Echo "unknown status code $ temp
";
Flush ();
Die ();
} Else {
# Echo "set_bar_len30? ";
}
}
While ($ temp! = "\ R \ n "){
$ Temp = fgets ($ ssl_conn, 1024 );
If (substr ($ temp, 0,19) = "Authentication-Info "){
$ Auth_info = $ temp;
$ Temp = fgets ($ ssl_conn, 1024 );
If (substr ($ temp, 0, 14 )! = "Content-Length "){
$ Auth_info. = fgets ($ ssl_conn, 1024 );
}
Break;
}
}
@ Fclose ($ ssl_conn );
$ Temp_array = explode ("'", $ auth_info );
Flush ();
Data_out ("USR $ trid twn s {$ temp_array [1]}");
Flush ();
$ Temp = data_in ();
Flush ();
$ Time_since_initmsg = time ();
While (! Strstr ($ temp, "ABCHMigrated") & is_string (trim ($ temp ))){
If (substr ($ temp, 0, 3) = "sid "){
$ Sid = trim (substr ($ temp, 5 ));
}
If (substr ($ temp, 0, 2) = "kv "){
$ Kv = trim (substr ($ temp, 4 ));
}
If (substr ($ temp, 0,7) = "MSPAuth "){
$ Mspauth = trim (substr ($ temp, 9 ));
Flush ();
}
$ Temp = data_in ();
}
$ Temp = data_in ();
# Echo "authenticated
";
Echo "verified!
";
Flush ();
# Data_out ("LST 9 RL ");
# Data_in ();
Data_out ("SYN $ trid 0 0 ");
# Echo "retreiving_contact_list
";
Echo "retrieving friends list ......
";
Flush ();
Stream_set_timeout ($ sbconn, 0,125000 );
/* A lazy man doing this: D */
For ($ I = 0; $ I <160; $ I ++) # some say max is 150
{
$ Temp = data_in ();
Switch (substr ($ temp, 0, 3 ))
{
Case "LST ":
$ Temp_array = explode ("", $ temp );
$ Un = substr ($ temp_array [1], 2 );
$ Nn = substr ($ temp_array [2], 2 );
$ Nn1 = substr ($ temp_array [2], 0, 1 );
If ($ nn1 = "F ")
{
Echo "$ nn
Mailto: $ un \ "> $ nn
";
}
Else
{
Echo "Friends: $ un
";
}
# Echo $ temp ."
";
Break;
Default:
# No nothing
Break;
}
}
Echo "end of list ";
@ Fclose ($ sbconn );
# End here
# Functions
Function data_out ($ data ){
Global $ sbconn, $ debug, $ trid;
Fputs ($ sbconn, $ data. "\ r \ n ");
$ Trid ++;
If ($ debug &&! Empty ($ data) {echo ">". $ data ."
\ R \ n ";}
}
Function data_in (){
Global $ sbconn, $ debug;
$ Temp = fgets ($ sbconn, 256 );
If ($ debug &&! Empty ($ temp) {echo "<". $ temp ."
\ R \ n ";}
Return $ temp;
}
?>