Skip to content

Instantly share code, notes, and snippets.

@milankragujevic
Created May 27, 2022 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milankragujevic/ad3fedb5559b30fa4f7f165001611ce8 to your computer and use it in GitHub Desktop.
Save milankragujevic/ad3fedb5559b30fa4f7f165001611ce8 to your computer and use it in GitHub Desktop.
Reboot CGA2121 modem via Web UI
#!/bin/bash
SEC=$(curl -s -v 'http://192.168.0.1/goform/logon' -H 'Content-Type: application/x-www-form-urlencoded' --data-raw 'username_login=&password_login=&language_selector=en' --insecure 2>&1 | grep 'Set-Cookie' | cut -d '=' -f 2 | cut -d ';' -f 1)
CSRF=$(curl -s 'http://192.168.0.1/ad_restart_gateway.html' -H "Cookie: sec=${SEC}" --insecure | grep csrftoken | cut -d '"' -f 6)
curl -s 'http://192.168.0.1/goform/ad_restart_gateway' -H "Cookie: sec=${SEC}" --data-raw "csrftoken=${CSRF}&tch_devicerestart=0x00" --insecure >/dev/null 2>&1
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment