From ab1f0ed91f4a9a7dafb7797835f4b64595bd0171 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Wed, 18 Dec 2019 13:21:11 -0300 Subject: [PATCH] Change exit code depending on vulnerabilities found --- core/scanner.py | 3 +++ wpbullet.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/scanner.py b/core/scanner.py index 6e810a7..415d7d5 100644 --- a/core/scanner.py +++ b/core/scanner.py @@ -87,6 +87,9 @@ def scan(args): if args.cleanup: shutil.rmtree('.temp') + has_vulnerabilities = len(list(CODE_VULNERABILITIES)) > 1 + return has_vulnerabilities + # Check given file for vulnerabilities def check_file(file,r, modules): diff --git a/wpbullet.py b/wpbullet.py index 3d4352f..84dd38d 100644 --- a/wpbullet.py +++ b/wpbullet.py @@ -28,8 +28,9 @@ def main(): argparse.ArgumentParser.print_usage(parser) exit(1) - scanner.scan(args) - + has_vulnerabilities = scanner.scan(args) + if has_vulnerabilities: + exit(1) if __name__ == '__main__': main()