1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Script] Wireless Active light minus Network Printer

Discussion in 'Tomato Firmware' started by yaqui, Aug 29, 2007.

  1. yaqui

    yaqui LI Guru Member

    I made this script to just light up the SES light solid when there is activity and ommit sensing any traffic from wireless network printer. It allows you to quickly see if there is some wireless client traffic happening.
    Notes:
    ## Enter your network printer's MAC address where you see the "<your wireless printer mac here>"
    ## Checks for wireless activity other than wireless network printer
    ## Every 1 min it will compare <eth1> byte difference from a 30 sec wait period
    ## and turns on SES amber light if true
    Code:
    ## Wireless Conn Notice
    wlnote='/tmp/wlnote.sh'
    if [ ! -x $wlnote ] ; then
       cat > $wlnote <<EOF
    #!/bin/sh
    minusp=
    xfer=
    pxfer=
    msgs=
    lmsgs=
    minusp=$(wl assoclist | grep -v <your wireless printer mac here>)
    if [ -n "$minusp" ] ; then
       xfer=$(ifconfig eth1|grep bytes|cut -d":" -f2|cut -d" " -f1)
       sleep 30
       pxfer=$(ifconfig eth1|grep bytes|cut -d":" -f2|cut -d" " -f1)
       if [ "$xfer" -ne "$pxfer" ] ; then
          led amber on white off
          lmsgs=$(grep -c Amber /tmp/var/log/messages)
          if [ "$lmsgs" -le "25" ] ; then
             logger Wireless activity detected Amber light ON
          fi
       fi
    else
    led amber off white off
    fi
    msgs=$(grep -c wlnote /tmp/var/log/messages)
    if [ "$msgs" -le "15" ] ; then
    logger wlnote cron executed
    fi
    EOF
    fi
    chmod 777 $wlnote
    cru a wlnote "*/1 * * * * $wlnote"
     
  2. kameleon

    kameleon LI Guru Member

    So theoretically you could use this script to see if there is any unauthorized usage period. Could one not input all known wireless MAC addresses in the script. Then if someone tried to access it it would catch it. Or am I way off?
     
  3. yaqui

    yaqui LI Guru Member

    Yes, just grep -v all your known MAC addresses. That is a good idea to quickly see, I may do that. Thanks :)

    Here just fill in your authorized MAC's for auth1 , auth2 etc... it will check output of wl assoclist every 2 minutes.

    Wireless warning script can be found here: http://www.linksysinfo.org/forums/showthread.php?t=54371
     
  4. HennieM

    HennieM Network Guru Member

    Cool script.

    @kameleon: If you go to the trouble of typing all authorized MACs in the script, a better measure may be _preventing_ any unauthorized access by specifying the authorized MACs in the "allowed" MAC list.
     
  5. yaqui

    yaqui LI Guru Member

    All of that really doesn't matter, seeing how MAC's can be easily spoofed. ;) But I guess it is nice to have yet.
     
  6. danix71

    danix71 LI Guru Member

    How should I make the SES button to light when activity (connected to the router), but the GL is client ?

    LE: I think I've found smth here.
     
  7. danix71

    danix71 LI Guru Member

    For a WRT54GL+Tomato used as a bridge (with a connection with the gateway, an exact-same GL with Tomato 1.19)...what script do you suggest to use?
    I just want the SES to light (white) when a connection with the router exists or (pinging the router successfull??). Or better...the bridge (second GL) ''knows'' that a Internet connection (on the router, the first GL) exists...then light the SES.
    Can be done?
    Thank you!
     
  8. danix71

    danix71 LI Guru Member

    Nobody?
     
  9. yaqui

    yaqui LI Guru Member


    One might say do a test to ping a site for the internet connection "up" and light the SES. The problem with that lays in how *often* to you want to perform the "pinging test" to shut off the light when -no- internet connection exists.

    A better test may be to check the status of the router for the connection status.
    Possibly just keep grepping tmp/var/log/messages for the word "disconnected" at a certain interval...
     
  10. danix71

    danix71 LI Guru Member

    Yeah, I've sticked with this script and it's oke... :)
     

Share This Page