Sitecom WL-340 shell commands via HTTP

posted 2010-04-18 17:40:26, link to this article

My local Media Markt (a large German chain of electronics stores) had some cheap NAT routers for sale. Out of curiosity I bought one.
This router (the Sitecom WL-340) runs Linux and the internal console port is nicely labeled and that alone made me buy two more as you can never have too much hardware to play with. ;)

When poking around in these boxes I found that they have a nice hidden web page to run commands on these boxes.
You can access this page as /system_command.htm on your routers webinterface.

I thought it might be useful to access this command shell from scripts, so that you can use stock WL-340s for various "unintended" purposes. ;)
With the help of the amazing Firebug extension for Firefox I managed to use the remote command facility of these routers from the shell.
Like so:

hessch@kirchhoff:~$ curl -s -o- -u admin -d command='cat /proc/cpuinfo' \
	-d next_file=system_command.htm -d todo=system_command \
	http://192.168.11.128:8080/setup.cgi | \
		sed -n '/outlog_Display/,/\/textarea/{/textarea/d;p}'
Enter host password for user 'admin':
system type		: Ralink SoC
processor		: 0
cpu model		: MIPS 24K V4.12
BogoMIPS		: 212.99
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 32
extra interrupt vector	: yes
hardware watchpoint	: yes
ASEs implemented	: mips16 dsp
VCED exceptions		: not available
VCEI exceptions		: not available

Now, this only needs a small wrapper shell script and it's ready for (ab)use.
I'll probably post some more hacks based on these boxes later on.