Skip to content

Commit

Permalink
Only show a No Threats Detected section if there is an AV hit
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-kevin committed Jan 11, 2021
1 parent 4a8302d commit d163732
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions metadefender.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def parse_results(self, response: Dict[str, Any]):
if hit:
res.add_section(av_hits)

if fail:
# Only creat a result section for "No Threat Detected" if there was at least one hit
if hit and fail:
if no_threat_detected:
ResultSection("No Threat Detected by AV Engine(s)",
body_format=BODY_FORMAT.KEY_VALUE,
Expand All @@ -376,10 +377,10 @@ def parse_results(self, response: Dict[str, Any]):
if processed['actions_failed']:
fail = True
elif processed['actions_ran']:
hit=True
hit = True
#add cdr json extracted
if hit:
cdr_json_section = ResultSection('CDR Succesfully Executed', body_format=BODY_FORMAT.JSON,
cdr_json_section = ResultSection('CDR Successfully Executed', body_format=BODY_FORMAT.JSON,
body=json.dumps(processed))
res.add_section(cdr_json_section)
if fail:
Expand Down

0 comments on commit d163732

Please sign in to comment.