-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
Description
is this normal when doing post and servers responds chunked?
def get_router_data(ip, session, token):
url = f"http://{ip}/cgi?1&1&1&1&8"
headers = {
"Content-Type": "text/plain",
"Cookie": f"JSESSIONID={session}",
"Referer": f"http://{ip}/",
"TokenID": token,
"Connection": "close", # Força o servidor a não usar keep-alive
"HTTP_VERSION": "1.0" # Tenta forçar HTTP/1.0 que não tem chunked
}
data = "[IGD_DEV_INFO#0,0,0,0,0,0#0,0,0,0,0,0]0,4\r\nmodelName\r\ndescription\r\nX_TP_IsFD\r\nX_TP_IsBeta\r\n[ETH_SWITCH#0,0,0,0,0,0#0,0,0,0,0,0]1,1\r\nnumberOfVirtualPorts\r\n[SYS_MODE#0,0,0,0,0,0#0,0,0,0,0,0]2,1\r\nmode\r\n[MULTIMODE#0,0,0,0,0,0#0,0,0,0,0,0]3,0\r\n[/cgi/info#0,0,0,0,0,0#0,0,0,0,0,0]4,0\r\n"
data = "oi"
try:
requests.request("POST", url, headers=headers, data=data)
print("=== GET_ROUTER_DATA DEBUG ===")
print(f"Status Code: {response.status_code}")
print(f"Response Headers: {dict(response.headers)}")
print(f"Text: {response.text}")
print("==============================")
#return response
except Exception as e:
print(f"Erro: {e}")
return None