Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. Imports System.Net
  2. Imports System.Text
  3. Imports System.IO
  4.  
  5. Public Class Form1
  6. Dim logincookie As CookieContainer
  7.  
  8. Private Sub SuppressScriptErrorsOnly(ByVal browser As WebBrowser)
  9.  
  10. ' Ensure that ScriptErrorsSuppressed is set to false.
  11. WebBrowser1.ScriptErrorsSuppressed = True
  12.  
  13. ' Handle DocumentCompleted to gain access to the Document object.
  14. AddHandler WebBrowser1.DocumentCompleted, _
  15. AddressOf WebBrowser1_DocumentCompleted
  16.  
  17. End Sub
  18.  
  19. Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, _
  20. ByVal e As WebBrowserDocumentCompletedEventArgs)
  21.  
  22. AddHandler CType(sender, WebBrowser).Document.Window.Error, _
  23. AddressOf Window_Error
  24.  
  25. End Sub
  26.  
  27. Private Sub Window_Error(ByVal sender As Object, _
  28. ByVal e As HtmlElementErrorEventArgs)
  29.  
  30. ' Ignore the error and suppress the error dialog box.
  31. e.Handled = True
  32.  
  33. End Sub
  34. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  35. On Error Resume Next
  36.  
  37. Dim postData As String = "username=" & txtUser.Text & "&password=" & txtPass.Text & "&remember=false&origin=NewLogin"
  38. Dim tempCookies As New CookieContainer
  39. Dim encoding As New UTF8Encoding
  40. Dim byteData As Byte() = encoding.GetBytes(postData)
  41.  
  42. Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://www.datehookup.com/login"), HttpWebRequest)
  43. If chkProxy.Checked = True Then
  44. Dim prxy As New WebProxy(cmbProxy.Text)
  45.  
  46. 'Specify that the HttpWebRequest should use the proxy server
  47. postReq.Proxy = prxy
  48. End If
  49. postReq.Method = "POST"
  50. postReq.KeepAlive = True
  51. postReq.CookieContainer = tempCookies
  52. postReq.ContentType = "application/x-www-form-urlencoded"
  53. postReq.Referer = "www.datehookup.com"
  54. 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)"
  55. postReq.ContentLength = byteData.Length
  56.  
  57. Dim postreqstream As Stream = postReq.GetRequestStream()
  58. postreqstream.Write(byteData, 0, byteData.Length)
  59. postreqstream.Close()
  60. Dim postresponse As HttpWebResponse
  61.  
  62. postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
  63. tempCookies.Add(postresponse.Cookies)
  64. logincookie = tempCookies
  65. Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
  66.  
  67. Dim thepage As String = postreqreader.ReadToEnd
  68.  
  69. RichTextBox1.Text = thepage
  70.  
  71. If InStr(thepage, "No messages yet.") <> 0 Then
  72. lblStatus.Text = "Connected to DateHookUp"
  73. End If
  74.  
  75. If InStr(thepage, "Password Reset Required") <> 0 Then
  76. lblStatus.Text = "Reset Your Password"
  77. End If
  78.  
  79. 'Unrecognized username or password
  80. If InStr(thepage, "Unrecognized username or password") <> 0 Then
  81. lblStatus.Text = "Unrecognized username or password"
  82. End If
  83.  
  84. If InStr(thepage, "AuthToken = '") <> 0 Then
  85.  
  86. txtAuth.Text = Split(Split(thepage, "AuthToken = '")(1), "'")(0)
  87.  
  88. End If
  89.  
  90.  
  91. End Sub
  92.  
  93. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  94.  
  95. End Sub
  96.  
  97. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  98. On Error Resume Next
  99. Call SuppressScriptErrorsOnly(WebBrowser1)
  100. WebBrowser1.DocumentText = RichTextBox1.Text
  101. End Sub
  102.  
  103. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  104. On Error Resume Next
  105.  
  106. If txtPost.Text = vbNullString Then
  107. MsgBox("You must enter a Message to Post")
  108. Exit Sub
  109. End If
  110.  
  111. Dim postData As String = "text=" & txtPost.Text
  112. Dim tempCookies As New CookieContainer
  113. Dim encoding As New UTF8Encoding
  114. Dim byteData As Byte() = encoding.GetBytes(postData)
  115.  
  116. Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.datehookup.com/api/statusupdate"), HttpWebRequest)
  117. If chkProxy.Checked = True Then
  118. Dim prxy As New WebProxy(cmbProxy.Text)
  119.  
  120. 'Specify that the HttpWebRequest should use the proxy server
  121. postReq.Proxy = prxy
  122. End If
  123.  
  124.  
  125. postReq.Method = "POST"
  126. postReq.KeepAlive = True
  127. postReq.CookieContainer = tempCookies
  128. postReq.ContentType = "application/x-www-form-urlencoded"
  129. postReq.Referer = "Referer: http://www.datehookup.com/home"
  130. 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)"
  131. postReq.ContentLength = byteData.Length
  132. postReq.Headers.Add("AuthToken: " & txtAuth.Text)
  133.  
  134. Dim postreqstream As Stream = postReq.GetRequestStream()
  135. postreqstream.Write(byteData, 0, byteData.Length)
  136. postreqstream.Close()
  137. Dim postresponse As HttpWebResponse
  138.  
  139. postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
  140. tempCookies.Add(postresponse.Cookies)
  141. logincookie = tempCookies
  142. Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
  143.  
  144. Dim thepage As String = postreqreader.ReadToEnd
  145.  
  146. RichTextBox1.Text = thepage
  147. End Sub
  148.  
  149. Private Sub lblHome_Click(sender As Object, e As EventArgs)
  150.  
  151. End Sub
  152.  
  153. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  154. On Error Resume Next
  155.  
  156. Dim postData As String = ""
  157. Dim tempCookies As New CookieContainer
  158. Dim encoding As New UTF8Encoding
  159. Dim byteData As Byte() = encoding.GetBytes(postData)
  160.  
  161. Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.datehookup.com/?logout=1"), HttpWebRequest)
  162. If chkProxy.Checked = True Then
  163. Dim prxy As New WebProxy(cmbProxy.Text)
  164.  
  165. 'Specify that the HttpWebRequest should use the proxy server
  166. postReq.Proxy = prxy
  167. End If
  168. postReq.Method = "POST"
  169. postReq.KeepAlive = True
  170. postReq.CookieContainer = tempCookies
  171. postReq.ContentType = "application/x-www-form-urlencoded"
  172. postReq.Referer = "http://www.datehookup.com/profile/" & txtUser.Text
  173. 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)"
  174. postReq.ContentLength = byteData.Length
  175.  
  176. Dim postreqstream As Stream = postReq.GetRequestStream()
  177. postreqstream.Write(byteData, 0, byteData.Length)
  178. postreqstream.Close()
  179. Dim postresponse As HttpWebResponse
  180.  
  181. postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
  182. tempCookies.Add(postresponse.Cookies)
  183. logincookie = tempCookies
  184. Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
  185.  
  186. Dim thepage As String = postreqreader.ReadToEnd
  187.  
  188. RichTextBox1.Text = thepage
  189.  
  190. If InStr(thepage, "Join Now and Meet someone – It’s free") <> 0 Then
  191. lblStatus.Text = "Offline"
  192. End If
  193.  
  194. '
  195. End Sub
  196. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement