08-14-2010, 04:39 AM
Not really a tutorial.. But I thought it would help some people out. Firstly you will need the following GetBetween function which I think was coded by Deathader but I'm not entirely sure.
Basically all this does is downloads the source of www.whatismyipaddress.com.
This is scanning the source for the string of code which contains the information you need.
This is displaying all the information you have downloaded.
Hope this can help some people. I know it's not really a tutorial but I wanted to share it with you all.
GetBetween (Click to View)
Code:
Public Function GetBetween(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, _
Optional ByRef startPos As Integer = 0) As String
Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
Dim strResult As String
strResult = String.Empty
iPos = strSource.IndexOf(strStart, startPos)
iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
If iPos <> -1 AndAlso iEnd <> -1 Then
strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
End If
Return strResult
End Function
Code:
Imports System.Net
Imports System.Text
Code:
Try
Dim myWebClient As New WebClient()
Dim myDatabuffer As Byte() = myWebClient.DownloadData("http://whatismyipaddress.com/")
Dim download As String = Encoding.ASCII.GetString(myDatabuffer)
Code:
Dim IP As String = GetBetween(download, "<span class=""ip blue"">", "<", 0)
Dim ISP As String = GetBetween(download, "ISP:</th><td>", "</td>", 0)
Dim ORG As String = GetBetween(download, "Organization:</th><td>", "</td>", 0)
Dim PRO As String = GetBetween(download, "Proxy:</th><td>", "</td>", 0)
Dim CIT As String = GetBetween(download, "City:</th><td>", "</td>", 0)
Dim REG As String = GetBetween(download, "Region:</th><td>", "</td>", 0)
Dim COU As String = GetBetween(download, "Country:</th><td>", "<img", 0)
Code:
TextBox1.Text = IP
TextBox2.Text = ISP
TextBox3.Text = ORG
If PRO.Contains("None Detected") Then
TextBox4.Text = "None"
Else
TextBox4.Text = PRO
End If
TextBox5.Text = CIT
TextBox6.Text = REG
TextBox7.Text = COU
Catch ex As Exception
End Try
Hope this can help some people. I know it's not really a tutorial but I wanted to share it with you all.