Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.Text.RegularExpressions
- Imports System.Web
- Imports System.Web.Script.Serialization
- Public Class Form1
- Dim Cookies As String
- Dim tempCookies As String
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim stringPOSTData As String = "username=" & TextBox1.Text & "&enc_password=#PWD_INSTAGRAM_BROWSER:0:" & Get_time() & ":" & TextBox2.Text & "&queryParams={}&optIntoOneTap=false"
- Dim responString As String
- Using w As New WebClient
- w.Headers.Add("accept", "*/*")
- w.Headers.Add("content-type: application/x-www-form-urlencoded")
- w.Headers.Add("x-csrftoken", "missing")
- w.Headers.Add("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36")
- w.Headers.Add("x-instagram-ajax", "1")
- w.Headers.Add("x-requested-with: XMLHttpRequest")
- Try
- responString = w.UploadString("https://www.instagram.com/accounts/login/ajax/", "POST", Uri.EscapeUriString(stringPOSTData))
- 'MsgBox(responString)
- If w.ResponseHeaders("set-cookie").ToString.Contains("sessionid") Then
- ' Done login
- ' MsgBox("Done LOGIN")
- Dim resCookies As String = w.ResponseHeaders("set-cookie").ToString
- Cookies = Regex.Match(resCookies, "sessionid=(.*?);").Value & " " & Regex.Match(resCookies, "mid=(.*?);").Value & " " & Regex.Match(resCookies, "csrftoken=(.*?);").Value & " " & Regex.Match(resCookies, "ig_did=(.*?);").Value & " " & Regex.Match(resCookies, "rur=(.*?);").Value
- MsgBox(Cookies)
- Else
- ' Info Worng
- MsgBox("Error LOGIN")
- End If
- Catch ex As WebException
- Dim respon As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
- If respon.Contains("checkpoint_required") Then
- ' Error Secure!
- ' MsgBox("Secure!")
- Dim url_sce As String = Regex.Match(respon, "checkpoint_url"": ""(.*?)""").Groups(1).Value
- Dim resCookies As String = ex.Response.Headers("set-cookie")
- tempCookies = Regex.Match(resCookies, "mid=(.*?);").Value & " " & Regex.Match(resCookies, "csrftoken=(.*?);").Value & " " & Regex.Match(resCookies, "ig_did=(.*?);").Value & " " & Regex.Match(resCookies, "rur=(.*?);").Value
- Dim secureINFO As String = Get_Secure_info(url_sce, tempCookies)
- If Not IsNothing(secureINFO) Then
- Dim i_json As Object
- i_json = New JavaScriptSerializer().Deserialize(Of Object)(secureINFO)
- If i_json("challengeType") = "SelectVerificationMethodForm" Then
- 'MsgBox(New JavaScriptSerializer().Serialize(i_json("extraData")("content")(3)("fields")(0)("values")))
- Dim raidobtn As New List(Of Control)
- For Each item_ As Control In Form2.Controls
- If item_.Name.Contains("RadioButton") Then
- raidobtn.Add(item_)
- End If
- Next
- Dim index_loop As Integer
- For Each i_ As Object In i_json("extraData")("content")(3)("fields")(0)("values")
- raidobtn(index_loop).Text = i_("label")
- raidobtn(index_loop).Tag = i_("value")
- index_loop += 1
- Next
- Form2.url_path = url_sce
- Form2.Show()
- End If
- Else
- MsgBox("Error can't get info")
- End If
- Else
- ' Error Login
- MsgBox(respon)
- End If
- End Try
- End Using
- End Sub
- Function Get_Secure_info(url_path As String, responcookie As String)
- Dim stringRespon As String
- Using w As New WebClient
- w.Headers.Add("accept", "*/*")
- w.Headers.Add("content-type: application/x-www-form-urlencoded")
- w.Headers.Add("cookie", responcookie)
- w.Headers.Add("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36")
- Try
- stringRespon = w.DownloadString("https://i.instagram.com" & url_path & "?__a=1")
- Return stringRespon
- Catch ex As Exception
- End Try
- Return Nothing
- End Using
- End Function
- Function Send_code(url_path As String, valueIs As String) As Boolean
- Dim stringRespon As String
- Using w As New WebClient
- w.Headers.Add("accept", "*/*")
- w.Headers.Add("content-type: application/x-www-form-urlencoded")
- w.Headers.Add("x-csrftoken", "missing")
- w.Headers.Add("user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36")
- w.Headers.Add("x-instagram-ajax", "1")
- w.Headers.Add("x-requested-with: XMLHttpRequest")
- w.Headers.Add("cookie", tempCookies)
- Try
- stringRespon = w.UploadString("https://i.instagram.com" & url_path, "POST", "choice=" & valueIs)
- Return stringRespon.Contains("""status"": ""ok""")
- Catch ex As Exception
- End Try
- Return False
- End Using
- End Function
- Function Get_time() As String
- Return CLng(DateTime.UtcNow.Subtract(New DateTime(1970, 1, 1)).TotalMilliseconds)
- End Function
- End Class
Add Comment
Please, Sign In to add comment