]> git.g-eek.se Git - users/gustav/scripts.git/commitdiff
[ip-check] Inital on check ip
authorGustav Eek <gustav.eek@etraveli.com>
Thu, 15 Nov 2018 10:02:00 +0000 (11:02 +0100)
committerGustav Eek <gustav.eek@etraveli.com>
Thu, 15 Nov 2018 10:02:00 +0000 (11:02 +0100)
Makefile
ip-check [new file with mode: 0644]

index bc81ab74abeae02498a4c344d01144e614ba2ef9..76052729623bfff0d02581ac9b9c8bf3ee0185ec 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,8 @@ exiv2-common-edits \
 confluence-tk \
 json2yaml \
 yaml2json \
+ip-check \
+
 
 bash-completion = \
 repo-encrypt \
diff --git a/ip-check b/ip-check
new file mode 100644 (file)
index 0000000..bbca48f
--- /dev/null
+++ b/ip-check
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+dir="$(dirname "$0")"
+base="$(basename "$0")"
+tmp="/tmp"
+curl_out="$tmp/$base-$$-out.html"
+
+baseurl="http://checkip.dyndns.org"
+
+curl -s -L "$baseurl" | \
+    tee "$curl_out" | \
+    sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
+
+baseurl="http://192.168.0.1"
+cookie="$tmp/$base-$$.cook"
+
+curl "$baseurl/DprSetup.asp" -v \
+     --compressed --cookie "$cookie" --cookie-jar "$cookie"
+
+curl "$baseurl/goform/login" \
+     -L \
+     --form "login_password=bananklase" \
+     --compressed --cookie "$cookie" --cookie-jar "$cookie" \
+     -v
+