Windows安装 https://www.python.org/downloads/windows/ 下载安装即可。
运行脚本命令: Python 文件名.py IP地址
import socket
import argparse
import sys
import time
parser = argparse.ArgumentParser()
parser.add_argument('host')
args = parser.parse_args()
start = time.time()
try:
for port in range(1, 65536):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
result = sock.connect_ex((args.host, port))
if result == 0:
print("Port: {} Open".format(port))
sock.close()
except KeyboardInterrupt:
sys.exit()
end = time.time()
print(f"Scanning completed in: {end-start:.3f}s")
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容