Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
skrypt do pokazywania parametrów sygnału w modemie mobilnym 4G
import base64
import hashlib
import requests
import sys
router_ip = '192.168.100.1'
password = 'password'
password_encoded = hashlib.sha256(base64.b64encode(password.encode())).hexdigest().upper()
headers = {'Referer': f'http://{router_ip}/index.html'}
login = requests.post(f'http://{router_ip}/goform/goform_set_cmd_process', data={'goformId': 'LOGIN', 'password': password_encoded}, headers=headers)
if login.json()['result'] == '0':
ltebandlock=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_band_lock', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
Z_SINR=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'Z_SINR', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
Z_eNB_id=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'Z_eNB_id', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
Z_rsrq=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'Z_rsrq', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
rssi=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'rssi', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
rscp=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'rscp', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_rsrp=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_rsrp', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_pcell_band=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_pcell_band', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_pcell_bandwidth=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_pcell_bandwidth', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_scell_band=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_scell_band', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_scell_bandwidth=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_scell_bandwidth', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_pcell_arfcn=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_pcell_arfcn', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_scell_arfcn=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_scell_arfcn', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
lte_ca_scell_info=requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'lte_ca_scell_info', 'isTest': 'false'}, headers=headers, cookies=login.cookies).json()
print(f'Bands: {ltebandlock}')
print(f'Z_SINR: {Z_SINR}')
print(f'Z_eNB_id: {Z_eNB_id}')
print(f'Z_rsrq: {Z_rsrq}')
print(f'rssi: {rssi}')
print(f'rscp: {rscp}')
print(f'lte_rsrp: {lte_rsrp}')
print(f'lte_ca_pcell_band: {lte_ca_pcell_band}')
print(f'lte_ca_pcell_bandwidth: {lte_ca_pcell_bandwidth}')
print(f'lte_ca_scell_band: {lte_ca_scell_band}')
print(f'lte_ca_scell_bandwidth: {lte_ca_scell_bandwidth}')
print(f'lte_ca_pcell_arfcn: {lte_ca_pcell_arfcn}')
print(f'lte_ca_scell_arfcn: {lte_ca_scell_arfcn}')
print(f'lte_ca_scell_info: {lte_ca_scell_info}')
else:
print(f'Login error: {login.text}')
@olekstomek
Copy link
Author

olekstomek commented Nov 7, 2021

https://eko.one.pl/forum/viewtopic.php?pid=260018#p260018

root@Gateway:~# python zte_getbandinfo.py
Bands: {'lte_band_lock': '0x20080800C5'}
Z_SINR: {'Z_SINR': '0.4'}
Z_eNB_id: {'Z_eNB_id': '70938890'}
Z_rsrq: {'Z_rsrq': '-14.0'}
rssi: {'rssi': '69'}
rscp: {'rscp': ''}
lte_rsrp: {'lte_rsrp': '-98'}
lte_ca_pcell_band: {'lte_ca_pcell_band': '20'}
lte_ca_pcell_bandwidth: {'lte_ca_pcell_bandwidth': '10.0'}
lte_ca_scell_band: {'lte_ca_scell_band': '1'}
lte_ca_scell_bandwidth: {'lte_ca_scell_bandwidth': '15.0'}
lte_ca_pcell_arfcn: {'lte_ca_pcell_arfcn': '6350'}
lte_ca_scell_arfcn: {'lte_ca_scell_arfcn': '227'}
lte_ca_scell_info: {'lte_ca_scell_info': '307,2,1,227,15.0;307,2,3,1599,10.0;'}
root@Gateway:~#

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment