mirror of
https://github.com/openwrt-xiaomi/xmir-patcher.git
synced 2026-09-22 22:57:55 +03:00
gateway: Add arg "try_telnet" to func "create_gateway"
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ if gw.model_id > 0 and gw.model_id < gw.get_modelid_by_name('R2100'):
|
||||
|
||||
if True:
|
||||
# init gw and check ssh
|
||||
gw = create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_login = True)
|
||||
gw = create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_login = True, try_telnet = True)
|
||||
|
||||
hackCheck = gw.detect_hackCheck(update = True)
|
||||
if hackCheck:
|
||||
|
||||
+3
-1
@@ -1318,7 +1318,7 @@ def import_module(mod_name, gw):
|
||||
mod_object.inited_gw = gw
|
||||
mod_spec.loader.exec_module(mod_object)
|
||||
|
||||
def create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_login = True, ssh_port = 22):
|
||||
def create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_login = True, ssh_port = 22, try_telnet = False):
|
||||
gw = Gateway(timeout = timeout, detect_ssh = False)
|
||||
if gw.status < 1:
|
||||
die(f"Xiaomi Mi Wi-Fi device not found (IP: {gw.ip_addr})")
|
||||
@@ -1329,6 +1329,8 @@ def create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_lo
|
||||
ret = gw.detect_ssh(verbose = 1, interactive = True)
|
||||
while ret == 23:
|
||||
ret = 0
|
||||
if not try_telnet:
|
||||
break
|
||||
print(f'Detected running TELNET server. Try to start SSH server...')
|
||||
if gw.passw and gw.passw != 'root':
|
||||
print('Default TELNET password =', gw.passw)
|
||||
|
||||
Reference in New Issue
Block a user