Results 1 to 11 of 11

Thread: vb expert help needed

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    vb expert help needed

    I'm not sure what to send to the server, but I want to somehow log into

    http://www.sparkpea.net/signin.php

    using winsock.

    So, opening a socket on www.sparkpea.net - port 80, sending the necessary POST headers.

    but im not sure how to login by sockets using my email/password for that site/or what headers to send etc. I hope someones vb expertise can help me out as im desperate to get this working!

    Thanks in advance guys!

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: vb expert help needed

    Use a packet sniffer to look at the HTTP POST data when signing into the website. I use Ethereal since it's free and it's good.

    Then just connect to the server and send the data. The POST data should follow the HTTP header.

    Then you'll need to parse the response on the Winsock_DataArrival() event.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: vb expert help needed

    Thanks Digi, I packet sniffed it.

    I did the necessary response but it still does not login.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: vb expert help needed

    Quote Originally Posted by Pouncer
    Thanks Digi, I packet sniffed it.

    I did the necessary response but it still does not login.
    Does it do anything?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: vb expert help needed

    Hi Hack, thank you fr posting. I hope you can help me.

    Code:
    Private Sub Form_Load()
        winsock.Connect "www.sparkpea.net", 80
    End Sub
    
    Private Sub winsock_Connect()
        Dim content As String
        contet = "[email protected]&pass=mypass123&sublogin=1&submit=Sign+in"
        
        winsock.SendData "POST /signin.php HTTP/1.1" & vbCrLf & _
        "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*" & vbCrLf & _
        "Referer: http://www.sparkpea.net/signin.php" & vbCrLf & _
        "Accept-Language: en-us" & vbCrLf & _
        "Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
        "Accept-Encoding: gzip, deflate" & vbCrLf & _
        "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" & vbCrLf & _
        "Host: www.sparkpea.net" & vbCrLf & _
        "Content-Length: " & Len(content) & vbCrLf & _
        "Connection: Keep-Alive" & vbCrLf & _
        "Cache-Control: no-cache" & vbCrLf & _
        "Cookie: PHPSESSID=" & vbCrLf & vbCrLf & content & vbCrLf & vbCrLf
    End Sub
    
    Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
        Dim str As String
        
        winsock.GetData (str)
        
        Debug.Print str
    End Sub
    Its not printing anything. I packet sniffed it, and put the right headers in to try and login from the signin.php, but please, anything im doing wrong?
    Last edited by Pouncer; Mar 9th, 2007 at 10:20 AM.

  6. #6
    Addicted Member
    Join Date
    Oct 2006
    Location
    In the midst of corn, cotton, and beans
    Posts
    185

    Re: vb expert help needed

    I'm not sure if a type error or not but

    you Dimmed 'content'
    and the next line set 'contet' = to "........."

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: vb expert help needed

    Quote Originally Posted by re_turner_jr
    I'm not sure if a type error or not but

    you Dimmed 'content'
    and the next line set 'contet' = to "........."
    ty, changed it, still makes no difference.

    it doesnt print anything or log me in :'(

  8. #8
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: vb expert help needed

    Put Option Explicit at the very top of your code. Then tell us if you get an error or not.

    Edit: Also, debug the Winsock_Error() event, ie:

    Code:
    Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
        Debug.Print Description
    End Sub

  9. #9
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Also...

    Also, you may want to leave out the PHPSESSID/cookie information in the header.

    Just supply the HTTP Header and post information that you have in "content"

    Also packet sniff again when using your program to make sure all of it is correct.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: vb expert help needed

    I am trying everything guys, it's not working at all for me. Could someone else please packet sniff to confirm i am doing it right?

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        winsock.Connect "www.sparkpea.net", 80
    End Sub
    
    Private Sub winsock_Connect()
        Dim content As String
        content = "[email protected]&pass=mypass123&sublogin=1&submit=Sign+in"
        
        winsock.SendData "POST /signin.php HTTP/1.1" & vbCrLf & _
        "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*" & vbCrLf & _
        "Referer: http://www.sparkpea.net/signin.php" & vbCrLf & _
        "Accept-Language: en-us" & vbCrLf & _
        "Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
        "Accept-Encoding: gzip, deflate" & vbCrLf & _
        "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" & vbCrLf & _
        "Host: www.sparkpea.net" & vbCrLf & _
        "Content-Length: " & Len(content) & vbCrLf & _
        "Connection: Keep-Alive" & vbCrLf & _
        "Cache-Control: no-cache" & vbCrLf & _
        "Cookie: & vbCrLf & vbCrLf & content & vbCrLf & vbCrLf"
    End Sub
    
    Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
        Dim str As String
        
        winsock.GetData (str)
        
        Debug.Print str
    End Sub
    
    Private Sub winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
        Debug.Print Description
    End Sub
    it just does nothing

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: vb expert help needed

    is this not possible then guys?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width