1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The login button on google.com!

Discussion in 'Visual Basic .NET' started by trolol, Jan 5, 2012.

  1. trolol

    trolol Newbie

    Joined:
    Jun 24, 2011
    Messages:
    38
    Likes Received:
    5
    Location:
    Somewhere where the chocolate is the best!:)
    Hey broskis, I'm getting into webbrowser, I know it's noob, I know:)

    But whenever my 'bot' clicks the login button it seems that it just 'highlights' the button, anyone? :)

    Thanks!:)

    EDIT:

    So I've been trying that httpwebrequest thing now; and I came to this. Obviously the Email and Passwd are incorrect, but if I use my own account, why do I get that I ain't got any cookies? :) Help me?

    Code:
    Dim postData As String = "continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3D2&service=mail&rm=false&dsh=-4208908587536675652&ltmpl=default&ltmpl=default&scc=1&ss=1&GALX=4roZEZWMMQc&pstMsg=1&dnConn=https%3A%2F%2Faccounts.youtube.com&checkConnection=&checkedDomains=&timeStmp=&secTok=&Email=BHW&Passwd=lolol&signIn=Aanmelden&PersistentCookie=yes&rmShown=1"
    
            Dim tempCookies As New CookieContainer
            Dim encoding As New UTF8Encoding
            Dim byteData As Byte() = encoding.GetBytes(postData)
    
            Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https:SLASHSLASHaccountsDOTgoogleDOTcomSLASHServiceLoginAuth"), HttpWebRequest)
            postReq.Method = "POST"
            postReq.KeepAlive = True
            postReq.CookieContainer = tempCookies
            postReq.ContentType = "application/x-www-form-urlencoded"
            postReq.Referer = "https:SLASHSLASHaccountsDOTgoogleDOTcomSLASHServiceLoginAuth"
            postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
            postReq.ContentLength = byteData.Length
    
            Dim postreqstream As Stream = postReq.GetRequestStream()
            postreqstream.Write(byteData, 0, byteData.Length)
            postreqstream.Close()
            Dim postresponse As HttpWebResponse
    
            postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
            tempCookies.Add(postresponse.Cookies)
            logincookie = tempCookies
            Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
    
            Dim thepage As String = postreqreader.ReadToEnd
    
            WebBrowser1.DocumentText = thepage
    Had to be creative on the 'https:SLASHSLASHaccountsDOTgoogleDOTcomSLASHServiceLoginAuth' part :p
     
    Last edited: Jan 5, 2012
  2. trolol

    trolol Newbie

    Joined:
    Jun 24, 2011
    Messages:
    38
    Likes Received:
    5
    Location:
    Somewhere where the chocolate is the best!:)
    Bump:)
     
  3. christoss1959

    christoss1959 Senior Member

    Joined:
    Nov 25, 2010
    Messages:
    894
    Likes Received:
    1,150
    Home Page:
  4. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,879
    Likes Received:
    1,932
    You can't login to Google this way, you must follow the exact process that Google follows of going to the login page, parsing the variables (dsh, GALX) and then POST the data, follow the CheckCookie page etc that Google sends you through.

    Use Charles / Fiddler2 / Live HTTP Headers plugin for firefox to follow the exact requests that are made and then make your application do the same.
     
  5. trolol

    trolol Newbie

    Joined:
    Jun 24, 2011
    Messages:
    38
    Likes Received:
    5
    Location:
    Somewhere where the chocolate is the best!:)
    I followed that:) But It doesn't store the cookie I think:)
     
  6. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,879
    Likes Received:
    1,932
    I take it that you are replacing the GALX & DSH keys with the scraped keys? Also after submitting the page Google uses a Javascript redirect that you must follow. Make sure you are using the same cookie container throughout each call also.
     
  7. iFreakGod

    iFreakGod Newbie

    Joined:
    Jan 21, 2012
    Messages:
    24
    Likes Received:
    18
    Why dont you just start your browser at the google login page. Or instead of clicking the login button try to write some code that finds the instance that occurs before you need to click login and just have the browser navigate to google login.


    For example!
    Code:
    Private sub timer1_tick(blahblahblah)
              If 'anything = 'anything Then
                        Webbrowser1.Navigate("www(dot)accounts(dot)google(dot)com/login")
                        Timer1.stop
              End If
    End Sub