mirror of
https://github.com/openwrt-xiaomi/xmir-patcher.git
synced 2026-09-22 22:57:55 +03:00
connect5: Increase connect timeout to 7 sec
This commit is contained in:
@@ -75,14 +75,18 @@ def exec_smart_cmd(cmd, timeout = 7, api = 'API/xqsmarthome/request_smartcontrol
|
|||||||
# reg_code: CVE-2023-26319
|
# reg_code: CVE-2023-26319
|
||||||
# publication: https://blog.thalium.re/posts/rooting-xiaomi-wifi-routers/
|
# publication: https://blog.thalium.re/posts/rooting-xiaomi-wifi-routers/
|
||||||
######
|
######
|
||||||
|
saved_con_timeout = gw.con_timeout
|
||||||
|
gw.con_timeout = timeout
|
||||||
sc_command = cmd['command']
|
sc_command = cmd['command']
|
||||||
payload = json.dumps(cmd, separators = (',', ':'))
|
payload = json.dumps(cmd, separators = (',', ':'))
|
||||||
try:
|
try:
|
||||||
data = { "payload": payload }
|
data = { "payload": payload }
|
||||||
res = gw.api_request(api, data, resp = 'text', post = 'x-www-form', timeout = timeout)
|
res = gw.api_request(api, data, resp = 'text', post = 'x-www-form', timeout = timeout)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
gw.con_timeout = saved_con_timeout
|
||||||
msg = getattr(e, 'message', str(e))
|
msg = getattr(e, 'message', str(e))
|
||||||
raise ExploitError(f'Cannot send POST-request "{sc_command}" to SmartController service. {msg}')
|
raise ExploitError(f'Cannot send POST-request "{sc_command}" to SmartController service. {msg}')
|
||||||
|
gw.con_timeout = saved_con_timeout
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def exec_smart_command(cmd, timeout = 7, ignore_err_code = 0):
|
def exec_smart_command(cmd, timeout = 7, ignore_err_code = 0):
|
||||||
|
|||||||
Reference in New Issue
Block a user