Created
August 20, 2024 22:18
-
-
Save ZackStone/3cac5ef94f7097ba5524d525b2166d97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$previp = ""; | |
while ($true) | |
{ | |
$timestamp = (Get-Date -Format "HH:mm:ss"); | |
$ip = (Invoke-WebRequest https://meuip.com/api/meuip.php).Content ; | |
$print = "$($timestamp): $($ip)"; | |
#Write-Host $print; | |
if ($ip -ne $previp) | |
{ | |
$print | Out-File -FilePath .\meuip.txt -Append; | |
$previp = $ip; | |
Write-Host "!! MUDOU !!"; | |
Write-Host $print; | |
Start-Sleep 1; | |
} | |
else | |
{ | |
Start-Sleep 5; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivação: detectar mudanças de IP externo, seja por alteração de rede Wi-Fi, mudança de dispositivo primário, gerenciamento do provedor, etc...