skrypt do ustawiania parametrów sygnału w modemie mobilnym 4G
This file contains 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 base64 | |
import hashlib | |
import requests | |
import sys | |
#usage: python3 zte-setband_2.0 B1,B3,B7 | |
router_ip = '192.168.100.1' #change to MF286D IP | |
password = 'password' #change to MF286D admin password | |
ltebandlock='0x20080800C5' #don't change this | |
bdict = { | |
"B1": 1, | |
"B3": 4, | |
"B7": 40, | |
"B8": 80, | |
"B20": 80000, | |
"B28": 8000000, | |
"B38": 2000000000 | |
} | |
password_encoded = hashlib.sha256(base64.b64encode(password.encode())).hexdigest().upper() | |
if len(sys.argv) > 1: | |
bands=sys.argv[1].split(',') | |
if len(bands) < 4: | |
somma=0 | |
for x in bands: | |
somma=somma+bdict[x] | |
ltebandlock='0x'+str(somma) | |
print(ltebandlock) | |
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': | |
version = requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'wa_inner_version,cr_version', 'multi_data': '1'}, headers=headers, cookies=login.cookies).json() | |
version_string = version['wa_inner_version'] + version['cr_version'] | |
version_md5 = hashlib.md5(version_string.encode()).hexdigest() | |
rd = requests.get(f'http://{router_ip}/goform/goform_get_cmd_process', params={'cmd': 'RD'}, headers=headers, cookies=login.cookies).json() | |
ad_string = version_md5 + rd['RD'] | |
ad = hashlib.md5(ad_string.encode()).hexdigest() | |
setlteband = requests.post(f'http://{router_ip}/goform/goform_set_cmd_process', data={'isTest': 'false', 'goformId': 'SET_LTE_BAND_LOCK', 'lte_band_lock': ltebandlock, 'AD': ad}, headers=headers, cookies=login.cookies).json() | |
print(setlteband['result']) | |
else: | |
print(f'Login error: {login.text}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://eko.one.pl/forum/viewtopic.php?pid=260177#p260177