Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.Text
- Imports System.IO
- Public Class Form1
- Dim logincookie As CookieContainer
- Private Sub SuppressScriptErrorsOnly(ByVal browser As WebBrowser)
- ' Ensure that ScriptErrorsSuppressed is set to false.
- WebBrowser1.ScriptErrorsSuppressed = True
- ' Handle DocumentCompleted to gain access to the Document object.
- AddHandler WebBrowser1.DocumentCompleted, _
- AddressOf WebBrowser1_DocumentCompleted
- End Sub
- Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, _
- ByVal e As WebBrowserDocumentCompletedEventArgs)
- AddHandler CType(sender, WebBrowser).Document.Window.Error, _
- AddressOf Window_Error
- End Sub
- Private Sub Window_Error(ByVal sender As Object, _
- ByVal e As HtmlElementErrorEventArgs)
- ' Ignore the error and suppress the error dialog box.
- e.Handled = True
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- On Error Resume Next
- Dim postData As String = "username=" & txtUser.Text & "&password=" & txtPass.Text & "&remember=false&origin=NewLogin"
- 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://www.datehookup.com/login"), HttpWebRequest)
- If chkProxy.Checked = True Then
- Dim prxy As New WebProxy(cmbProxy.Text)
- 'Specify that the HttpWebRequest should use the proxy server
- postReq.Proxy = prxy
- End If
- postReq.Method = "POST"
- postReq.KeepAlive = True
- postReq.CookieContainer = tempCookies
- postReq.ContentType = "application/x-www-form-urlencoded"
- postReq.Referer = "www.datehookup.com"
- 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
- RichTextBox1.Text = thepage
- If InStr(thepage, "No messages yet.") <> 0 Then
- lblStatus.Text = "Connected to DateHookUp"
- End If
- If InStr(thepage, "Password Reset Required") <> 0 Then
- lblStatus.Text = "Reset Your Password"
- End If
- 'Unrecognized username or password
- If InStr(thepage, "Unrecognized username or password") <> 0 Then
- lblStatus.Text = "Unrecognized username or password"
- End If
- If InStr(thepage, "AuthToken = '") <> 0 Then
- txtAuth.Text = Split(Split(thepage, "AuthToken = '")(1), "'")(0)
- End If
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- On Error Resume Next
- Call SuppressScriptErrorsOnly(WebBrowser1)
- WebBrowser1.DocumentText = RichTextBox1.Text
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- On Error Resume Next
- If txtPost.Text = vbNullString Then
- MsgBox("You must enter a Message to Post")
- Exit Sub
- End If
- Dim postData As String = "text=" & txtPost.Text
- Dim tempCookies As New CookieContainer
- Dim encoding As New UTF8Encoding
- Dim byteData As Byte() = encoding.GetBytes(postData)
- Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.datehookup.com/api/statusupdate"), HttpWebRequest)
- If chkProxy.Checked = True Then
- Dim prxy As New WebProxy(cmbProxy.Text)
- 'Specify that the HttpWebRequest should use the proxy server
- postReq.Proxy = prxy
- End If
- postReq.Method = "POST"
- postReq.KeepAlive = True
- postReq.CookieContainer = tempCookies
- postReq.ContentType = "application/x-www-form-urlencoded"
- postReq.Referer = "Referer: http://www.datehookup.com/home"
- 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
- postReq.Headers.Add("AuthToken: " & txtAuth.Text)
- 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
- RichTextBox1.Text = thepage
- End Sub
- Private Sub lblHome_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- On Error Resume Next
- Dim postData As String = ""
- Dim tempCookies As New CookieContainer
- Dim encoding As New UTF8Encoding
- Dim byteData As Byte() = encoding.GetBytes(postData)
- Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.datehookup.com/?logout=1"), HttpWebRequest)
- If chkProxy.Checked = True Then
- Dim prxy As New WebProxy(cmbProxy.Text)
- 'Specify that the HttpWebRequest should use the proxy server
- postReq.Proxy = prxy
- End If
- postReq.Method = "POST"
- postReq.KeepAlive = True
- postReq.CookieContainer = tempCookies
- postReq.ContentType = "application/x-www-form-urlencoded"
- postReq.Referer = "http://www.datehookup.com/profile/" & txtUser.Text
- 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
- RichTextBox1.Text = thepage
- If InStr(thepage, "Join Now and Meet someone β Itβs free") <> 0 Then
- lblStatus.Text = "Offline"
- End If
- '
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement