Open UweGrunewald opened 2 months ago
Hello.
I did some investigations recently and found out the following. First prerequisite to be able to do any automatic backup solution is to disable the 2FA inside the FritzBox which is in the most cases not so easy to do. But I found a way to manage that. I found the information in the following post(s): https://www.ip-phone-forum.de/threads/fb7590-und-andere-boxen-ab-os-7-50-best%C3%A4tigungen-deaktivieren.314515/post-2538475
Then I prepared the FritzBoxShell relevant script for the backup:
# Login Data
BoxIP="fritz.box"
BoxUSER="MeinBenutzer"
BoxPW="MeinPasswort"
# Get Security Port
location="/upnp/control/deviceinfo"
uri="urn:dslforum-org:service:DeviceInfo:1"
action='GetSecurityPort'
securityPort=$(curl -s -k -m 5 --anyauth -u "$BoxUSER:$BoxPW" "http://$BoxIP:49000$location" -H 'Content-Type: text/xml; charset="utf-8"' -H "SoapAction:$uri#$action" -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:$action xmlns:u='$uri'></u:$action></s:Body></s:Envelope>" | grep NewSecurityPort | awk -F">" '{print $2}' | awk -F"<" '{print $1}')
echo "$securityPort"
# Config File Download
location="/upnp/control/deviceconfig"
uri="urn:dslforum-org:service:DeviceConfig:1"
action='X_AVM-DE_GetConfigFile'
option2='testing'
curlOutput1=$(curl -s -k -m 5 --anyauth -u "$BoxUSER:$BoxPW" "https://$BoxIP:$securityPort$location" -H 'Content-Type: text/xml; charset="utf-8"' -H "SoapAction:$uri#$action" -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:$action xmlns:u='$uri'><NewX_AVM-DE_Password>$option2</NewX_AVM-DE_Password></u:$action></s:Body></s:Envelope>")
echo "$curlOutput1"
BUT...It does not work. Usually the 2nd SOAP call should give me the download URL of the backup, but instead I get an empty string. I will still try to investigate but I wanted to give you a short update.
49443
<und eine leere Zeile>
Cheers, Johannes
Wow, thx a lot Johannes for pursuing on the issue. All I can comment is that I am unaware of any 2FA for my Fritzbox, but this may not mean anything. Further I can tell that the KI created script above was able to login - at least according to the FritzBox's logs. Press thumbs, you can find a working solution. Best, Uwe
It happens rarely but also a Fritzbox can die. Once you encounter this and you run a smart home with 80 Wi-Fi connected devices on fix IP-addresses and your Fritzbox back-up is fairly old, you get the idea of saving the Fritzbox config regularly. So did I and had expected to find a recipe to implement a solution on one of my Raspi's.
Neither Google nor any AI revealed a solution. Open-AI at least made a proposal for a shell script, that does not really work. I am hoping for someone here being able to either find the cause for the script not working or provide a solution.
I run a 7530 AX on the latest firmware that has an admin user "Backup". Script and error log below.
Whoever provides a solution may determine a charity organization I am willing to donate 50,- € to.
The script (made by open AI)
Log, when running the script: