mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-26 19:58:45 +02:00
Update list-ip-addresses.ps1
This commit is contained in:
parent
5adca7f5dd
commit
52a502cc5a
@ -5,7 +5,7 @@
|
|||||||
This PowerShell script queries all IP address information and prints it.
|
This PowerShell script queries all IP address information and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-ip-addresses.ps1
|
PS> ./list-ip-addresses.ps1
|
||||||
✅ Public IP address 185.72.229.161, 2003:f2:6128:fd01:e543:601:30c2:a028 near Munich, Germany
|
✅ Public IP 185.72.229.161, 2003:f2:6128:fd01:e543:601:30c2:a028 near Munich, Germany
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -26,7 +26,7 @@ function WriteLocalInterface($interface) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($IPv4 -ne "" -or $IPv6 -ne "") {
|
if ($IPv4 -ne "" -or $IPv6 -ne "") {
|
||||||
Write-Host "✅ Local $interface IP address $IPv4/$prefixLen, $IPv6"
|
Write-Host "✅ Local $interface IP $IPv4/$prefixLen, $IPv6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ try {
|
|||||||
if ("$publicIPv6" -eq "") { $publicIPv6 = "no IPv6" }
|
if ("$publicIPv6" -eq "") { $publicIPv6 = "no IPv6" }
|
||||||
if ("$city" -eq "") { $city = "unknown city" }
|
if ("$city" -eq "") { $city = "unknown city" }
|
||||||
if ("$country" -eq "") { $country = "unknown country" }
|
if ("$country" -eq "") { $country = "unknown country" }
|
||||||
Write-Host "✅ Public IP address $publicIPv4, $publicIPv6 near $city, $country" ; if ($country -eq "Russia") { Write-Host -foregroundColor red "DON'T TRUST PUTIN !!! FLEE NOW OR DIE AS SOLDIER IN UKRAINE !!!" }
|
Write-Host "✅ Public IP $publicIPv4, $publicIPv6 near $city, $country"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user