From 31fde99472f28ee9706df789889de898b0fb59a7 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Mon, 30 Dec 2024 23:30:22 -0500 Subject: [PATCH] Added State and City to IP Geolocation API --- CHAMP.ps1 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/CHAMP.ps1 b/CHAMP.ps1 index eafad8b..e963fec 100644 --- a/CHAMP.ps1 +++ b/CHAMP.ps1 @@ -1317,12 +1317,12 @@ $Form1.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog $Form1.MaximizeBox = $false $Form1.Name = "Form1" $Form1.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterParent -$Form1.Text = "CHAMP - 2024.09.01" +$Form1.Text = "CHAMP - 2024.9.1" Function preflight () { $preflightCounter = [int] 0 $preflightDependancies = "" Write-Host "Running Pre-Flight checks...`n" - $currentVersion = "2024.09.01" + $currentVersion = "2024.9.1" $version = Invoke-WebRequest -URI https://git.racooncity.org/brotoskyj/CHAMP/raw/branch/master/version.txt | Select-Object -ExpandProperty Content Write-Host "Version Check:" Write-Host "Local Version: $currentVersion" @@ -1348,7 +1348,7 @@ Function preflight () { $preflightCounter++ } Start-Sleep 1 - if ( $preflightCounter -eq 2 ) { + if ( $preflightCounter -eq 1 ) { Write-Host -ForegroundColor "Green" "Pre-Flight Checks are a go... Launching CHAMP" Start-Sleep 1 $devFlag = 0 @@ -2177,7 +2177,18 @@ function geoLocationForm() { $countryTextBox.Location = New-Object System.Drawing.Point(275, 60) $countryTextLabel = New-Object System.Windows.Forms.Label $countryTextLabel.Text = "Country: " - $countryTextLabel.Location = New-Object System.Drawing.Size(225, 60) + $stateTextBox = New-Object System.Windows.Forms.TextBox + $stateTextBox.Size = New-Object System.Drawing.Size(165, 35) + $stateTextBox.Location = New-Object System.Drawing.Point(275,100) + $stateTextLabel = New-Object System.Windows.Forms.Label + $stateTextLabel.Text = "ISP:" + $stateTextLabel.Location = New-Object System.Drawing.Point(225, 100) + $cityTextBox = New-Object System.Windows.Forms.TextBox + $cityTextBox.Size = New-Object System.Drawing.Size(165, 35) + $cityTextBox.Location = New-Object System.Drawing.Point(275,100) + $cityTextLabel = New-Object System.Windows.Forms.Label + $cityTextLabel.Text = "ISP:" + $stateTextLabel.Location = New-Object System.Drawing.Point(225, 100) $ipLocationSearchButton = New-Object System.Windows.Forms.Button $ipLocationSearchButton.Size = New-Object System.Drawing.Size(50, 23) $ipLocationSearchButton.Location = New-Object System.Drawing.Size(10, 75) @@ -2199,6 +2210,10 @@ function geoLocationForm() { $ispTextLabel, $countryTextBox, $countryTextLabel, + $stateTextBox, + $stateTextLabel, + $cityTextBox, + $cityTextLabel $ipLocationSearchButton ) ) @@ -2209,6 +2224,9 @@ function geoLocationForm() { $response = Invoke-RestMethod -Method GET -URI "http://ip-api.com/json/$ipToSearch" $ispTextBox.Text = $response.isp $countryTextBox.Text = $response.country + $stateTextBox.Text = $response.regionName + $cityTextBox.Text = $response.city + } $geoLocationFormBox.ShowDialog()