diff options
author | Milan Oberkirch | 2015-03-07 21:47:06 +1300 |
---|---|---|
committer | Milan Oberkirch | 2015-03-07 21:47:06 +1300 |
commit | e031a3be6648603abda642cddc1ad66373427fb4 (patch) | |
tree | 6311cd1d4d0335fc68e49f36684a039556e51220 | |
parent | 81249e85e1340a24747fecd0fba72cf21298066e (diff) | |
download | aur-e031a3be6648603abda642cddc1ad66373427fb4.tar.gz |
add the script
-rwxr-xr-x | zenbu-login.bash | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/zenbu-login.bash b/zenbu-login.bash new file mode 100755 index 000000000000..b62a6494a332 --- /dev/null +++ b/zenbu-login.bash @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +__NAME__="zenbu-login" + +# the following file should define 2 variables: $username and $password: +source /etc/"${__NAME__}" + +function zenbu-login () { + post_data="form_request=login&gw_address=10.10.24.1&gw_port=2060&gw_id=ZenBu10289&mac=EC%3A0E%3AC4%3A1C%3A8E%3A2F&auth_source=default-network&username=$username&password=$password&form_submit=login" + url="$(curl\ + -H 'Content-Type: application/x-www-form-urlencoded'\ + -d ${post_data}\ + https://secure.zenbu.net.nz/login/ \ + 2>/dev/null\ + | egrep -o 'http://.*url=' -m 1)" + curl "$url" &> /dev/null +} + +# execute if called directly +if grep -q "${__NAME__}" <<< "$0"; then + ${__NAME__} +fi |