-
-
Save ojpojao/0b48a6e6d50b017bff91757a53498a0e to your computer and use it in GitHub Desktop.
Speedport pro/pro plus get public ip (with lte bonding enabled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import urllib3 | |
import xmltodict | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
data = "<soap-env:Envelope xmlns:soap-env=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" \ | |
"xmlns:cwmp=\"urn:telekom-de.totr64-2-n\"><soap-env:Body><cwmp:GetParameterValues xmlns:cwmp=\"urn:dslforum-org:cwmp-1-0\"><cwmp:ParameterNames length=\"1\">" \ | |
"<xsd:string>Device.IP.Interface.4.IPv4Address.1.IPAddress</xsd:string></cwmp:ParameterNames></cwmp:GetParameterValues></soap-env:Body></soap-env:Envelope>" | |
headers = { | |
"User-Agent": "Speedport-Pro-CLI/0.1.0 (Python; Linux; rv:1.0) Build/20210113", | |
"Accept": "*/*", | |
"SOAPAction": "urn:telekom-de:device:TO_InternetGatewayDevice:2#GetParameterValues", | |
"Content-Type": "text/xml; charset=utf-8" | |
} | |
request = requests.post(url="https://192.168.2.1:49443/", headers=headers, data=data, verify=False) | |
resp=xmltodict.parse(request.text) | |
print("Current IP Address: "+resp["SOAP-ENV:Envelope"]["SOAP-ENV:Body"]["u:GetParameterValuesResponse"]["ParameterList"]["ParameterValueStruct"]["Value"]["#text"]) | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment