Module Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias TryExcept body ImportFrom alias alias handlers ExceptHandler type NameLoad body Print BinOpAdd Str Str Expr Call AttributeLoad NameLoad attr ImportFrom alias Assign NameStore Str Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr keyword Str keyword Num keyword Num keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Str TryExcept body Assign NameStore ListComp Call NameLoad NameLoad comprehension NameStore NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Str FunctionDef arguments args NameParam defaults body Print Str If AttributeLoad NameLoad attr body Print NameLoad orelse Print BinOpMod Str Call AttributeLoad NameLoad attr Print Str decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore NameLoad FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Num Num body Assign AttributeStore NameLoad attr NameLoad AugAssignAdd SubscriptStore NameLoad Index Num Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Dict Str Str Dict Dict decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr FunctionDef arguments args defaults body For NameStore AttributeLoad NameLoad attr body For NameStore Call NameLoad AttributeLoad NameLoad attr body Expr Yield Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Assign NameStore Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr ListComp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore Call NameLoad AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad If AttributeLoad NameLoad attr body Print BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body If BoolOpOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Print BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr NameLoad ListLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Str attr NameLoad ListLoad Assign NameStore TupleLoad NameLoad Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr If NameLoad body Print Str orelse Print Str For TupleStore NameStore NameStore NameLoad body Print BinOpMod Str NameLoad For NameStore NameLoad body Print BinOpMod Str NameLoad Assign NameStore Dict Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr For TupleStore NameStore NameStore NameLoad body For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Num AugAssignAdd SubscriptStore NameLoad Index NameLoad Num If BoolOpAnd NameLoad BoolOpOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Print Str For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Print BinOpMod Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Str If UnaryOpNot Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr If NameLoad body Print Str For TupleStore NameStore NameStore NameLoad body Assign NameStore SubscriptLoad Call NameLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad If Call AttributeLoad NameLoad attr body Continue Print BinOpMod Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr ListComp Call NameLoad NameLoad comprehension NameStore NameLoad Assign NameStore BinOpMod NameLoad TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index Str decorator_list FunctionDef arguments args NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index Str decorator_list decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad ListComp Call NameLoad NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Str Call NameLoad NameLoad Assign NameStore Call NameLoad Str NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Print BinOpMod Str TupleLoad NameLoad NameLoad For NameStore NameLoad body Print BinOpMod Str NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A sys socket gethostbyaddr optparse OptionParser twisted.internet task twisted.internet defer twisted.internet reactor twisted.internet.protocol Protocol twisted.internet.protocol ClientFactory twisted.python.filepath FilePath N/A N/A netcidr CIDR Networks N/A N/A N/A ImportError N/A N/A N/A 
You must have NetCIDR installed for your version of python  in order to run this tool. N/A N/A N/A sys exit pymon.utils getSimplePlural N/A usage %prog [options] netBlock[,netBlock2[,...]] startPort,endPort

You need to pass the CIDR block(s) that define the network(s)
you want to scan as well as the port range to be scanned for
each host. The port range must be two comma-separated integers.
For example:
    %prog [options] 192.168.4.0/24 1,8080
    %prog [options] 172.16.0.0/16,172.29.13.0/24,10.1.24.0/26 21,1024


There are two parameters that control the rate at which the connections to
servers are made: batchSize and timeout. However, all parameters affect the
number of files opened in your os: with enough hosts and ports, a large batch
size and a small timeout, you could easily max out the number of open files on
your system. Please keep that in mind.

I have found that for hosts over a good internet connection, a timeout of 1
second usually gives enough time to make a connection. However, this can take
quite a while with a large number of ports per host. I have found the following
works well in general for internet discovery:
  %prog --batchSize=100 --timeout=1 1.2.3.4/24 1,1000
On my machine, that takes about 12 seconds.

For local networks, however, we don't have to worry so much about latency.
Connections are made and closed more quickly, leaving fewer open files in a
smaller period of time. Scanning large network blocks can go very quickly. I've
found the following works well on my corporate network:
  %prog --batchSize=200 --timeout=0.1 10.2.3.4/24 1,10000
 N/A optp N/A OptionParser usage usage N/A N/A N/A optp set_defaults ports 1,1000 batchSize 100 timeout 0.1 verbose False spew False debug False N/A N/A N/A optp add_option -s --batchSize dest batchSize N/A N/A N/A optp add_option -t --timeout dest timeout N/A N/A N/A optp add_option -v --verbose dest verbose action store_true N/A N/A N/A optp add_option -p --spew dest spew action store_true N/A N/A N/A optp add_option -d --debug dest debug action store_true N/A N/A opts args N/A N/A optp parse_args N/A N/A N/A len args 2 N/A N/A N/A N/A optp error You must pass at lease a netblock and a range of ports. N/A blocks N/A N/A N/A args N/A 0 split , N/A ports N/A N/A N/A args N/A 1 split , N/A N/A N/A len ports 2 N/A N/A N/A N/A optp error You must provide two ports in the port range. N/A N/A N/A ports N/A N/A int x N/A x ports N/A N/A N/A ValueError N/A N/A N/A N/A optp error Ports must be integers. N/A TCPPingServiceConfigTemplate 
<ping-tcp-check>
    uri     %s
    ports   %s
    enabled true
</ping-tcp-check>
 printError N/A N/A err N/A N/A N/A 
Error:
 N/A N/A opts debug N/A N/A err N/A N/A N/A 	%s N/A N/A err getErrorMessage N/A N/A ScanProtocol N/A Protocol N/A connectionMade N/A N/A self N/A N/A N/A N/A N/A N/A N/A self factory deferred callback success N/A N/A N/A N/A self transport loseConnection N/A N/A ScanFactory N/A ClientFactory N/A N/A protocol ScanProtocol __init__ N/A N/A self N/A N/A N/A N/A self deferred N/A N/A defer Deferred N/A clientConnectionFailed N/A N/A self connector reason N/A N/A N/A N/A N/A N/A self deferred errback reason N/A clientConnectionLost N/A N/A self connector reason N/A N/A N/A N/A N/A Scanner N/A object N/A N/A __init__ N/A N/A self hosts portRange batchSize timeout N/A 50 1 N/A N/A N/A self hosts hosts N/A N/A portRange N/A 1 1 N/A N/A self portRange portRange N/A N/A self batchSize N/A int batchSize N/A N/A self timeout N/A float timeout N/A N/A self data N/A success failure N/A N/A N/A run N/A N/A self N/A N/A N/A d N/A N/A self doScans N/A N/A N/A d addCallback N/A self doReport N/A N/A N/A d addCallback N/A self writeConfigs N/A N/A N/A d addErrback printError N/A N/A N/A reactor run N/A doScans N/A N/A self N/A N/A N/A 
        We use the Twisted task cooperator here to control the number of
        deferrds (and therefore connections) created at once, thus providing a
        way for systems to use the script efficiently.
         N/A coop N/A N/A task Cooperator scanHosts N/A N/A N/A N/A N/A host N/A self hosts N/A N/A port N/A xrange N/A self portRange N/A N/A N/A N/A N/A self doFactory host port N/A N/A scans N/A scanHosts N/A N/A self scans N/A N/A defer DeferredList N/A N/A N/A coop coiterate scans N/A i N/A xrange N/A self batchSize N/A N/A self scans N/A doFactory N/A N/A self host port N/A N/A N/A factory N/A ScanFactory N/A N/A opts spew N/A N/A N/A Preparing connection for %s:%s ... N/A host port N/A N/A N/A reactor connectTCP host port factory N/A self timeout N/A d N/A factory deferred N/A N/A N/A d addCallback N/A self recordConnection host port N/A N/A N/A d addErrback N/A self recordFailure host port N/A d N/A recordConnection N/A N/A self result host port N/A N/A N/A N/A N/A opts verbose N/A opts spew N/A N/A N/A Connected to %s:%s ... N/A host port N/A hostData N/A N/A N/A N/A self data N/A success setdefault host N/A N/A N/A N/A hostData append port N/A recordFailure N/A N/A self failure host port N/A N/A N/A hostData N/A N/A N/A N/A self data N/A failure setdefault host N/A N/A data N/A port N/A N/A failure getErrorMessage N/A N/A N/A hostData append data N/A doReport N/A N/A self ignore N/A N/A N/A results N/A N/A N/A N/A self getSuccesses items N/A results N/A N/A Open Ports: N/A N/A No open ports found. N/A N/A host ports results N/A N/A N/A 	Host: %s host N/A port ports N/A N/A N/A 		open port: %i port N/A errors N/A N/A results N/A N/A N/A N/A self getFailures items N/A N/A host portAndError results N/A N/A N/A port error portAndError N/A N/A N/A N/A errors setdefault error 0 N/A N/A errors N/A error 1 N/A N/A results N/A N/A opts verbose N/A opts spew N/A N/A 
Errors encountered, and their counts: N/A N/A error count N/A N/A errors items N/A N/A N/A 	%s -- %i N/A error count N/A writeConfigs N/A N/A self result N/A N/A N/A N/A N/A reactor stop N/A basePath N/A FilePath etc/services/ping_tcp N/A N/A N/A N/A basePath exists N/A N/A N/A N/A basePath makedirs N/A results N/A N/A N/A N/A self getSuccesses items N/A results N/A N/A Writing config files: N/A N/A host ports results N/A N/A hostname N/A N/A gethostbyaddr host N/A 0 N/A cfgFile N/A N/A basePath child N/A %s.conf hostname N/A N/A N/A cfgFile exists N/A N/A N/A N/A 	%s ... N/A cfgFile path N/A N/A N/A cfgFile touch N/A fh N/A N/A cfgFile open w N/A ports N/A N/A , join N/A N/A str x N/A x ports N/A cfg N/A TCPPingServiceConfigTemplate N/A host ports N/A N/A N/A fh write cfg N/A N/A N/A fh close N/A getSuccesses N/A N/A self N/A N/A N/A N/A N/A self data N/A success N/A getFailures N/A N/A self N/A N/A N/A N/A N/A self data N/A failure N/A N/A main N/A N/A N/A N/A N/A nets N/A Networks N/A N/A CIDR x N/A x blocks N/A total N/A N/A nets getHostCount N/A netword N/A getSimplePlural network N/A len nets N/A hostword N/A getSimplePlural host total N/A countMsg N/A for a total of %s %s N/A total hostword N/A N/A 
Beginning scan on the following %s (%s): N/A netword countMsg N/A net nets N/A N/A N/A 	%s net N/A scanner N/A Scanner N/A N/A nets iterIPs ports N/A opts batchSize N/A opts timeout N/A N/A N/A scanner run N/A N/A N/A __name__ __main__ N/A N/A N/A main