Last active
September 6, 2024 13:38
-
-
Save roelds/75fb4ee91a410cdc5c009e8437ed73df to your computer and use it in GitHub Desktop.
Afraid FreeDNS Dynamic Updater - Startup Scripts
This file contains 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
# Windows PowerShell | |
while (($PSVersionTable).PSVersion.ToString().Chars(0) -eq '5') { | |
# $oneoneoneone = tnc "one.one.one.one" -CommonTCPPort HTTP -WarningAction SilentlyContinue | select TcpTestSucceeded | |
# if ($oneoneoneone.TcpTestSucceeded -eq $true) { | |
$oneoneoneone = Test-Connection "one.one.one.one" -Count 1 -WarningAction SilentlyContinue | select StatusCode | |
if ($oneoneoneone.StatusCode -eq 0) { | |
echo "yes ping out" | |
$NowResolv = (Resolve-DnsName yourdynamicname.afraid.org -Server 1.1.1.1 -DnsOnly -NoHostsFile).IPAddress | |
$NowIPify = irm https://api.ipify.org | |
if ($NowResolv -eq $NowIPify) { echo "same IP"; sleep 33 } else { echo "new IP"; Write-Host -NoNewLine "`a"; irm https://sync.afraid.org/u/yourguidhere/; sleep 33 } | |
} else { echo "no ping out"; sleep 33 } | |
} |
This file contains 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
#!/bin/bash | |
while [$true]; do | |
oneoneoneone=$(ping -c 1 one.one.one.one > /dev/null 2>&1 && echo "0" || echo "1") | |
if [[ "$oneoneoneone" -eq "0" ]]; then | |
echo "yes ping out" | |
NowResolv=$(dig +short yourdynamicname.afraid.org @1.1.1.1) | |
NowIPify=$(curl -s https://api.ipify.org) | |
if [[ "$NowResolv" == "$NowIPify" ]]; then | |
echo "same IP" | |
sleep 33 | |
else | |
echo "new IP" | |
echo -e "\a" | |
curl -s https://sync.afraid.org/u/yourguidhere/ | |
sleep 33 | |
fi | |
else | |
echo "no ping out" | |
sleep 33 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment