Advertisement
Guest User

Untitled

a guest
Jul 14th, 2017
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.91 KB | None | 0 0
  1. Imports System.Net
  2. Imports System.IO
  3. Imports System.Text
  4. Public Class Form1
  5.     Function login()
  6.         Dim user$
  7.         Dim pass$
  8.         user = TextBox1.Text
  9.         pass = TextBox2.Text
  10.         Dim postData As String = "username=" + user + "&password=" + pass
  11.         Dim reQ As HttpWebRequest = DirectCast(WebRequest.Create("https://www.instagram.com/accounts/login/ajax/"), HttpWebRequest)
  12.         reQ.Method = "POST"
  13.         reQ.UserAgent = "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
  14.         reQ.Headers.Add("x-csrftoken", "hWKHz7v5O4m7FnpYPpOL6uLdTgsUnrhN")
  15.         reQ.Headers.Add("x-instagram-ajax", "1")
  16.         reQ.ContentType = "application/x-www-form-urlencoded"
  17.         reQ.Headers.Add("x-requested-with", "XMLHttpRequest")
  18.         reQ.Headers.Add("cookie", "mid=WWi8YwALAAFHlq4KsNJtVccVu2K5; ig_vw=1366; ig_pr=1; rur=FRC; csrftoken=hWKHz7v5O4m7FnpYPpOL6uLdTgsUnrhN")
  19.         reQ.Referer = "https://www.instagram.com/"
  20.         reQ.KeepAlive = True
  21.         Dim bytes As Byte() = Encoding.UTF8.GetBytes(postData)
  22.         reQ.ContentLength = bytes.Length
  23.         Dim reQS As Stream = reQ.GetRequestStream
  24.         reQS.Write(bytes, 0, bytes.Length)
  25.         reQS.Close()
  26.         Dim res As HttpWebResponse
  27.         res = DirectCast(reQ.GetResponse(), HttpWebResponse)
  28.         Dim Reader As New StreamReader(res.GetResponseStream)
  29.         Dim page As String = Reader.ReadToEnd
  30.         If page.Contains("false") Then
  31.             WebBrowser1.DocumentText = page
  32.             MsgBox("Failed Login : " + user)
  33.         Else
  34.             WebBrowser1.DocumentText = page
  35.             MsgBox("Successfully Login : " + user)
  36.         End If
  37.         'كذا يكون خلصنا الفنكشن ! نجربه
  38.     End Function
  39.  
  40.  
  41.  
  42.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  43.         login()
  44.     End Sub
  45. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement