#用法如下:
python expoc.py 192.168.1.1
import socket
import threading
import sys
try:
def ip_scan(ip,port):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
socket.setdefaulttimeout(1)
result=s.connect_ex((ip,port))
if result == 0:
print("[*] Port {} is open".format(port))
elif result != 0:
print("[*] Port {} is close".format(port))
except socket.error as e:
print(f'error: {e}')
pass
for port in [80,21,22,23,25,53,110,443,1433,1863,2289,3306,5631,5632,5000,8080,9090]:
T = threading.Thread(target=ip_scan,args=(sys.argv[1],port))
T.start()