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

detect unauthorized connections (cisco-led)

Discussion in 'Cisco/Linksys Wireless Routers' started by Pioneer, Sep 9, 2006.

  1. Pioneer

    Pioneer LI Guru Member

    hey guys!

    today i wrote a script for my wrt54gl that indicates with the amber-coloured cisco-led that there is a unauthorized access to my network.
    When there are only known mac-adresses connected, the cisco-led is white.
    i've to mention, that i've only 2 computers connected over w-lan otherwise the code would be much longer (for every mac-adress a new if-query ^^)

    here's the script:

    I=`nvram get wl0_ifname`
    while sleep 1; do
    if [ "`wl assoclist`" == "" ]; then
       LED="am of wh of"
       if [ "`wl assoclist`" == "assoclist [COLOR="Red"]XX:XX:XX:XX:XX:XX[/COLOR]" ]; then
          LED="am of wh on"
          if [ "`wl assoclist`" == "assoclist [COLOR="Red"]YY:YY:YY:YY:YY:YY[/COLOR]" ]; then
             LED="am of wh on"
             if [ "`wl assoclist`" == "assoclist [COLOR="Red"]XX:XX:XX:XX:XX:XX[/COLOR]
    assoclist [COLOR="Red"]YY:YY:YY:YY:YY:YY[/COLOR]" ]; then
                LED="am of wh on"
                if [ "`wl assoclist`" == "assoclist [COLOR="Red"]YY:YY:YY:YY:YY:YY[/COLOR]
    assoclist [COLOR="Red"]XX:XX:XX:XX:XX:XX[/COLOR]" ]; then
                   LED="am of wh on"
                   LED="am on wh of"
    if [ "$LED" != "$PLED" ]; then
    led $LED

    now my question is, is there a possibility to make the code more compact?
    does anyone have a suggestion for improvement?

    i hope you can help me!


    ps.: english isn't my first language so please excuse the mistakes, if existing ;)
  2. crawdaddy

    crawdaddy Network Guru Member

    Im not strong in coding, but I'm sure there's some way that you could take the MAC adresses and put them in a text file and then refrence the query to that, making the authorized mac addy line into 1 line for all mac adresses.
  3. Guyfromhe

    Guyfromhe Network Guru Member

    Why not turn on mac filtering and forget about the light?
  4. Pioneer

    Pioneer LI Guru Member

    @ crawdaddy: I'm a noob in coding too, so I've absolutely no idea how to realize that with the text-file :hmm:
    I would not even know how to upload the txt-file to the router ^^

    @ Guyfromhe: Yes that would be a possibility, but I got into my head, to realize it that way.
    You also have to know, that in my neighbourhood there aren't so much people who are able to crack a w-lan, but if there are some, I'll catch them :p
  5. RonWessels

    RonWessels Network Guru Member

    How about the following as the checking code?
    LED='am of wh of'
    for entry in `wl assoclist`
        case $entry in
        assoclist) ;;
        xx:xx:xx:xx:xx:xx) ;;
        yy:yy:yy:yy:yy:yy) ;;
        *) LED='am of wh on' ;;

Share This Page