vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies
vb6 INET Cookies vb6 INET Cookies
vb6 INET Cookies
Go Back  Xtreme Visual Basic Talk > > > vb6 INET Cookies


Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2013, 12:25 PM
ravi_elite ravi_elite is offline
Newcomer
 
Join Date: Sep 2013
Posts: 3
Question vb6 INET Cookies


Hello all,

I hope someone can help me with this problem
I have created (3) Inet Connections

first connection does a GET to login.live.com
grabs a cookie
then the second Inet Connection Posts that cookie and logs into login.live.com via SSL and grabs a token

then the third Inet Connection goes to a different website and Posts the token
to grab additional cookies i need for something else


it all works


the problem is the next time that i do it again... it has allready logged me into login.live.com and just sends me the token to go straight to the other website... I dont want to do that...

i believe that the cookies are being saved.. i have cleared Temporary internet files and ...well...NOTHING

I have tried sending a cookie header that rewrites over the previous cookies ..nothing...


anyway here is the entire code

I have removed my real email and password
Code:
Sub ConnectUpdater()
Dim strURL As String      ' URL string
Dim intFile As Integer   ' FreeFile variable
intFile = FreeFile()
fConnection.Inet2.Protocol = icHTTP
strURL = "http://login.live.com"
Dim GetString As String
GetString = " "
fConnection.Inet2.URL = "http://login.live.com"
fConnection.Inet2.Execute strURL + "/wlogin.srf?appid=000000004C04B301&alg=wsignin1.0", "GET", GetString, "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Host:login.live.com" & vbCrLf & "User-Agent: root" & vbCrLf & "Cookie: MUID=DFD2582018CB460B91F4707517868FF8" & vbCrLf
While fConnection.Inet2.StillExecuting
   DoEvents
Wend
returnstr = fConnection.Inet2.GetChunk(2048, icString)
Dim Cookie1 As String
Cookie1 = fConnection.Inet2.GetHeader()
Cookie1 = Split(Cookie1, vbCrLf)(10)
Cookie1 = Split(Cookie1, "=")(1)
Cookie1 = Split(Cookie1, ";")(0)
 Dim len2value As Integer
 Dim len2end As Integer
 Dim Cookie2 As String
 Dim stoken As String
Do While Len(returnstr) <> 0
   If InStr(1, returnstr, "PPFT") > 0 Then
   len2value = InStr(1, returnstr, "PPFT")
   Cookie2 = (Mid(returnstr, len2value))
   Cookie2 = Split(Cookie2, "=")(2)
   Cookie2 = Split(Cookie2, Chr(34))(1)
   ElseIf InStr(1, returnstr, "stoken") > 0 Then
   len2value = InStr(1, returnstr, "stoken")
   stoken = (Mid(returnstr, len2value))
   stoken = Split(stoken, "=")(2)
   stoken = Split(stoken, Chr(34))(1)
   End If
   'RichTextBox2.SelStart = Len(RichTextBox2.Text)
   'RichTextBox2.SelText = RichTextBox2.SelText & returnstr
   'RichTextBox2.SelStart = Len(RichTextBox2.Text)
    returnstr = fConnection.Inet2.GetChunk(2048, icString)
Loop
If Cookie2 = "" Then
  If stoken <> "" Then
 stoken = Replace(Replace(stoken, Chr(37) & "2", Chr(37) & "252"), Chr(37) & "3D", Chr(37) & "253D")
 ConnectToIRC7s stoken
 End If
 ElseIf Cookie2 <> "" Then
 ConnectToSSL1 Cookie1, Cookie2
  End If
End Sub
Sub ConnectToSSL1(Cookie1 As String, Cookie2 As String)
 'MsgBox Cookie1
 'MsgBox Cookie2
Dim strURL As String      ' URL string
Dim intFile As Integer   ' FreeFile variable
fConnection.Inet1.AccessType = icUseDefault
fConnection.Inet1.Protocol = icHTTPS
intFile = FreeFile()
strURL = "https://login.live.com"
strURL = strURL & "/ppsecure/post.srf?appid=000000004C04B301&alg=wsignin1.0&bk=" & UnixTime
Dim PostData As String
Dim sData As String
Dim sLen As Integer
sData = "login=ez%40live.com&passwd=boot&SI=Sign+in&PPFT=" & Cookie2
sLen = Len(sData)
'PostData = "/ppsecure/post.srf?appid=000000004C04B301&alg=wsignin1.0&bk=" & UnixTime & " HTTP/1.1" & _
'vbCrLf & "HOST: login.live.com" & vbCrLf & "Content-Length: " & sLen & vbCrLf & "User-Agent: Root" & vbCrLf & "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Cookie: MSPOK=" & Cookie1 & vbCrLf & vbCrLf & sData
PostData = sData
'MsgBox sData
fConnection.Inet1.Execute strURL, "POST", PostData, "Host: login.live.com" & vbCrLf & "User-Agent: Root" & vbCrLf & "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Cookie: MSPOK=" & Cookie1
While fConnection.Inet1.StillExecuting
   DoEvents
Wend
'MsgBox Inet1.GetHeader()
 Dim len2value As Integer
 Dim len2end As Integer
 Dim stoken As String
 
returnstr = fConnection.Inet1.GetChunk(2048, icString)
'Dim oldStr As String
Do While Len(returnstr) <> 0
  MsgBox returnstr
   'Text1.Text = ReturnStr
   'RichTextBox1.SelStart = Len(RichTextBox1.Text)
   'RichTextBox1.SelText = RichTextBox1.SelText & returnstr
   'RichTextBox1.SelStart = Len(RichTextBox1.Text)
   'oldStr = RichTextBox1.SelText
   'RichTextBox1.Text = oldStr & returnStr
    returnstr = fConnection.Inet1.GetChunk(2048, icString)
