简单化,知道IP去扫描ip
import socket from socket import * a=input(‘请输入域名:‘) try: ip=gethostbyname(a) print(‘[+]‘+ip) print(‘开放的端口有:‘) def postscanner(host,port): try: s=socket(AF_INET,SOCK_STREAM) s.connect((host,port)) print(‘[+]%d open‘%port) s.close() except: pass def main(): setdefaulttimeout(1) for p in range(1,1024): postscanner(‘14.215.177.38‘,p) except Exception as e: print(e) if __name__ == ‘__main__‘: main()
时间: 2024-10-10 03:06:02