def portscanner(target_host,target_port,arguments="-T4 -A -v -Pn"):
"""
:param target_host:
:param target_port:
:return:
-sS ??SYN??????????????????????(?????,?????)
-T4 -T(0-5) ???3 4 ?Aggressive?????5?????????????????????5????????????????????1.5??
-A ?????????????????
"""
current_path = "%s/nmap_file/" % (os.getcwd())
if os.path.exists(current_path) == False:
os.mkdir("nmap_file")
arguments = arguments + " -oN %s%s" % (current_path,target_host)
if target_port == "" or target_port is None:
target_port = "1-65535"
scanner = nmap.PortScanner()
results = scanner.scan(hosts=target_host,ports=target_port,arguments=arguments,sudo=False)
# ???????????
return current_path+target_host,results
评论列表
文章目录