This script will allow a Windows user to resolve the hostname of an IP address. I remembered the scene in CSI when they were trying to backtrace an IP address using VB, so I came up with this script to do this easily.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | Imports System.Net Imports System.IO Imports Newtonsoft.Json.Linq Private Sub btnBacktrace_Click(sender As Object, e As EventArgs) Handles btnBacktrace.Click Dim ipAddress As String = txtIPAddress.Text.Trim() If Not String.IsNullOrEmpty(ipAddress) Then Dim apiKey As String = "YOUR_IPSTACK_API_KEY" Dim apiUrl As String = $"http://api.ipstack.com/{ipAddress}?access_key={apiKey}" Try Using client As New WebClient() Dim response As String = client.DownloadString(apiUrl) Dim json As JObject = JObject.Parse(response) Dim country As String = json("country_name").ToString() Dim city As String = json("city").ToString() Dim region As String = json("region_name").ToString() Dim latitude As String = json("latitude").ToString() Dim longitude As String = json("longitude").ToString() Dim result As String = $"Country: {country}{vbCrLf}City: {city}{vbCrLf}Region: {region}{vbCrLf}Latitude: {latitude}{vbCrLf}Longitude: {longitude}" rtbResult.Text = result End Using Catch ex As WebException rtbResult.Text = "Error: Unable to fetch data. Please check your internet connection or try again later." Catch ex As Exception rtbResult.Text = "An unexpected error occurred. Please try again later." End Try Else rtbResult.Text = "Please enter a valid IP address." End If End Sub |
This is a GUI interface in Visual Basic to backtrace an IP address.
Replace "YOUR_IPSTACK_API_KEY"
with your actual ipstack API key.
Save the file and run the application. You can now enter an IP address into the text box and click the “Backtrace” button to retrieve and display information about the IP address.