first commit

This commit is contained in:
2019-02-18 01:29:38 -06:00
commit c957a948f4
10 changed files with 204 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import sys
import nmap
# initialize the port scanner
nmScan = nmap.PortScanner()
# scan localhost for ports in range 21-443
nmScan.scan('127.0.0.1', '21-443')
# run a loop to print all the found result about the ports
for host in nmScan.all_hosts():
sys.stdout.write("{};{};{};".format(host, nmScan[host].hostname(), nmScan[host].state()) )
for proto in nmScan[host].all_protocols():
sys.stdout.write("{};".format(proto))
lport = nmScan[host][proto].keys()
lport = sorted(lport)
for port in lport:
sys.stdout.write("{};{};".format(port, nmScan[host][proto][port]['state']))
sys.stdout.write("\n")