In import port_scanner In scanner port_scanner Scanner 192 168 timeout

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
In [1]: import port_scanner
In [2]: scanner=port_scanner.Scanner('192.168.1.3',timeout=1)
In [3]: %time opened,closed=scanner.scan(*xrange(1,65536))
CPU times: user 16.40 s, sys: 8.64 s, total: 25.04 s
Wall time: 27.37 s
In [5]: opened
Out[5]: [21, 53, 22, 80, 139, 445, 443, 901]
In [6]: %time opened,closed,unknown=scanner.slow_scan(*xrange(1,65536))
CPU times: user 148.20 s, sys: 9.11 s, total: 157.31 s
Wall time: 177.00 s
In [8]: unknown
Out[8]: []