-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathunblockus_autoupdate.sh
executable file
·54 lines (50 loc) · 2.12 KB
/
unblockus_autoupdate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#
# Unblock-Us Update-Script
#
# This script automatically sends your current IP adress to the Unblock-Us api.
# It can be used to update your IP adress via cron.
#
# Author: Timo Schlueter
# Mail: [email protected]
# Web: www.timo.in
# Twitter: twitter.com/tmuuh
#
# Version: 0.3
# Date: 19-12-2014
#
# Notes: I am not affiliated with Unblock-Us
#
# Variables (user specific)
userlogin="[email protected]"
userpassword="password"
# Environment
apiurl="https://api.unblock-us.com/login?$userlogin:$userpassword"
wgetcmd=$(which wget)
# Check if username and password are set.
if [ -z $userlogin ]
then
echo "No username set."
exit 1
elif [ -z $userpassword ]
then
echo "No password set."
exit 1
else
# Call the api
response=$($wgetcmd --no-check-certificate -qO- $apiurl)
# Check response from api
if [ "$response" = "active" ]; then
echo "IP address is active. You are good to go!"
exit 0
elif [ "$response" = "bad_password" ]; then
echo "Wrong username or password."
exit 1
elif [ "$response" = "not_found" ]; then
echo "Username not found."
exit 1
else
echo "Unknown error. Check api url or documentantion."
exit 1
fi
fi