The humble text box is where we store and output the webpage text. It's a start and if need be we can create a custom control for outputting a webpage with graphics and CSS Styles.
TextBox1.Text = ""
Client Messages is a Class located at the end of this file, that details the HTTP 1.0 GET Request. There is also a POST Request that hasn't been listed here.
Dim cm As ClientMessages = New ClientMessages
byteGet() is an array of bytes taken from ASCII encoded Msg. This is probably taken from the sub header Private Sub Spider(ByVal Msg As String)
Dim byteGet As [Byte]() = System.Text.Encoding.ASCII.GetBytes(Msg)
recvBytes is a buffer to extract 255 bytes of webpage data at a time.
Dim RecvBytes(255) As [Byte]
IPAddress is self-explanatory - its an IP Address.
Dim IPAddress As System.Net.IPAddress
Dim host As System.Net.IPHostEntry = Nothing
host = System.Net.Dns.Resolve(cm.server)
Dim EndPoint As System.Net.IPEndPoint = Nothing
For Each address In host.AddressList
EndPoint = New System.Net.IPEndPoint(address, 80)
The above enlarged section of code establishes the host needed to create an 'EndPoint' that is used below in socket.connect(EndPoint)
There was some querying on how to actually establish a Host with GET Perameters. But, this code seems to work for now...
The legendary Berkeley Implementation of Sockets in VB.NET
Dim socket As System.Net.Sockets.Socket = New System.Net.Sockets.Socket(EndPoint.AddressFamily, Net.Sockets.SocketType.Stream, Net.Sockets.ProtocolType.Tcp)
If socket Is Nothing Then
MsgBox("Failure to communicate.")
Dim bytes As Int32 = 1
socket.Send(byteGet, byteGet.Length, 0)
While bytes > 0
bytes = socket.Receive(RecvBytes, RecvBytes.Length, 0)
Dim tempStr As String = System.Text.ASCIIEncoding.ASCII.GetString(RecvBytes, 0, bytes)
This enlarged code above is all that is required to pull in 255 bytes of data from the socket.
First you send the HTTP GET Request, then start socket.Receive() to get the data one buffer at a time.
The stuff outlined below is required for tag processing. It's a basic tmpString.split(">") that enables us to do something with the data.
Dim index As Int32 = 0
Dim strArray() = tempStr.Split(">")
For Each a As String In strArray
TextBox1.Text += index.ToString + a + vbCrLf
Catch ex As Exception
If HALT = True Then
This is the Client Messages Class. It has custom 'cocksucker' User-Agent:, and much much more!
Public server As String = "shotting.cc"
Public test As String = "GET / HTTP/1.1" + vbCrLf_
+ "User-Agent: Cocksucker" + vbCrLf _
+ "Host: " + server + vbCrLf_
+ "Accept-Language: en-us" + vbCrLf _
+ "Connection: Close" + vbCrLf + vbCrLf
Public [get] As String = "GET http://shotting.cc/get.php?url=" + Form1.TextBox2.Text + " HTTP/1.1" + vbCrLf + "User-Agent: Cocksucker" + vbCrLf + "Host: " + server + vbCrLf + "Accept-Language: en-us" + vbCrLf + "Connection: Close" + vbCrLf + vbCrLf
Public ACK As String = "HTTP/1.0 200 OK"