Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text
- Imports System.Net.Sockets
- Imports System.Net.Security
- Imports System.Security.Authentication
- Imports System.Security.Cryptography.X509Certificates
- Public Class Form1
- Private Shared Function ValidateServerCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors__1 As SslPolicyErrors) As Boolean
- If sslPolicyErrors__1 = SslPolicyErrors.None Then
- Return True
- End If
- Return False
- End Function
- Public Shared Sub Main(ByVal args As String())
- Dim id As [String] = ""
- Dim pass As [String] = ""
- Dim csrftoken As [String] = ""
- Dim mid As [String] = ""
- Dim cooks As [String] = ""
- Dim request1 = "GET /" + " HTTP/1.1" & vbCr & vbLf + "Host: www.instagram.com" & vbCr & vbLf + vbCr & vbLf
- Console.WriteLine("Insta login via tcp client By [ZeR0]" & vbLf)
- While id = ""
- Console.WriteLine("Enter id or email and press enter")
- id = Console.ReadLine().ToString()
- End While
- Console.WriteLine("Id set to => " + id + vbLf)
- While pass = ""
- Console.WriteLine("Enter email password and press enter")
- pass = Console.ReadLine().ToString()
- End While
- Console.WriteLine("Pass set to => " + pass + vbLf & "Start login ..." & vbLf)
- Try
- Dim client As New TcpClient("52.20.205.154", 443)
- Dim sslStream As New SslStream(client.GetStream(), False, New RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate), Nothing)
- Try
- sslStream.AuthenticateAsClient("instagram.com")
- Catch e As AuthenticationException
- Console.WriteLine("Authentication failed with instagram.com" & vbLf & "press any key to exit ..")
- client.Close()
- Console.ReadKey()
- Return
- End Try
- '#Region "Get Cookies"
- Dim messsage As Byte() = Encoding.UTF8.GetBytes(request1)
- sslStream.Write(messsage)
- sslStream.Flush()
- Dim buffer As Byte() = New Byte(client.ReceiveBufferSize - 1) {}
- Dim head As [String] = ""
- While Not (head.Contains("</html>"))
- sslStream.Read(buffer, 0, buffer.Length)
- head += System.Text.Encoding.UTF8.GetString(buffer)
- End While
- csrftoken = head.Substring(head.IndexOf("csrftoken=") + "csrftoken=".Length)
- csrftoken = csrftoken.Substring(0, csrftoken.IndexOf(";") - 0)
- mid = head.Substring(head.IndexOf("mid=") + "mid=".Length)
- mid = mid.Substring(0, mid.IndexOf(";") - 0)
- cooks += "mid=" + mid + ";csrftoken=" + csrftoken
- head = ""
- '#End Region
- '#Region "Login"
- Dim x As String = "username=" + id + "&password=" + pass
- Dim request2 = Convert.ToString("POST /accounts/login/ajax/" + " HTTP/1.1" & vbCr & vbLf + "Host: www.instagram.com" & vbCr & vbLf + "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0" & vbCr & vbLf + "Referer: https://www.instagram.com/" & vbCr & vbLf + "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" & vbCr & vbLf + "X-CSRFToken: " + csrftoken + vbCr & vbLf + "Cookie: " + cooks + vbCr & vbLf + "Content-Length: " + x.Length.ToString() + vbCr & vbLf & vbCr & vbLf) & x
- messsage = Encoding.UTF8.GetBytes(request2)
- sslStream.Write(messsage)
- sslStream.Flush()
- buffer = New Byte(2047) {}
- head = ""
- sslStream.Read(buffer, 0, buffer.Length)
- head = System.Text.Encoding.UTF8.GetString(buffer)
- If head.Contains("""authenticated"": false") Then
- Console.WriteLine("Login faild" & vbLf & "Press any key to exit..")
- Console.ReadKey()
- client.Close()
- Return
- ElseIf head.Contains("""authenticated"": true") Then
- Console.WriteLine("Login Ok" & vbLf & "Press any key to exit..")
- Console.ReadKey()
- client.Close()
- Return
- Else
- Console.WriteLine("Bad status" & vbLf & "Press any key to exit..")
- Console.ReadKey()
- client.Close()
- Return
- '#End Region
- End If
- Catch
- Console.WriteLine("Error in request" & vbLf & "Press any key to exit..")
- Console.ReadKey()
- Return
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement