How to detect when known wireless devices join my wireless LAN in Linux

I am going to make a mobile device detector using a single-board computer (SBC) running on a Linux-based OS. SBC will have a wireless USB / 802.11 adapter. SBC is a DHCP server. The mobile device will connect to the wireless network (for example, ADX or infrastructure, it does not matter) SBC. When the mobile device joins the network, SBC will detect it. It will check the MAC address of the incoming mobile device with a set of received addresses. If there is a match, the SBC will execute the command.

I have basic Linux knowledge. I cannot write shell scripts, but I know C ++ / Qt. I don’t know where to start. Do you know the appropriate command line utilities or libraries for use in this project?

PS: Perhaps I only need a way to determine when the dhcp client list changes. Together with MAC address filtering, this can work.

+5
source share
2 answers

You can use nmapto open your network. Here you can find some examples.

Then you have to take it apart. For instance:.

while true; do
    nmap -v -sT 192.168.0.0/24 | fgrep "YOUR_SEARCHED_IP" && \
    echo BINGO "YOUR_SEARCHED_IP" IS IN THE 192.168.0.0/24 NETWORK
done  

And nmaphas an option -snto skip port checks.

Better yet, use ip neighbor showto view the IP address of your neighborhood network.

ping, :

for ip in $(seq 1 254); do 
    ping -c 1 192.168.1.$ip>/dev/null && \
    echo "192.168.1.$ip is UP"
done

nslookup, .

0

nmap IP, .

"" / , , , Airodump-. : , , , , , Ethernet , , .

0

All Articles