I am going to make mobile device detector using a single board computer (SBC) running a Linux based OS. The SBC will have a USB/802.11 wireless adaptor. The SBC will be a DHCP server. The mobile device will join the wireless network (adhoc or infrastructure, it doesn't matter) of the SBC. When the mobile device joins the network, the SBC will detect it. It will check the MAC address of the incoming mobile device with a set of accepted addresses. If there is a match, the SBC will execute a command.
I have basic Linux knowledge. I can't write shell scripts but I know C++/Qt. I don't know where to start. Do you know relevant command line utilities or libraries to use in this project?
P.S: Maybe I only need a way to detect when dhcp client list changes. Together with mac address filtering, this may work.
You can use nmap
to discover your network. Here you can find some examples.
Then you should parse it's output. E.g.:
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 nmap
has an -sn
option to skip the port checks.
Even better you can use ip neighbor show
to see your neighborhood networks IP address.
Or you can use a simple ping
test, like:
for ip in $(seq 1 254); do
ping -c 1 192.168.1.$ip>/dev/null && \
echo “192.168.1.$ip is UP"
done
And you can combine it with nslookup
to see the hostnames.