1
0
Fork 0
dotfiles/simpleDots/bin/reconnectfritzbox.sh
Joerg Elfring a26076b864 ALL NEW DOTFILES!
No more branches and no more Makefiles
2020-06-16 22:47:23 +02:00

25 lines
723 B
Bash
Executable file

#!/bin/bash
# Reconnect a Fritz.Box with activated UPnP
oldIp=$(curl -s https://canihazip.com/s)
curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" \
-H 'Content-Type: text/xml; charset="utf-8"' \
-H 'SoapAction: urn:schemas-upnp-org:service:WANIPConnection:1#ForceTermination' \
-d '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" >
<s:Body>
<u:ForceTermination xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" />
</s:Body>
</s:Envelope>' \
-s
sleep 5
newIp=$(curl -s https://canihazip.com/s)
notify-send "Renew IP" "Old IP: $oldIp\nNew IP: $newIp"