BaSH and NMap to list all devices connected to a guest wi-fi network

Monitoring your network resources and infrastructure effectively requires planning, knowledge of the metrics and experience of how to set up the threshold for warning and critical alarms and a lot of testing.

It’s very hard to focus on signals where there is too much noise.

Usually the tool you’re using doesn’t matter so much, what it’s really important what to implement more than how. And even if the configuration and the design are different we should be able to achieve similar results.

In this example I use a very popular tool such NMAP and with BaSH create a plain text report of a guest wi-fi network that sometime I want to generate.

The script uses nmap with a subnet and -sL: List Scan which simply list targets to scan

Using grep and -v with a Regular Expression it suppress the IP scanned that have no hostname

replace remove the unwanted text

or even better with sed

and tee creates an output file from all input passed from the previous commands. I’ve added a couple of variable to edit the subnet and the report name.

This is the final script also available on github:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.