-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathunblockus_autoupdate_osx.sh
53 lines (49 loc) · 1.17 KB
/
unblockus_autoupdate_osx.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
#!/bin/bash
#
# 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: me@timo.in
# Web: www.timo.in
# Twitter: twitter.com/tmuuh
#
# Version: 0.3
# Date: 03-03-2015
#
# Notes: I am not affiliated with Unblock-Us
#
# Variables (user specific)
userlogin="email@example.com"
userpassword="password"
# Environment
apiurl="https://api.unblock-us.com/login?$userlogin:$userpassword"
# 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=$(curl --silent $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