Can Execute command on detection pass parameters

2 posts · Closed

David Guest
3 Mar 2020

In Advanced Settings, I see a feature named "Execute command on detection". Can this pass parameters as well?

Ideally, I would like to launch an nmap scan of any device that is unrecognized, and I hope that I can pass the device's IP address to nmap so I could do such a scan. I would imagine that the command would be something like this:

C:\Program Files (x86)\Nmap\nmap.exe -v -A -oX "C:\reports\%ip_addr%.xml" %ip_addr%
Ann SoftPerfect
3 Mar 2020

The command is invoked once per detection, which may contain multiple IP addresses.

What you could do instead, is to extract IP addresses directly from the database and feed them into nmap:

  1. Download SQLite command line tools from SQLite site.
  2. Extract sqlite3.exe and place it in a folder.
  3. Extract and place this .cmd script file into the same folder.
  4. Edit the file as needed and specify it to be launched from WiFi Guard.

The script will extract all last seen IP addresses, save them to a file, and then run an nmap scan against them.

Script code:

sqlite3 WiFiGuard.DB "SELECT ACTIVITY.IPADDR FROM DEVICE JOIN ACTIVITY ON DEVICE.HWADDR = ACTIVITY.HWADDR WHERE DEVICE.KNOWN = 0 AND ACTIVITY.DAY = CURRENT_DATE" > ips.txt
nmap.exe -v -A -oX report.xml -iL ips.txt
This topic is closed. It has had no new posts for over a year, so the software versions it talks about may be out of date. Start a new topic in WiFi Guard if you have a similar question.