Python3 gadgets-combined with NMAP scan

Source: Internet
Author: User

I. Description of the tool

Call Nmap library for port scanning


Second, demonstrate the use of the effect

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8C/31/wKiom1hkumqAIUmwAASq5uUuz9s324.png "title=" Nmapscan.png "alt=" Wkiom1hkumqaiumwaasq5uuuz9s324.png "/>


Third, Code + Comments

Import nmapimport argparsedef nmapscan (Host, port):    #  Call Nmap's Portscanner class     nm = nmap. Portscanner ()     #  scan     results = nm.scan using the scan method ( Host, str (Port))     state = results[' Scan '][host][' tcp '][port][' state ']     print ("[+] {} tcp/{} {}". Format (host, port, state)) def  Main ():     parser = argparse. Argumentparser ()     parser.add_argument ('-h ',  dest= ' Host ',  help= "Host like:  192.168.3.1 ")     parser.add_argument ('-P ',  dest= ' Ports ',  nargs= ' + ',  type=int, help= "port like: 80 443 21")     args =  Parser.parse_args ()     host = args. Host    ports = args. Ports &nbSp;  for port in ports:        nmapscan (Host, Port) if __name__ ==  ' __main__ ':     main ()


This article is from the "Li Chunguang Technology blog" blog, make sure to keep this source http://lichunguang.blog.51cto.com/10274243/1887313

Python3 gadgets-combined with NMAP scan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.