++scan stuff

This commit is contained in:
Nico Schottelius 2020-12-11 19:37:53 +01:00
parent 09dfcfe81e
commit bc2948a8a5
2 changed files with 24 additions and 1 deletions

View file

@ -56,6 +56,8 @@ from scapy.all import *
# Datetime overwrites scapy.all.datetime - needs to be imported AFTER # Datetime overwrites scapy.all.datetime - needs to be imported AFTER
import datetime import datetime
import cdist.config
log = logging.getLogger("scan") log = logging.getLogger("scan")
class Trigger(object): class Trigger(object):
@ -120,6 +122,19 @@ class Scanner(object):
with open(fname, "w") as fd: with open(fname, "w") as fd:
fd.write(f"{now}\n") fd.write(f"{now}\n")
def config(self):
"""
Configure a host
- Assume we are only called if necessary
- However we need to ensure to not run in parallel
- Maybe keep dict storing per host processes
- Save the result
- Save the output -> probably aligned to config mode
"""
def start(self): def start(self):
self.process = Process(target=self.scan) self.process = Process(target=self.scan)
self.process.start() self.process.start()

View file

@ -54,4 +54,12 @@ VERBOSE: scan: Host fe80::f29f:c2ff:fe7c:275e is alive
VERBOSE: scan: Host fe80::ba69:f4ff:fec5:8db7 is alive VERBOSE: scan: Host fe80::ba69:f4ff:fec5:8db7 is alive
VERBOSE: scan: Host fe80::42b0:34ff:fe6f:f863 is alive VERBOSE: scan: Host fe80::42b0:34ff:fe6f:f863 is alive
VERBOSE: scan: Host fe80::21b:fcff:feee:f4bc is alive VERBOSE: scan: Host fe80::21b:fcff:feee:f4bc is alive
... ** Better usage -> saving the env
sudo -E cdist scan -b -I wlan0 -vv
** TODO Implement actual configuration step
- Also serves as a nice PoC
- Might need to escape literal IPv6 addresses for scp
** TODO Define how to map link local address to something useful
- via reverse DNS?
- via link local in manifest?
** TODO define ignorehosts?