Compare commits
2 commits
12902df924
...
c6427722de
Author | SHA1 | Date | |
---|---|---|---|
|
c6427722de | ||
|
e51875a66b |
3 changed files with 13 additions and 3 deletions
|
@ -16,6 +16,7 @@ TODO
|
||||||
* Write manpages
|
* Write manpages
|
||||||
* Add `install` and `uninstall` makefile targets
|
* Add `install` and `uninstall` makefile targets
|
||||||
* `sshwot-scan-known-hosts`
|
* `sshwot-scan-known-hosts`
|
||||||
|
* Investigate why it says sshwot-file is required in `sshwot-filter`
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -101,7 +101,7 @@ def main():
|
||||||
|
|
||||||
# Use the default files if no input files were specified
|
# Use the default files if no input files were specified
|
||||||
if len(args.infiles) == 0:
|
if len(args.infiles) == 0:
|
||||||
infiles = open_default_files.open_all()
|
infiles = default_files.open_all()
|
||||||
else:
|
else:
|
||||||
infiles = args.infiles
|
infiles = args.infiles
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,9 @@ def main():
|
||||||
else:
|
else:
|
||||||
infiles = args.infiles
|
infiles = args.infiles
|
||||||
|
|
||||||
|
# Only do colour if we are outputting to a tty
|
||||||
|
colour = os.isatty(sys.stdout.fileno())
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
any_verified = False
|
any_verified = False
|
||||||
for path in infiles:
|
for path in infiles:
|
||||||
|
@ -94,11 +97,17 @@ def main():
|
||||||
# Use for display the same normalzed format as internally
|
# Use for display the same normalzed format as internally
|
||||||
# We do .decode() here, as it produces bytes
|
# We do .decode() here, as it produces bytes
|
||||||
host_display = entry.normalize_host(match_host, match_port).decode()
|
host_display = entry.normalize_host(match_host, match_port).decode()
|
||||||
print('[\x1b[32mok\x1b[0m] %s: %s: %s' % (name, host_display, match_comment))
|
if colour:
|
||||||
|
print('[\x1b[32mok\x1b[0m] %s: %s: %s' % (name, host_display, match_comment))
|
||||||
|
else:
|
||||||
|
print('[ok] %s: %s: %s' % (name, host_display, match_comment))
|
||||||
|
|
||||||
for fail_host, fail_port, fail_comment in fail:
|
for fail_host, fail_port, fail_comment in fail:
|
||||||
host_display = entry.normalize_host(fail_host, fail_port).decode()
|
host_display = entry.normalize_host(fail_host, fail_port).decode()
|
||||||
print('[\x1b[31mfail\x1b[0m] %s: %s: %s' % (name, host_display, fail_comment))
|
if colour:
|
||||||
|
print('[\x1b[31mfail\x1b[0m] %s: %s: %s' % (name, host_display, fail_comment))
|
||||||
|
else:
|
||||||
|
print('[fail] %s: %s: %s' % (name, host_display, fail_comment))
|
||||||
|
|
||||||
# Only display this if we didn't get a match in this file
|
# Only display this if we didn't get a match in this file
|
||||||
# The value in the [same fingerprint] message is finding a host
|
# The value in the [same fingerprint] message is finding a host
|
||||||
|
|
Loading…
Reference in a new issue