扫描端口使用情况,扫描端口情况,#!/usr/bin/e


#!/usr/bin/env pythonfrom socket import * if __name__ == '__main__':    target = raw_input('Enter host to scan: ')    targetIP = gethostbyname(target)    print 'Starting scan on host ', targetIP    #scan reserved ports    for i in range(20, 1025):        s = socket(AF_INET, SOCK_STREAM)        result = s.connect_ex((targetIP, i))        if(result == 0) :            print 'Port %d: OPEN' % (i,)        s.close()/*~$ ./scanner.pyEnter host to scan: localhostStarting scan on host  127.0.0.1Port 22: OPENPort 80: OPENPort 139: OPENPort 445: OPENPort 631: OPEN*/

评论关闭