summarylogtreecommitdiffstats
path: root/zenbu-login.bash
diff options
context:
space:
mode:
Diffstat (limited to 'zenbu-login.bash')
-rwxr-xr-xzenbu-login.bash22
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