#-------------------------------------------------------------------------------
# Name: PortScan
# Purpose: 扫描网段主机的端口开放情况
# Author: Hao Chen
# Python3.4
#-------------------------------------------------------------------------------
import socket
def main():
ip_start=input('请输入开始IP:(默认:127.0.0.1)')
if ip_start=='':
ip_start='127.0.0.1'
ip_end='127.0.0.1'
else:
ip_end=input('请输入结束IP:')
if ip_end=='':
ip_end='127.0.0.1'
s=input('请输入目标主机开始端口:(默认扫描常用端口)')
if s=='':
portList=[21, 22, 23, 25, 80, 135, 137, 139, 445, 1433, 1502, 3306, 3389, 8080, 9015]
else:
startport=int(s)
s=input('请输入目标主机结束端口:(默认:65535)')
if s=='':
endport=65535
基于Python socket的端口扫描程序
最新推荐文章于 2023-11-26 19:01:46 发布