summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-12-28 01:13:47 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-12-28 01:13:47 +0300
commit37ec4be9af18a2174161a809fdfcb113a2bcf780 (patch)
tree753c2177602091853e5a2ee370b0942f5b1a6dad
parent91177bcf42f7a599e6f456b3ffdcbe8b8e0c6407 (diff)
add 'ignore' to the config
-rw-r--r--lib/worker.py5
-rwxr-xr-xmanual-scan2
-rwxr-xr-xsuddenly-opened-ports-checker3
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/worker.py b/lib/worker.py
index f8d6c55..8caf905 100644
--- a/lib/worker.py
+++ b/lib/worker.py
@@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
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)
assert concurrency is not None
@@ -16,6 +16,7 @@ class Worker(Thread):
self.name = name
self.concurrency = concurrency
self.opened = opened
+ self.ignore = ignore
scanner_kw = {}
if timeout is not None:
@@ -32,7 +33,7 @@ class Worker(Thread):
return self.scanner.results
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):
return self.scanner.host
diff --git a/manual-scan b/manual-scan
index 3318ae1..64c65bb 100755
--- a/manual-scan
+++ b/manual-scan
@@ -18,7 +18,7 @@ if __name__ == '__main__':
level=(logging.DEBUG if args.verbose else logging.INFO))
results = Results()
- worker = Worker(args.host, args.host, [],
+ worker = Worker(args.host, args.host, [], [],
concurrency=args.threads,
timeout=args.timeout)
worker.start()
diff --git a/suddenly-opened-ports-checker b/suddenly-opened-ports-checker
index 4cf423c..b4c1972 100755
--- a/suddenly-opened-ports-checker
+++ b/suddenly-opened-ports-checker
@@ -3,7 +3,6 @@ import logging
import yaml
import math
-from pprint import pprint
from argparse import ArgumentParser
from lib.worker import Worker
from lib.results import Results
@@ -54,7 +53,7 @@ def main():
workers = []
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,
timeout=int(data['timeout']) if 'timeout' in data else args.timeout)
workers.append(w)