Skip to content

Commit

Permalink
initial cdr output
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-aa committed Oct 23, 2020
1 parent 4e240c4 commit 458b10e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion metadefender.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def parse_results(self, response: Dict[str, Any]):
res = Result()
scan_results = response.get('scan_results', response)
virus_name = ""

process_results = response.get('process_info', response)
if scan_results is not None and scan_results.get('progress_percentage') == 100:
hit = False
fail = False
Expand Down Expand Up @@ -363,5 +363,21 @@ def parse_results(self, response: Dict[str, Any]):
# Add the queue time to a list, which will be later used to calculate average queue time
self.nodes[self.current_node]['queue_times'].append(queue_time)
self.nodes[self.current_node]['file_count'] += 1
if process_results is not None and process_results.get('progress_percentage') == 100:
hit = False
fail = False
cdr_fails = ResultSection('CDR Failed or No Malicious Files Found')
processed = process_results.get('post_processing', process_results)
if processed['actions_failed']:
fail = True
elif processed['actions_ran']:
hit=True
#add cdr json extracted
if hit:
cdr_json_section = ResultSection('CDR Succesfully Executed', body_format=BODY_FORMAT.JSON,
body=json.dumps(processed))
res.add_section(cdr_json_section)
if fail:
res.add_section(cdr_fails)

return res

0 comments on commit 458b10e

Please sign in to comment.