Im trying to follow the MSNP15 Protocol to connect to MSN Messenger and programatically retrieve my contact list, but im getting stucked in the part where i need to make a SSL connection and send the XML identification.
Help?
Here is the pages i am using as reference:
http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO (English)
http://www.enye-sec.org/pepelux/?p=11 (Spanish, very messy)
I will appreciate any guidance on this or pointers to online examples, as well as open source examples.
Thanx!!
Help?
Here is the pages i am using as reference:
http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO (English)
http://www.enye-sec.org/pepelux/?p=11 (Spanish, very messy)
I will appreciate any guidance on this or pointers to online examples, as well as open source examples.
Thanx!!

Code:
#COMPILE EXE #DIM ALL $EmailAddress = "[email protected]" $Password = "examplepassword" '================================================================= FUNCTION WriteMsnPort(FF AS LONG, TCPLine AS STRING, OPT AsIs AS LONG) AS STRING STATIC CurTran AS LONG LOCAL Index AS LONG LOCAL Buffer AS STRING LOCAL Answer AS STRING ERRCLEAR IF INSTR(TCPLine, "%TRN") THEN INCR CurTran REPLACE "%TRN" WITH FORMAT$(CurTran) IN TCPLine END IF IF ISTRUE(VARPTR(AsIs)) THEN IF AsIs THEN 'MSGBOX ">>" & TCPLine TCP SEND #FF, TCPLine & $CRLF ELSE GOTO ByParts END IF ELSE ByParts: TcpLine = TcpLine & $CRLF FOR Index = 1 TO PARSECOUNT(Tcpline, $CRLF) IF ISTRUE(LEN(PARSE$(TCPLine, $CRLF, Index))) THEN 'msgbox ">>" & PARSE$(TCPLine, $CRLF, Index) & $CRLF TCP PRINT #FF, PARSE$(TCPLine, $CRLF, Index) END IF NEXT Index END IF Keepreading: TCP LINE #FF, Buffer Answer = (Answer & Buffer) & $CRLF IF EOF(FF) THEN GOTO ReceiveDone GOTO KeepReading ReceiveDone: 'MSGBOX "<<" & Answer FUNCTION = Answer END FUNCTION '================================================================= FUNCTION XMLSkeleton AS STRING FUNCTION = _ "<Envelope xmlns=""http://schemas.xmlsoap.org/soap/envelope/""" & $CRLF & _ " xmlns:wsse=""http://schemas.xmlsoap.org/ws/2003/06/secext""" & $CRLF & _ " xmlns:saml=""urn:oasis:names:tc:SAML:1.0:assertion""" & $CRLF & _ " xmlns:wsp=""http://schemas.xmlsoap.org/ws/2002/12/policy""" & $CRLF & _ " xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd""" & $CRLF & _ " xmlns:wsa=""http://schemas.xmlsoap.org/ws/2004/03/addressing""" & $CRLF & _ " xmlns:wssc=""http://schemas.xmlsoap.org/ws/2004/04/sc""" & $CRLF & _ " xmlns:wst=""http://schemas.xmlsoap.org/ws/2004/04/trust"">" & $CRLF & _ " <Header>" & $CRLF & _ " <ps:AuthInfo" & $CRLF & _ " xmlns:ps=""http://schemas.microsoft.com/Passport/SoapServices/PPCRL""" & $CRLF & _ " Id=""PPAuthInfo"">" & $CRLF & _ " <ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" & $CRLF & _ " <ps:BinaryVersion>4</ps:BinaryVersion>" & $CRLF & _ " <ps:UIVersion>1</ps:UIVersion>" & $CRLF & _ " <ps:Cookies></ps:Cookies>" & $CRLF & _ " <ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>" & $CRLF & _ " </ps:AuthInfo>" & $CRLF & _ " <wsse:Security>" & $CRLF & _ " <wsse:UsernameToken Id=""user"">" & $CRLF & _ " <wsse:Username><<<MyEmailAddress>>></wsse:Username>" & $CRLF & _ " <wsse:Password><<<MyPassword>>></wsse:Password>" & $CRLF & _ " </wsse:UsernameToken>" & $CRLF & _ " </wsse:Security>" & $CRLF & _ " </Header>" & $CRLF & _ " <Body>" & $CRLF & _ " <ps:RequestMultipleSecurityTokens" & $CRLF & _ " xmlns:ps=""http://schemas.microsoft.com/Passport/SoapServices/PPCRL""" & $CRLF & _ " Id=""RSTS"">" & $CRLF & _ " <wst:RequestSecurityToken Id=""RST0"">" & $CRLF & _ " <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" & $CRLF & _ " <wsp:AppliesTo>" & $CRLF & _ " <wsa:EndpointReference>" & $CRLF & _ " <wsa:Address>http://Passport.NET/tb</wsa:Address>" & $CRLF & _ " </wsa:EndpointReference>" & $CRLF & _ " </wsp:AppliesTo>" & $CRLF & _ " </wst:RequestSecurityToken>" & $CRLF & _ " <wst:RequestSecurityToken Id=""RSTn"">" & $CRLF & _ " <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" & $CRLF & _ " <wsp:AppliesTo>" & $CRLF & _ " <wsa:EndpointReference>" & $CRLF & _ " <wsa:Address>domain</wsa:Address>" & $CRLF & _ " </wsa:EndpointReference>" & $CRLF & _ " </wsp:AppliesTo>" & $CRLF & _ " <wsse:PolicyReference URI=""<<<MBI_KEY_OLD>>>""></wsse:PolicyReference>" & $CRLF & _ " </wst:RequestSecurityToken>" & $CRLF & _ " </ps:RequestMultipleSecurityTokens>" & $CRLF & _ " </Body>" & $CRLF & _ "</Envelope>" END FUNCTION '================================================================= FUNCTION PBMAIN () AS LONG LOCAL Hserver1 AS LONG LOCAL HServer2 AS LONG LOCAL FF1 AS LONG LOCAL FF2 AS LONG LOCAL NextServer AS STRING LOCAL Result AS STRING LOCAL XML AS STRING LOCAL Key AS STRING FF1 = FREEFILE ERRCLEAR TCP OPEN PORT 1863 AT "207.46.96.153" AS #FF1 Result = WriteMsnPort(FF1, "VER %TRN MSNP15 CVR0") Result = WriteMsnPort(FF1, "CVR %TRN 0x0C0A winnt 5.1 i686 MSNMSGR 8.1.0178 MSFT " & $EmailAddress ) NextServer = PARSE$(WriteMsnPort(FF1, "USR %TRN SSO I " & $EmailAddress), " ", 4) TCP CLOSE #FF1 ERRCLEAR FF1 = FREEFILE TCP OPEN PORT VAL(PARSE$(NextServer, ":", 2)) AT PARSE$(NextServer, ":", 1) AS #FF1 Result = WriteMsnPort(FF1, "VER %TRN MSNP15 CVR0") Result = WriteMsnPort(FF1, "CVR %TRN 0x0C0A winnt 5.1 i686 MSNMSGR 8.1.0178 MSFT " & $EmailAddress) Result = WriteMsnPort(FF1, "USR %TRN SSO I " & $EmailAddress) Key = TRIM$(MID$(Result, INSTR(-1, Result, " "), 256), ANY " " & $CRLF) XML = XMLSkeleton() REPLACE "<<<MyEmailAddress>>>" WITH $emailaddress IN XML REPLACE "<<<MyPassword>>>" WITH $Password IN XML REPLACE "<<<MBI_KEY_OLD>>>" WITH Key IN XML '=THIS IS THE PART IM HAVING PROBLEMS WITH===================== ERRCLEAR FF2 = FREEFILE 'TCP OPEN PORT 80 AT "https://login.live.com/RST.srf" AS #FF2 'How could i connect to this??? TCP OPEN PORT 80 AT "https://login.live.com" AS #FF2 MSGBOX STR$(ERR) Result = WriteMsnPort(FF2, XML, 1) MSGBOX Result '============================================================== TCP CLOSE #FF1 TCP CLOSE #FF2 END FUNCTION
Comment