Skip to content

Commit

Permalink
Update log4j-finder.py
Browse files Browse the repository at this point in the history
fixes fox-it#76
  • Loading branch information
ericrbs committed Dec 23, 2021
1 parent 52f1e5a commit cb1df0f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions log4j-finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def main():
help="be more quiet, disables banner and summary",
)
parser.add_argument("-b", "--no-banner", action="store_true", help="disable banner")
parser.add_argument("-f", "--fail", action="store_true", help="Exit with error status when vulnerability is found")
parser.add_argument(
"-V", "--version", action="version", version=f"%(prog)s {__version__}"
)
Expand Down Expand Up @@ -365,6 +366,10 @@ def main():
print_summary(stats)
print(f"\nElapsed time: {elapsed:.2f} seconds")

# If we find vulnerabilities and the args -f (or --fail), then exit with a string which cause a error status on the exit.
if args.fail:
if stats["vulnerable"]:
return "Vulnerabilities found."

if __name__ == "__main__":
try:
Expand Down

0 comments on commit cb1df0f

Please # to comment.