diff --git a/src/main-verify.py b/src/main-verify.py index d6facc4..ea14f39 100644 --- a/src/main-verify.py +++ b/src/main-verify.py @@ -75,6 +75,7 @@ def main(): infiles = args.infiles # Check + any_verified = True for path in infiles: # Remove the directory and the extension from the file name = os.path.basename(path) @@ -86,6 +87,9 @@ def main(): success, fail, same_fingerprint = check_fingerprint.check(entries, args.host, port, fingerprint) + if len(success) > 0: + any_verified = True + for match_host, match_port, match_comment in success: # Use for display the same normalzed format as internally # We do .decode() here, as it produces bytes @@ -104,6 +108,12 @@ def main(): for _, _, same_fingerprint_comment in same_fingerprint: print('[same fingerprint] %s: (unknown host): %s' % (name, same_fingerprint_comment)) + # Exit with 0 only if it was verified + if any_verified: + sys.exit(0) + else: + sys.exit(2) + if __name__ == '__main__': try: main()