What's new

Tx/Rx Rate, in BusyBox

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

txcanuck

Occasional Visitor
Hi,

I have been hunting for this, pulling my hair out - and I'm sure there is an easy way to do it (I just can't find it :().

I'm trying to write a script that will allow me to capture data over SNMP (i.e. extend), and I just can't figure out how to get Tx and Rx rate (similar to the Wireless Log page), but directly in BusyBox -> so I can return it via SNMP (so it needs to be a shell / ash based approach).

Any pointers would be greatly appreciated!

Thanks!
 
The webui queries that information directly from the wireless driver, it's not available through the shell.
 
An elaborate hack for someone would be to allow webUI access without password briefly only from localhost.
Then wget and grep / sed away the rendered wireless log page content until the desired value is left.
But not me, I have my own projects to work on :D
 
The webui queries that information directly from the wireless driver, it's not available through the shell.

OK, that makes sense. Hmm ... I do see the asp function that provides the info, trying to figure out how to access that via curl and/or wget. Thanks!
 
Actually, I can see the page I need to get to (update_clients.asp). Just need to figure out how to provide the username + password in curl and/or wget.

Thanks!
 
Actually, I can see the page I need to get to (update_clients.asp). Just need to figure out how to provide the username + password in curl and/or wget.

There's no simple way to do so. Authentication is done via tokens, not via HTTP Basic Auth.

If you have a recent enough model, you can have a look at this script. I don't remember if it can poll client-related link info.

https://github.com/megalloid/bcmdhdscripts
 
Thanks! Yep, the script does run - and I can check some information via sta_info (I had missed that wl option ... my fault - too many of them!). It's not giving me the data rate though (that's the only one left for SNMP, I have all the rest working :)).

Will keep digging, and will also see if there is a way to get a token - to get that asp (page) info.

Thanks again.
 
OK, seems what I am after is inside,
#define NMP_CACHE_FILE "/tmp/nmp_cache.js"

Just need to figure out how to force this file to refresh (vs. manually going to the Wireless Log, which does refresh this file as well).
 
Hi,

FYI, to hopefully help others, was able to use curl to log in (figured this out from WireShark),
curl --location --request POST 'http://localhost/login.cgi' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'login_authorization=(base64, user:password)' \
--data-urlencode 'current_page=Main_Login.asp' \
--data-urlencode 'next_page=index.asp' \
--data-urlencode 'action_wait=5' \
--referer 'http://localhost/Main_Login.asp' \
--cookie-jar /tmp/cookie.txt

Then, with the resulting cookie (asus_token),
curl --request GET 'http://localhost/client_function.js' --cookie /tmp/cookie.txt > /dev/null 2>&1

/tmp/nmp_cache.js is updated and current!
 
Hi,

FYI, to hopefully help others, was able to use curl to log in (figured this out from WireShark),
curl --location --request POST 'http://localhost/login.cgi' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'login_authorization=(base64, user:password)' \
--data-urlencode 'current_page=Main_Login.asp' \
--data-urlencode 'next_page=index.asp' \
--data-urlencode 'action_wait=5' \
--referer 'http://localhost/Main_Login.asp' \
--cookie-jar /tmp/cookie.txt

Then, with the resulting cookie (asus_token),
curl --request GET 'http://localhost/client_function.js' --cookie /tmp/cookie.txt > /dev/null 2>&1

/tmp/nmp_cache.js is updated and current!
Nice find! curl/urlencode seemed to choke on my password, so I modified it to use openssl to do the base64 encoding:

Code:
"$(printf 'username:password' | openssl base64)"
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top