From 54ad1c02a30d3ef45ac66166d4e53fcf105c4c7e Mon Sep 17 00:00:00 2001 From: remittor Date: Sat, 2 Sep 2023 18:56:37 +0300 Subject: [PATCH] Add support RB03 (firmware v1.2.7) --- connect.py | 2 +- connect3.py | 46 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/connect.py b/connect.py index f2e4e67..69a7b59 100644 --- a/connect.py +++ b/connect.py @@ -39,7 +39,7 @@ if dn == 'R3600' and gw.rom_version == '1.0.17': import connect2 sys.exit(0) -if dn in 'R3600 RA69 RA70 RA72': +if dn in 'R3600 RA69 RA70 RA72 RB03': import connect3 sys.exit(0) diff --git a/connect3.py b/connect3.py index 0ba4761..86ba2e9 100644 --- a/connect3.py +++ b/connect3.py @@ -212,24 +212,42 @@ def telnet_connect(xqpass): return None -flasher = ExFlasher(gw) -xqpass = calc_xqpassword(flasher.syslog.device_sn) +flasher = None +device_sn = None + +if dn == 'RB03': + if gw.rom_version != '1.2.7': + die('First you need to install firmware version 1.2.7 (without saving settings)') + info = gw.get_init_info() + if not info or info["code"] != 0: + die('Cannot get init_info') + device_sn = info["id"] +else: + flasher = ExFlasher(gw) + device_sn = flasher.syslog.device_sn + +print(f'Device Serial Number: {device_sn}') +xqpass = calc_xqpassword(device_sn) print('Default Telnet password: "{}"'.format(xqpass)) -if not gw.check_telnet(): - bdata = flasher.get_bdata_env() - if not 'telnet_en' in bdata.var or bdata.var['telnet_en'] != '1': - flasher.patch_bdata() - -if not gw.check_telnet(): - die('The Telnet server could not be activated.') +if flasher: + if not gw.check_telnet(): + bdata = flasher.get_bdata_env() + if not 'telnet_en' in bdata.var or bdata.var['telnet_en'] != '1': + flasher.patch_bdata() + if not gw.check_telnet(): + die('The Telnet server could not be activated.') +else: + if not gw.check_telnet(): + die('Telnet server not respond.') ''' -print('Connect to telnet ...') -if not telnet_connect(xqpass): - print('Can\'t connect to Telnet server.') - device_factory_reset() - flasher.wait_reboot(75) +if flasher: + print('Connect to telnet ...') + if not telnet_connect(xqpass): + print('Can\'t connect to Telnet server.') + device_factory_reset() + flasher.wait_reboot(75) ''' print('Connect to Telnet ...')