mirror of
https://github.com/openwrt-xiaomi/xmir-patcher.git
synced 2026-09-22 22:57:55 +03:00
connect: Add possibility set web password in command line
Example: run.bat connect6.py 12345678
This commit is contained in:
+7
-1
@@ -17,11 +17,17 @@ import json
|
||||
import xmir_base
|
||||
from gateway import *
|
||||
|
||||
die_if_sshOk = True
|
||||
web_password = True
|
||||
if len(sys.argv) > 1 and sys.argv[0].endswith('connect5.py'):
|
||||
if sys.argv[1]:
|
||||
web_password = sys.argv[1]
|
||||
die_if_sshOk = False
|
||||
|
||||
try:
|
||||
gw = inited_gw
|
||||
except NameError:
|
||||
gw = create_gateway(die_if_sshOk = True)
|
||||
gw = create_gateway(die_if_sshOk = die_if_sshOk, web_login = web_password)
|
||||
|
||||
ccode = gw.device_info["countrycode"]
|
||||
|
||||
|
||||
+5
-1
@@ -9,11 +9,15 @@ import requests
|
||||
import xmir_base
|
||||
from gateway import *
|
||||
|
||||
web_password = True
|
||||
if len(sys.argv) > 1 and sys.argv[0].endswith('connect6.py'):
|
||||
if sys.argv[1]:
|
||||
web_password = sys.argv[1]
|
||||
|
||||
try:
|
||||
gw = inited_gw
|
||||
except NameError:
|
||||
gw = create_gateway(die_if_sshOk = False)
|
||||
gw = create_gateway(die_if_sshOk = False, web_login = web_password)
|
||||
|
||||
|
||||
def exploit_1(cmd, api = 'API/misystem/arn_switch'):
|
||||
|
||||
@@ -1010,6 +1010,8 @@ def create_gateway(timeout = 4, die_if_sshOk = True, die_if_ftpOk = True, web_lo
|
||||
ccode = gw.device_info["countrycode"]
|
||||
print(f'CountryCode = {ccode}')
|
||||
if web_login:
|
||||
if isinstance(web_login, str):
|
||||
gw.webpassword = web_login
|
||||
gw.web_login()
|
||||
return gw
|
||||
|
||||
|
||||
Reference in New Issue
Block a user