Last active
February 28, 2025 10:15
-
-
Save cyanide-burnout/b6e0c0cab27116892f6aecb85e0f993e to your computer and use it in GitHub Desktop.
Automate switching Sagem F@ST DOCSIS modem to bridge mode on power cycling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:local password "password" | |
:global headers | |
:global header | |
:global cookie | |
:global index | |
:global data | |
:global key | |
:set data (([/tool fetch url=http://192.168.0.1/login.html output=user-with-headers as-value])->"data") | |
:set index [:find $data "var sessionkey = '"] | |
:set key [:pick $data ($index + 18) ($index + 64)] | |
:set key [:pick $key 0 [:find $key "';"]] | |
:set headers (([/tool fetch url="http://192.168.0.1/postlogin.cgi?sessionKey=$key" http-method=post http-data="loginUsername=admin&loginPassword=$password" output=user-with-headers as-value])->"http-headers") | |
:foreach header in=$headers do={ if ($header~"Set-Cookie: web_cookie=") do={ :set cookie [:pick $header 4 [:len $header]] } } | |
:set data (([/tool fetch url=http://192.168.0.1/reseau.html http-method=get http-header-field=$cookie output=user-with-headers as-value])->"data") | |
:set index [:find $data "var sessionkey = '"] | |
:set key [:pick $data ($index + 18) ($index + 64)] | |
:set key [:pick $key 0 [:find $key "';"]] | |
/tool fetch url="http://192.168.0.1/reseau-pa1-eRouterMode.cgi?sessionKey=$key" http-method=post http-data="PrimSecurity2GRadio=1" http-header-field=$cookie duration=10 output=none |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment