Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. Public Function login_acc(username As String, password As String, cc As CookieContainer, Optional proxy As String = "") As String
  2. Try
  3. Dim login_page_source As String = page_source("http://www.pornhub.com/login", proxy, cc)
  4. Dim m1 As Match = Regex.Match(login_page_source, "<input type=""hidden"" class=""js-redirect"" name=""redirect"" value="".*"" />")
  5. Dim m2 As Match = Regex.Match(login_page_source, "<input type=""hidden"" name=""login_key"" id=""login_key"" value="".*"" />")
  6. Dim m3 As Match = Regex.Match(login_page_source, "<input type=""hidden"" name=""login_hash"" id=""login_hash"" value="".*"" />")
  7. Dim sp() As String
  8. Dim redirect_v As String
  9. Dim login_key_v As String
  10. Dim login_hash_v As String
  11. sp = m1.Value.Split("""")
  12. redirect_v = sp(7)
  13. sp = m2.Value.Split("""")
  14. login_key_v = sp(7)
  15. sp = m3.Value.Split("""")
  16. login_hash_v = sp(7)
  17.  
  18. Dim login_data As String = "loginPage=1&redirectTo=&redirect=" & redirect_v & "&login_key=" & login_key_v & "&login_hash=" & login_hash_v & "&username=" & username & "&password=" & password
  19. Dim login_req As String = API_Request("http://www.pornhub.com/front/login_json", login_data, proxy, cc)
  20.  
  21. If login_req.Contains("{""success"":1") Then
  22. Return "S"
  23. Else
  24. Return "E"
  25. End If
  26. Catch ex As Exception
  27. Return "E"
  28. End Try
  29. End Function
  30.  
  31.  
  32. Private Function API_Request(url As String, postData As String, proxy As String, CC As CookieContainer) As String
  33. Try
  34. Dim request As Net.HttpWebRequest = Net.HttpWebRequest.Create(url)
  35. Dim cd As New System.Net.Mime.ContentDisposition
  36. cd.FileName = "â€ĒC:\Users\Flabi\Desktop\baby hot.mp4"
  37.  
  38. With request
  39. .Timeout = 8000
  40. .ContentType = "application/x-www-form-urlencoded"
  41. .Method = "POST"
  42. .ContentLength = postData.Length
  43. .CookieContainer = CC
  44. .ServicePoint.Expect100Continue = False
  45. .UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
  46. .KeepAlive = False
  47. .UnsafeAuthenticatedConnectionSharing = False
  48. End With
  49. If proxy.Length > 1 Then
  50. Dim myProxy As New Net.WebProxy(proxy)
  51. request.Proxy = myProxy
  52. End If
  53. Dim requestStream As Stream = request.GetRequestStream()
  54. Dim postBytes As Byte() = Encoding.ASCII.GetBytes(postData)
  55. requestStream.Write(postBytes, 0, postBytes.Length)
  56. requestStream.Close()
  57. Dim response As HttpWebResponse = request.GetResponse()
  58. Dim server_response As String
  59. Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
  60. server_response = reader.ReadToEnd()
  61. reader.Dispose()
  62. requestStream.Dispose()
  63. response.Dispose()
  64. Return server_response
  65. Catch ex As Exception
  66. Return "error"
  67. End Try
  68. End Function
  69.  
  70. Private Function page_source(ByVal URL As String, proxy As String, CC As CookieContainer) As String
  71. Try
  72. Dim req As Net.HttpWebRequest = Net.HttpWebRequest.Create(URL)
  73. With req
  74. .CookieContainer = CC
  75. .Timeout = 8000
  76. .UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
  77. End With
  78. If proxy.Length > 1 Then
  79. Dim myProxy As New Net.WebProxy(proxy)
  80. req.Proxy = myProxy
  81. End If
  82. Dim res As Net.HttpWebResponse = req.GetResponse()
  83. Dim strm As New IO.StreamReader(res.GetResponseStream())
  84. Dim html As String = strm.ReadToEnd()
  85. strm.Dispose()
  86. res.Dispose()
  87. Return html
  88. Catch ex As Exception
  89. Return "error"
  90. End Try
  91. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement