In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
The script is as follows. You need to use IPy module and python-nmap module. After the script is executed, output the result to the screen in a csv document.
#! / usr/bin/env python3''' reference link https://blog.csdn.net/qq_36119192/article/details/83717690 usage: nmap_scan.py 192.168.0.0Universe 24 22Magi 3389 supports a single IP, network segment scanning format supports: 192.168.0.0Universe 24 192.168.0.024 the ports to be scanned are separated by commas using grep filter results grep-E'22 | 3389''''import sysimport nmapfrom IPy import IPif len (sys.argv)! = 3: print ("Parameter error, supported format: single IP Network segment in suffix or mask form ") exit (1) scan_ip = IP (sys.argv [1]) scan_port = sys.argv [2] # scan_ip.prefixlen () # transfer the network segment to the suffix form scan_ip =" {} ".format (scan_ip) for port in [int (I) for i in scan_port.split (", ")]: if port
< 1 or port >65535: print ("Port range 1-65535") exit (1) nm=nmap.PortScanner () nm.scan (scan_ip, scan_port,'-Pn') hosts = nm.all_hosts () for host in hosts: mac = nm [host] ["addresses"] .get ("mac") ") tcp = nm [host] [" tcp "] ports = nm [host] [" tcp "] .keys () ports_list = [] # ports_list_len = 0 for port in ports: if tcp [port] [" state "] = =" open ": ports_list.append (" {} ".format (port)) # ports_list_len + = 1 else: ports_list.append ("") # if ports_list_len! = 0 print # print ("{}) {}, {} ".format (host, mac,", ".join (ports_list)) print (" {}, {}, {} ".format (host, mac,", ".join (ports_list)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.