In this section we review the scan modes supported in the python-nmap module. python-nmap allows for the automation of port scanner tasks and reports in two modes: synchronous and asynchronous. With the asynchronous mode, we can define a callback function that will execute when a scan is finished in a specific port and, in this function, we can make additional treatments if the port is opened, such as launching an Nmap script for a specific service (HTTP, FTP, MySQL).
Scan modes with python-nmap
Synchronous scanning
In this example, we implemented a class that allows us to scan an IP address and a list of ports that are passed to the script as a parameter.
In the main program, we add the necessary configuration for the treatment...