Skip to content

Commit

Permalink
Keeping tag/heur, but adjusting score
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-kevin committed Jul 27, 2021
1 parent 09d4b6f commit 639fa90
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions metadefender.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

class AvHitSection(ResultSection):
def __init__(self, av_name: str, virus_name: str, engine: Dict[str, str], heur_id: int,
sig_score_revision_map: Dict[str, int], kw_score_revision_map: Dict[str, int]) -> None:
sig_score_revision_map: Dict[str, int], kw_score_revision_map: Dict[str, int],
safelist_match: List[str]) -> None:
title = f"{av_name} identified the file as {virus_name}"
json_body = dict(
av_name=av_name,
Expand All @@ -41,6 +42,8 @@ def __init__(self, av_name: str, virus_name: str, engine: Dict[str, str], heur_i
signature_name,
max([kw_score_revision_map[kw] for kw in kw_score_revision_map if kw in signature_name.lower()])
)
elif virus_name in safelist_match:
section_heur.add_signature_id(signature_name, score=0)
else:
section_heur.add_signature_id(signature_name)
self.heuristic = section_heur
Expand Down Expand Up @@ -403,11 +406,10 @@ def parse_results(self, response: Dict[str, Any]) -> Result:

if heur_id is not None:
virus_name = virus_name.replace("a variant of ", "")
if virus_name in self.safelist_match:
continue
engine = self.nodes[self.current_node]['engine_map'][self._format_engine_name(majorkey)]
av_hit_section = AvHitSection(majorkey, virus_name, engine, heur_id,
self.sig_score_revision_map, self.kw_score_revision_map)
self.sig_score_revision_map, self.kw_score_revision_map,
self.safelist_match)
av_hits.add_subsection(av_hit_section)
hit = True

Expand Down

0 comments on commit 639fa90

Please sign in to comment.