remove wget dependency, use curl instead
This commit is contained in:
@@ -10,7 +10,7 @@ You can use any service returning your IP address in a plain form (so no HTML he
|
||||
|
||||
## Requirements
|
||||
|
||||
This Bash script requires curl and wget to be installed. It has been tested on a Debian Sid (April 2016) and doesn't use fancy parameters for both applications.
|
||||
This Bash script requires curl to be installed. It has been tested on a Debian Bookworm and doesn't use fancy parameters for both applications.
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ PASS[0]=mypass
|
||||
# return. So you would have to set your DynDNS domain record
|
||||
# accordingly to AAAA instead of A to make it working. Else, use a
|
||||
# service which only returns your IPv4 address like the default one.)
|
||||
IPSERV=http://ip4.nandus.net
|
||||
IPSERV=https://ip4.snapdns.eu
|
||||
|
||||
# Timeout for IP requests to the service above in seconds
|
||||
TIMEOUT=10
|
||||
|
||||
@@ -55,7 +55,6 @@ function testinst {
|
||||
fi
|
||||
}
|
||||
testinst curl
|
||||
testinst wget
|
||||
|
||||
# Loop over all hosts. $i will be key
|
||||
for i in "${!USER[@]}"; do
|
||||
@@ -69,7 +68,7 @@ for i in "${!USER[@]}"; do
|
||||
|
||||
# Read old IP, gather new IP via IP return service
|
||||
OLDIP=$(cat "$oldip")
|
||||
NEWIP=$(wget -T $TIMEOUT -q -O - $IPSERV)
|
||||
NEWIP=$(curl -m "$TIMEOUT" -s "$IPSERV")
|
||||
|
||||
# Post current timestamp in logfile
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")]" > "$logfile"
|
||||
@@ -92,7 +91,7 @@ for i in "${!USER[@]}"; do
|
||||
if [ ! -e tor-ips.txt ] || [ $[ $(date +%s) - $(stat -L -c %Y tor-ips.txt) ] -gt "604800" ]; then
|
||||
# download list, extract plain IPs, move back to file
|
||||
echo "download list"
|
||||
wget -O tor-ips.txt $EXITNODES
|
||||
curl "$EXITNODES" > tor-ips.txt
|
||||
TORIPS=$(grep "^ExitAddress" tor-ips.txt | cut -d" " -f2)
|
||||
echo $TORIPS | sed 's/ /\n/g' > tor-ips.txt
|
||||
fi
|
||||
@@ -113,4 +112,3 @@ for i in "${!USER[@]}"; do
|
||||
echo "Updated IP address from $OLDIP to $NEWIP." >> "$logfile"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user