Skip to content

Instantly share code, notes, and snippets.

@HirbodBehnam
Last active April 5, 2019 05:54
Show Gist options
  • Save HirbodBehnam/cef5e9eae8a1db85cd1c117eb750e128 to your computer and use it in GitHub Desktop.
Save HirbodBehnam/cef5e9eae8a1db85cd1c117eb750e128 to your computer and use it in GitHub Desktop.
This script cycles IP addresses of a domain name registered with now-dns.com (Ubuntu and Centos)
#!/bin/bash
USERNAME="Now dns username"
PASSWORD="Now dns password"
HOSTNAME="testsite.now-dns.net" #Your domain
IP=()
#Create a file named ip.txt and add all of your IP addresses in it separated by new line
input="ip.txt"
while IFS= read -r var
do
IP+=("$var")
done < "$input"
while true; do
for i in "${IP[@]}"
do
echo "Changing IP to $i"
curl -u "$USERNAME":"$PASSWORD" "https://now-dns.com/update?hostname=$HOSTNAME&myip=$i"
#Change delay between changing IPs if you want
sleep 3600
done
IP=()
while IFS= read -r var
do
IP+=("$var")
done < "$input"
done
#Run script as service or with tmux or screen; CTRL-C to terminate
@HirbodBehnam
Copy link
Author

New version supports changing IP's while the script is running. Just change IP addresses in ip.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment