From 69602b1bbf80c4376ce35cf2b5b4532193379205 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 14 Aug 2019 01:23:32 +0200 Subject: [PATCH] Plugin arris-tg3442: describe content of the base64 encoded cookie The cookie content probably depends on the router model. --- plugins/router/arris-tg3442 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/router/arris-tg3442 b/plugins/router/arris-tg3442 index 088b50e5..4f696888 100755 --- a/plugins/router/arris-tg3442 +++ b/plugins/router/arris-tg3442 @@ -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")