Hourly Network Scan with Bash

The following goes over how to create a network scanner using bash and set it to run every hour to search for new devices on the network.


1. For this example, I'm going to use the nano text editor to build the bash script.

nanocreate.png

2. The script starts with specifying the variables and network to scan data in the form of strings.

Then run the nmap command to extract the active IP addresses. From there are couple of conditional statements will run and then copy the temp device directory to the scan log.

network_scan.png

3. I'll save the script and make it executable.

chmod.png

4. Then concatenate the contents of the script.

concatenated.png

5. Test out the script.

FirstExecution.png"

6. Concatenate scan data.

cat2.png

7. Setup the script to run as a cronjob for hourly scans.

crontab.png crontab-e.png
Back to Home