fixes for logics
parent
4596e0dddb
commit
00b4497375
|
@ -14,7 +14,7 @@ import argparse
|
||||||
|
|
||||||
parser = argparse.ArgumentParser("ZTE simple exporter")
|
parser = argparse.ArgumentParser("ZTE simple exporter")
|
||||||
parser.add_argument("ip", help="Router ip address")
|
parser.add_argument("ip", help="Router ip address")
|
||||||
parser.add_argument("username", help="Router username", default="admin")
|
parser.add_argument("--username", help="Router username", default="admin")
|
||||||
parser.add_argument("password", help="Router password")
|
parser.add_argument("password", help="Router password")
|
||||||
parser.add_argument("--port", help="Serve metrics on what port", type=int, default=8999)
|
parser.add_argument("--port", help="Serve metrics on what port", type=int, default=8999)
|
||||||
parser.add_argument("--reset", help="Reset tr069 info", default=False, type=bool)
|
parser.add_argument("--reset", help="Reset tr069 info", default=False, type=bool)
|
||||||
|
@ -27,8 +27,7 @@ s = requests.Session()
|
||||||
|
|
||||||
class zteRouter:
|
class zteRouter:
|
||||||
|
|
||||||
def __init__(self, ip, username, password, login, device):
|
def __init__(self, ip, username, password, device):
|
||||||
self.login = login
|
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.protocol = "http" # default to http
|
self.protocol = "http" # default to http
|
||||||
self.username = username
|
self.username = username
|
||||||
|
@ -129,7 +128,7 @@ class zteRouter:
|
||||||
|
|
||||||
def resettr69(self):
|
def resettr69(self):
|
||||||
ip = self.ip
|
ip = self.ip
|
||||||
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), login=self.device)
|
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), device=self.device)
|
||||||
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=cr_version%2Ctr069_ServerURL%2Ctr069_CPEPortNo%2Ctr069_ServerUsername%2Ctr069_ServerPassword%2Ctr069_ConnectionRequestUname%2Ctr069_ConnectionRequestPassword%2Cwan_ipaddr%2Ctr069_PeriodicInformEnable%2Ctr069_PeriodicInformInterval%2Ctr069_CertEnable%2Ctr069_DataModule%2Ctr069_Webui_DataModuleSupport"
|
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=cr_version%2Ctr069_ServerURL%2Ctr069_CPEPortNo%2Ctr069_ServerUsername%2Ctr069_ServerPassword%2Ctr069_ConnectionRequestUname%2Ctr069_ConnectionRequestPassword%2Cwan_ipaddr%2Ctr069_PeriodicInformEnable%2Ctr069_PeriodicInformInterval%2Ctr069_CertEnable%2Ctr069_DataModule%2Ctr069_Webui_DataModuleSupport"
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -144,7 +143,7 @@ class zteRouter:
|
||||||
print("\n---")
|
print("\n---")
|
||||||
|
|
||||||
ip = self.ip
|
ip = self.ip
|
||||||
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), login=self.device)
|
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), device=self.device)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"Host": ip,
|
"Host": ip,
|
||||||
|
@ -178,7 +177,7 @@ class zteRouter:
|
||||||
|
|
||||||
def zteinfo(self):
|
def zteinfo(self):
|
||||||
ip = self.ip
|
ip = self.ip
|
||||||
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), login=self.device)
|
cookie = self.getCookie(username=self.username, password=self.password, LD=self.get_LD(), device=self.device)
|
||||||
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=wa_inner_version%2Cwan_ipaddr%2Cwan_apn%2Cnetwork_type%2Cnr5g_action_band%2CZ5g_rsrq%2CZ5g_rsrp%2CZ5g_rssi%2CZ5g_SINR%2Cnr_multi_ca_scell_info%2Clte_multi_ca_scell_info%2Clte_multi_ca_scell_sig_info%2Clte_ca_pcell_band%2Clte_rsrp%2Clte_rsrq%2Clte_rssi%2Clte_snr%2Cmonthly_tx_bytes%2Cmonthly_rx_bytes%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt%2Cnr_multi_ca_scell_info%2Cnr5g_action_band"
|
cmd_url = f"{self.protocol}://{self.ip}/goform/goform_get_cmd_process?multi_data=1&isTest=false&cmd=wa_inner_version%2Cwan_ipaddr%2Cwan_apn%2Cnetwork_type%2Cnr5g_action_band%2CZ5g_rsrq%2CZ5g_rsrp%2CZ5g_rssi%2CZ5g_SINR%2Cnr_multi_ca_scell_info%2Clte_multi_ca_scell_info%2Clte_multi_ca_scell_sig_info%2Clte_ca_pcell_band%2Clte_rsrp%2Clte_rsrq%2Clte_rssi%2Clte_snr%2Cmonthly_tx_bytes%2Cmonthly_rx_bytes%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt%2Cnr_multi_ca_scell_info%2Cnr5g_action_band"
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -190,7 +189,7 @@ class zteRouter:
|
||||||
response = s.get(cmd_url, headers=headers, verify=False, timeout=1)
|
response = s.get(cmd_url, headers=headers, verify=False, timeout=1)
|
||||||
return response.text
|
return response.text
|
||||||
|
|
||||||
zteInstance = zteRouter(args.ip, args.username, args.password, args.login, args.device)
|
zteInstance = zteRouter(args.ip, args.username, args.password, args.device)
|
||||||
serverPort = args.port
|
serverPort = args.port
|
||||||
|
|
||||||
class serveInfos(BaseHTTPRequestHandler):
|
class serveInfos(BaseHTTPRequestHandler):
|
||||||
|
|
Loading…
Reference in New Issue