So I turned to netcat. But that didn't work! For some reason, I could mangle a connection, but no input was submitted during telnet communication.
Well, after fighting with this for a few hours, I decided to build netcat from source http://netcat.sourceforge.net/
And I finally got it to work. I use Linux Mint on my notebook, so it turns out the supplied netcat (or/and) nc doesn't work right with whatever Debian/Ubuntu guys have done to it.
Anyway, if anybody has one of these routers, here is my script to get the stats. One caveat is that for some reason when you telnet into the router and issue a 'logout' command, you logout but the telnet session is held open. Even control-c doesn't kill it (you just get the login prompt again) - you have to go to another terminal and kill the telnet process (if anybody knows why, please let me know).
The box is running:
BusyBox v1.19.2 (2012-10-11 17:43:44 CST) multi-call binary. Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko and others. Licensed under GPLv2. See source distribution for full notice.
Here is the script:
1 23 45 67
#!/bin/bash echo -e "USERNAME\nPASSWORD\nadsl show info\nlogout\n" | netcat ROUTERIP 23 -n -w 3 -i 1 > stats.txt &sleep 3; killall netcat;cat ./stats.txt | grep CurrRate | sed 's/[^0-9]//g' | tr '\n' ':' >> ./noise.txt; cat ./stats.txt | grep Noise | sed 's/[^0-9]//g' | tr '\n' ':' >> ./noise.txt;date +"%H:%M" >> ./noise.txt;
Replace USERNAME, PASSWORD and ROUTERIP with what should be correct for your set up.
The stats get dumped to 'stats.txt' then processed into a file (I called) noise.txt. The sleep value may need to be adjusted depending on the speed of communication on your network - a value of 3 works for me, but a value of 2 doesn't. Notice the 'killall netcat'... this is required to end the connection!
Here is sample output of noise.txt (Upstream:Downstream:Up SNR Margin (*10):Down SNR Margin(*10):TIME
1048:4543:91:127:15:50 1048:4543:91:126:15:51 1048:4543:92:126:15:52 1048:4543:90:127:15:53 1048:4543:91:128:15:54 1048:4543:91:126:15:55 1048:4543:91:129:15:56 1048:4543:92:128:15:57 1048:4543:91:129:15:58 1048:4543:91:129:15:59 1048:4543:91:128:16:00 1048:4543:91:128:16:01 1048:4543:91:128:16:02 1048:4543:91:128:16:03 1048:4543:90:128:16:04 1048:4543:91:128:16:05 1048:4543:89:128:16:06 1048:4543:90:124:16:07 1048:4543:91:127:16:08 1048:4543:91:129:16:09 1048:4543:91:127:16:10
Hope this helps somebody.
Edited by Lethe (Mon 25-Feb-13 16:40:41)