Commandline tools for WRT54G3G

jerith

Member
Joined
Dec 19, 2006
Messages
10
Reaction score
0
Location
Cape Town
I finally got annoyed enough with having to start up firefox just to tell my 3g router to connect or disconnect that I spent some time trawling through the javascript and tcpdumps to figure out how to tell the thing to connect and disconnect. The following will only work on Linux (and other suitably Posixy) systems, although it shouldn't be hard to find something equivalent for Windows.

wrtconnect.sh:
Code:
#!/bin/bash
read -s -p "Please enter your router password: " WRTPWD
curl -o /dev/null -# -d submit_button=index -d change_action=gozila_cgi -d submit_type=Connect_wwan http://admin:${WRTPWD}@10.0.0.1/apply.cgi

wrtdisconnect.sh:
Code:
#!/bin/bash
read -s -p "Please enter your router password: " WRTPWD
curl -o /dev/null -# -d submit_button=index -d change_action=gozila_cgi -d submit_type=Disconnect_wwan http://admin:${WRTPWD}@10.0.0.1/apply.cgi

If you don't want to type your password in every time, you can replace the "read ... WRTPWD" line with:
Code:
WRTPWD=yourpassword

It's not perfect, although I suspect the limitations are on the server side. After calling one of the scripts, the web insterface will be unresponsive for several seconds. I hope someone else out there finds this as useful as I do.
 
The 2.01.02 firmware update I've just applied broke the connect script, but seems to have made rebooting through the web interface pick up 3g signal again. Here are the next versions of the scripts, plus an additional reboot script:

wrtconnect.sh:
Code:
#!/bin/bash
read -s -p "Please enter your password: " WRTPWD
curl -o /dev/null -# -d 'submit_button=index&change_action=gozila_cgi&submit_type=Connect_wwan&next_page=index_wstatus2.asp' http://admin:${WRTPWD}@10.0.0.1/apply.cgi

wrtdisconnect.sh:
Code:
#!/bin/bash
read -s -p "Please enter your password: " WRTPWD
curl -o /dev/null -# -d 'submit_button=index&change_action=gozila_cgi&submit_type=Connect_wwan' http://admin:${WRTPWD}@10.0.0.1/apply.cgi

wrtreboot.sh:
Code:
#!/bin/bash
read -s -p "Please enter your password: " WRTPWD
curl -o /dev/null -# -d 'submit_button=Diagnostics&change_action=&action=Reboot&wait_time=42' http://admin:${WRTPWD}@10.0.0.1/apply.cgi
 
Top
Sign up to the MyBroadband newsletter
X