1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin arris-tg3442: describe content of the base64 encoded cookie

The cookie content probably depends on the router model.
This commit is contained in:
Lars Kruse 2019-08-14 01:23:32 +02:00
parent 9b5dd9143a
commit 69602b1bbf

View file

@ -73,6 +73,19 @@ import sys
import os
"""
The CREDENTIAL_COOKIE below equals the following:
base64.encodebytes(b'{ "unique":"280oaPSLiF", "family":"852", "modelname":"TG2492LG-85", '
'"name":"technician", "tech":true, "moca":0, "wifi":5, "conType":"WAN", '
'"gwWan":"f", "DefPasswdChanged":"YES" }').decode()
"""
CREDENTIAL_COOKIE = """eyAidW5pcXVlIjoiMjgwb2FQU0xpRiIsICJmYW1pbHkiOiI4NTIiLCAibW9kZWxuYW1lIjoiVEcy
NDkyTEctODUiLCAibmFtZSI6InRlY2huaWNpYW4iLCAidGVjaCI6dHJ1ZSwgIm1vY2EiOjAsICJ3
aWZpIjo1LCAiY29uVHlwZSI6IldBTiIsICJnd1dhbiI6ImYiLCAiRGVmUGFzc3dkQ2hhbmdlZCI6
IllFUyIgfQ==
"""
def login(session, url, username, password):
"""login to """
# get login page
@ -139,13 +152,7 @@ def login(session, url, username, password):
"Referer": f"{url}/"
})
# set credentials cookie
session.cookies.set(
"credential",
"eyAidW5pcXVlIjoiMjgwb2FQU0xpRiIsICJmYW1pbHkiOiI4NTIiLCAibW9kZWxuYW1lIjoiV"
"EcyNDkyTEctODUiLCAibmFtZSI6InRlY2huaWNpYW4iLCAidGVjaCI6dHJ1ZSwgIm1vY2EiOj"
"AsICJ3aWZpIjo1LCAiY29uVHlwZSI6IldBTiIsICJnd1dhbiI6ImYiLCAiRGVmUGFzc3dkQ2h"
"hbmdlZCI6IllFUyIgfQ=="
)
session.cookies.set("credential", CREDENTIAL_COOKIE)
# set session
r = session.post(f"{url}/php/ajaxSet_Session.php")