[scanner] fix minor CLI handling and --list bugs / typo

This commit is contained in:
fnux 2021-05-26 11:26:35 +02:00
parent ab10b453f2
commit b8733c65f5
No known key found for this signature in database
GPG key ID: 4502C902C00A1E12
2 changed files with 7 additions and 7 deletions

View file

@ -495,7 +495,7 @@ def get_parsers():
action='store_true',
help='Try to configure detected hosts')
parser['scan'].add_argument(
'-I', '--interfaces',
'-I', '--interface',
action='append', default=[], required=True,
help='On which interfaces to scan/trigger')
parser['scan'].add_argument(
@ -503,7 +503,7 @@ def get_parsers():
action='store', default=None,
help='Map addresses to names, required for config mode')
parser['scan'].add_argument(
'-d', '--delay',
'-d', '--config-delay',
action='store', default=3600, type=int,
help='How long (seconds) to wait before reconfiguring after last try')
parser['scan'].add_argument(

View file

@ -32,7 +32,7 @@ def run(scan, args):
processes = []
if 'trigger' in args.mode:
t = scan.Trigger(interfaces=args.interfaces,
t = scan.Trigger(interfaces=args.interface,
sleeptime=args.trigger_delay)
t.start()
processes.append(t)
@ -41,7 +41,7 @@ def run(scan, args):
if 'scan' in args.mode:
s = scan.Scanner(
autoconfigure='config' in args.mode,
interfaces=args.interfaces,
interfaces=args.interface,
name_mapper=args.name_mapper)
s.start()
processes.append(s)
@ -52,7 +52,7 @@ def run(scan, args):
def list(scan, args):
s = scan.Scanner(interfaces=args.interfaces, name_mapper=args.name_mapper)
s = scan.Scanner(interfaces=args.interface, name_mapper=args.name_mapper)
hosts = s.list()
# A full IPv6 addresses id composed of 8 blocks of 4 hexa chars +
@ -75,10 +75,10 @@ def list(scan, args):
last_seen = '-'
last_configured = host.last_configured()
if last_configured:
if last_configured is not None:
last_configured = last_configured.strftime(scan.datetime_format)
else:
'-'
last_configured = '-'
print("{} | {} | {} | {}".format(
host.name(default='-').ljust(name_max_size),