python扫描指定服务器的端口
#!/usr/bin/python3 # -*- coding: utf-8 -*- from socket import * def portScanner(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,10024): portScanner('nat.72wo.com',p) if __name__ == '__main__': main()