
Single-file dependency-free Python port scanner with multithreaded TCP/UDP scanning, banner grabbing, HTTP title extraction, NBNS hostname lookup, and basic checks for Redis and MS17-010.
单文件无依赖Python端口扫描脚本,支持一些简单漏洞的探测
It's convenient to run it on a Webshell, but it might be a bit noisy; you can first run a round with the U parameter (NBNS)
Competitions and the like don't matter
By default, both TCP and UDP are run
Default ports: 21-23,25,80,81,110,135,137,139,445,873,1433,1521,3306,3389,6379,7001,8000,8069,8080-8090,9000,9001,10051,11211
You can add UDP ones yourself
Drawback: one thread per IP, so it can't be terminated with KeyboardInterrupt; will change it to use a queue when I have time
Changed to use a queue, so Keyboardinterrupt can be used Also fixed the encoding issue on port 445 Updated the NBNS parsing method (may not be reliable)
Fixed the decode() pitfall in Python 2.6 and some miscellaneous encoding issues (may not be fully fixed)
Also, optparse is used to parse the input; this library is also included with Python 2.6~
python scan.py ip [-o nt] [-p 80,81-85,...]
ip can be a single IP, a CIDR, or a form like 192.168.0.0-255 -o option: n means use NBNS to probe hostnames, t means probe TCP ports; the default is to probe both -p specifies the TCP ports
python scan.py 10.19.38.0/24
Scans the default ports of 10.19.38.0/24 and retrieves hostnames
python scan.py 10.19.38.0/24 -o n
Retrieves the hostnames of 10.19.38.0/24 without scanning TCP ports
python scan.py 10.19.38.0/24 -p 22,23-25
Scans TCP ports 22,23,24,25 of 10.19.38.0/24 and retrieves hostnames
[*]202.115.*.*
21 220 MikroTik FTP server (MikroTik 5.20) ready\r\n
22 SSH-2.0-ROSSSH\r\n
23 #'
80 HTTP/1.1 200 OK Title: RouterOS router configuration page
445 +Vulnerable+ MS 17-010 Windows 7 Professional 7601 Service Pack 1|Windows 7 Professional 6.1|