The above Python code can be changed to scan multiple hosts instead of one single host, just with an alteration to the line that begins scan_range and adding a space in between each host. Using Python To Scan Multiple Hosts Multiple Individual Hosts nmap scan results Īs can be seen from the returned JSON, nmap managed to see 192.168.0.28, could tell the device was up, that port 22 (SSH) was open, the type of SSH in use (OpenSSH) and the operating system (Raspbian) in use. The results from the scan will be outputted in JSON format. Note: nmap can take a few minutes to scan an individual host depending on the options given to it. #!/usr/bin/python3 # geektechstuff nmap import nmap nm = nmap.PortScanner() scan_range = nm.scan(hosts= "192.168.0.28" ) print (scan_range) Using nmap in Python to scan a host Using Python To Scan A Single Hostįor my first Python script I am going to scan a Raspberry Pi that is on IP address 192.168.0.28. pip3 uninstall nmap to uninstall the library. If you install the wrong library via pip3, then use pip3 uninstall library_name, e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |