add 'ignore' to the config
This commit is contained in:
parent
91177bcf42
commit
37ec4be9af
@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class Worker(Thread):
|
class Worker(Thread):
|
||||||
def __init__(self, name, host, opened=None, concurrency=None, timeout=None):
|
def __init__(self, name, host, opened=None, ignore=None, concurrency=None, timeout=None):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
|
|
||||||
assert concurrency is not None
|
assert concurrency is not None
|
||||||
@ -16,6 +16,7 @@ class Worker(Thread):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.concurrency = concurrency
|
self.concurrency = concurrency
|
||||||
self.opened = opened
|
self.opened = opened
|
||||||
|
self.ignore = ignore
|
||||||
|
|
||||||
scanner_kw = {}
|
scanner_kw = {}
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
@ -32,7 +33,7 @@ class Worker(Thread):
|
|||||||
return self.scanner.results
|
return self.scanner.results
|
||||||
|
|
||||||
def is_expected(self, port):
|
def is_expected(self, port):
|
||||||
return (self.opened is not None) and (port in self.opened)
|
return ((self.opened is not None) and (port in self.opened)) or ((self.ignore is not None) and (port in self.ignore))
|
||||||
|
|
||||||
def get_host(self):
|
def get_host(self):
|
||||||
return self.scanner.host
|
return self.scanner.host
|
||||||
|
@ -18,7 +18,7 @@ if __name__ == '__main__':
|
|||||||
level=(logging.DEBUG if args.verbose else logging.INFO))
|
level=(logging.DEBUG if args.verbose else logging.INFO))
|
||||||
|
|
||||||
results = Results()
|
results = Results()
|
||||||
worker = Worker(args.host, args.host, [],
|
worker = Worker(args.host, args.host, [], [],
|
||||||
concurrency=args.threads,
|
concurrency=args.threads,
|
||||||
timeout=args.timeout)
|
timeout=args.timeout)
|
||||||
worker.start()
|
worker.start()
|
||||||
|
@ -3,7 +3,6 @@ import logging
|
|||||||
import yaml
|
import yaml
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from pprint import pprint
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from lib.worker import Worker
|
from lib.worker import Worker
|
||||||
from lib.results import Results
|
from lib.results import Results
|
||||||
@ -54,7 +53,7 @@ def main():
|
|||||||
|
|
||||||
workers = []
|
workers = []
|
||||||
for name, data in config['servers'].items():
|
for name, data in config['servers'].items():
|
||||||
w = Worker(name, data['host'], data['opened'],
|
w = Worker(name, data['host'], data['opened'], data['ignore'],
|
||||||
concurrency=int(data['concurrency']) if 'concurrency' in data else args.concurrency,
|
concurrency=int(data['concurrency']) if 'concurrency' in data else args.concurrency,
|
||||||
timeout=int(data['timeout']) if 'timeout' in data else args.timeout)
|
timeout=int(data['timeout']) if 'timeout' in data else args.timeout)
|
||||||
workers.append(w)
|
workers.append(w)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user