From 40409911b33f2d88806bc2fc79467ea1e437125f Mon Sep 17 00:00:00 2001 From: Rusk85 Date: Fri, 4 Nov 2016 07:54:41 +0100 Subject: [PATCH] script to retrieve IP from fritzbox via UPnP Original author of this one-liner can be found here: http://scytale.name/blog/2010/01/fritzbox-wan-ip --- get-ip-from-fritzbox | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 get-ip-from-fritzbox diff --git a/get-ip-from-fritzbox b/get-ip-from-fritzbox new file mode 100644 index 0000000..ce82540 --- /dev/null +++ b/get-ip-from-fritzbox @@ -0,0 +1,12 @@ +#!/bin/bash +# All credits for this one liner go to the author of this blog: +# http://scytale.name/blog/2010/01/fritzbox-wan-ip +# As the author explains its not required to tamper with the provided IP for the FritzBox +# as it always binds to that address for UPnP. +# Disclaimer: It might be necessary to make the script executable + +curl -s -H 'Content-Type: text/xml; charset="utf-8"' \ + -H 'SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress' \ + --data-binary '' \ + http://169.254.1.1:49000/upnp/control/WANCommonIFC1 | \ + sed -n -e 's#^.*\(.*\).*$#\1#p'