Loop
  If stoken <> "" Then
 stoken = Replace(Replace(stoken, Chr(37) & "2", Chr(37) & "252"), Chr(37) & "3D", Chr(37) & "253D")
 ConnectToIRC7s stoken
 End If
End Sub

Sub ConnectToIRC7s(stoken As String)
 'MsgBox Cookie1
 'MsgBox Cookie2
Dim strURL As String      ' URL string
Dim intFile As Integer   ' FreeFile variable
fConnection.Inet3.AccessType = icUseDefault
fConnection.Inet3.Protocol = icHTTP
intFile = FreeFile()
strURL = "http://irc7.com"
strURL = strURL & "/webauth-handler.aspx"
Dim PostData As String
Dim sData As String
Dim sLen As Integer
sData = "stoken=" & stoken & "&action=login"
sLen = Len(sData)
'PostData = "/ppsecure/post.srf?appid=000000004C04B301&alg=wsignin1.0&bk=" & UnixTime & " HTTP/1.1" & _
'vbCrLf & "HOST: login.live.com" & vbCrLf & "Content-Length: " & sLen & vbCrLf & "User-Agent: Root" & vbCrLf & "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Cookie: MSPOK=" & Cookie1 & vbCrLf & vbCrLf & sData
PostData = sData
'MsgBox sData
fConnection.Inet3.Execute strURL, "POST", PostData, "Host: irc7.com" & vbCrLf & "Content-Length: " & sLen & vbCrLf & "User-Agent: Root" & vbCrLf & "Connection: Keep-Alive" & vbCrLf & "Content-Type: application/x-www-form-urlencoded" & vbCrLf & vbCrLf
While fConnection.Inet3.StillExecuting
   DoEvents
Wend
'MsgBox Inet1.GetHeader()
returnstr = fConnection.Inet3.GetChunk(2048, icString)
'Dim oldStr As String
Dim len2value As Integer
 Dim len2end As Integer
 Dim Gkp As String
 Dim Profile As String
 Dim Ticket As String
 Dim MSNRegCookie As String
Do While Len(returnstr) <> 0
If InStr(1, returnstr, "MSRegCookie") > 0 Then
   len2value = InStr(1, returnstr, "MSRegCookie")
   MSNRegCookie = (Mid(returnstr, len2value))
   MSNRegCookie = Split(MSNRegCookie, "=")(1)
   MSNRegCookie = Split(MSNRegCookie, "<br />")(0)
   MsgBox "MSNRegCookie: " & MSNRegCookie
   'MsgBox Cookie2
   End If
   If InStr(1, returnstr, "GateKeeperPassport") > 0 Then
   'MsgBox "here!"
   len2value = InStr(1, returnstr, "GateKeeperPassport")
   Gkp = (Mid(returnstr, len2value))
   Gkp = Split(Gkp, "=")(1)
   Gkp = Split(Gkp, "<br />")(0)
   MsgBox "GateKeeperPassport: " & Gkp & "@GateKeeperPassport"
   'MsgBox stoken
   End If
   If InStr(1, returnstr, "MSPAuth") > 0 Then
   'MsgBox "here!"
   len2value = InStr(1, returnstr, "MSPAuth")
   Ticket = (Mid(returnstr, len2value))
   Ticket = Split(Ticket, "=")(1)
   Ticket = Split(Ticket, "<br />")(0)
   MsgBox "Ticket: " & Ticket
   'MsgBox stoken
   End If
    If InStr(1, returnstr, "MSPProf") > 0 Then
   'MsgBox "here!"
   len2value = InStr(1, returnstr, "MSPProf")
   Profile = (Mid(returnstr, len2value))
   Profile = Split(Profile, "=")(1)
   Profile = Split(Profile, "<br />")(0)
   MsgBox "Profile: " & Profile
   'MsgBox stoken
   End If
 'MsgBox returnstr
   'Text1.Text = ReturnStr
   'RichTextBox3.SelStart = Len(RichTextBox3.Text)
   'RichTextBox3.SelText = RichTextBox3.SelText & returnstr
   'RichTextBox3.SelStart = Len(RichTextBox3.Text)
   'oldStr = RichTextBox1.SelText
   'RichTextBox1.Text = oldStr & returnStr
    returnstr = fConnection.Inet3.GetChunk(2048, icString)
Loop
End Sub
Function UnixTime() As Variant
'The first parameter determines how the
' difference will be measured in i.e. "S" for seconds
UnixTime = DateDiff("S", "1/1/1970", Now())
End Function
Reply With Quote
  #2  
Old 09-17-2013, 04:06 PM
ravi_elite ravi_elite is offline
Newcomer
 
Join Date: Sep 2013
Posts: 3
Default

nobody can help me with this?

not enough info?
Reply With Quote
  #3  
Old 09-17-2013, 05:30 PM
ravi_elite ravi_elite is offline
Newcomer
 
Join Date: Sep 2013
Posts: 3
Thumbs up

sorry guys i fixed it..all i had to do was go to the logout page
on login.live.com first..

thanks anyway
Reply With Quote
Reply

Tags
cookies, inet, internet transfer control, vb6


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies vb6 INET Cookies
vb6 INET Cookies
vb6 INET Cookies
 
vb6 INET Cookies
vb6 INET Cookies
 
-->