Navigation

    Netgate Discussion Forum
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    [SOLVED] Search through connected MAC addresses possible?

    General pfSense Questions
    2
    5
    826
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      konradwalsh last edited by

      Is something like this possible?

      The idea is that known MAC addresses are queryable and I can trigger a http call  to set a status bit

      I have searching all day.. trying to find appropriate script commands to do something similar..

      this is what works on DD-WRT

      #!/bin/sh
      # seconds between checks
      WATCHDOG_SLEEP_SEC=2
      # MAC Address 1
      MAC_ADDRESS_1="[XX:XX:XX:XX:XX:XX]"
      # MAC Address 2
      MAC_ADDRESS_2="[YY:YY:YY:YY:YY:YY]"
      # Vera VSwitch 1 Device ID
      VSWITCH_1="[99]"
      # Vera VSwitch 2 Device ID
      VSWITCH_2="[100]"
      
      #This loop will check if a device is registered on the AP and send the on/off command to vera. 
      
      while sleep $WATCHDOG_SLEEP_SEC
      do
      if wl assoclist | grep -Fq $MAC_ADDRESS_1
      then
          #echo Device 1 user is in
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_1&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=1"
      else
          #echo Device 1 user is out
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_1&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=0"
      fi
      
      if wl assoclist | grep -Fq $MAC_ADDRESS_2
      then
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_2&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=1"
      else
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_2&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=0"
      fi
      
      done
      &
      
      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned last edited by

        Look at /usr/local/www/status_wireless.php, modify that above accordingly, run from cron.

        1 Reply Last reply Reply Quote 0
        • K
          konradwalsh last edited by

          Hi
          thanks very much for looking at this..

          I should add.. I am really trying to look up any device is connected.. not just wireless devices..

          So far I am playing with things like arp lookup and  also trying to see if I can vary this command to get what I want …  ifconfig vtnet0 | grep ether

          i thought I might get something back from this command
          arp -na  | grep -Fq e8:5a:8b:b6:71:5c

          but my inexperience is showing

          1 Reply Last reply Reply Quote 0
          • D
            doktornotor Banned last edited by

            @konradwalsh:

            i thought I might get something back from this command
            arp -na  | grep -Fq e8:5a:8b:b6:71:5c

            but my inexperience is showing

            What's the problem with that? It works just fine - will return 0 on success, 1 on failure. You can see that with

            
            arp -na  | grep -Fq aa:bb:cc:ff:ee:ff; echo  $?
            
            

            arp -na  | grep -Fq is exactly what you need for the script as far as wired clients are concerned.

            1 Reply Last reply Reply Quote 0
            • K
              konradwalsh last edited by

              yes you are right… i didn't test that command thoroughly enough..

              thanks again

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Products

              • Platform Overview
              • TNSR
              • pfSense
              • Appliances

              Services

              • Training
              • Professional Services

              Support

              • Subscription Plans
              • Contact Support
              • Product Lifecycle
              • Documentation

              News

              • Media Coverage
              • Press
              • Events

              Resources

              • Blog
              • FAQ
              • Find a Partner
              • Resource Library
              • Security Information

              Company

              • About Us
              • Careers
              • Partners
              • Contact Us
              • Legal
              Our Mission

              We provide leading-edge network security at a fair price - regardless of organizational size or network sophistication. We believe that an open-source security model offers disruptive pricing along with the agility required to quickly address emerging threats.

              Subscribe to our Newsletter

              Product information, software announcements, and special offers. See our newsletter archive to sign up for future newsletters and to read past announcements.

              © 2021 Rubicon Communications, LLC | Privacy Policy