Update detect_duplicate_features.py

This commit is contained in:
Aayush Goel
2023-05-08 20:17:29 +05:30
parent 39d2a70679
commit d91070c116

View File

@@ -5,11 +5,15 @@ import capa.rules
import capa.engine as ceng import capa.engine as ceng
def get_child_features(feature) -> list: def get_child_features(feature: ceng.Statement) -> list:
""" """
args: Recursively extracts all feature statements from a given rule statement.
\tfeature : capa.rule.Rule.statement containing feature statements
returns a list containg all the features in the rule Args:
feature (capa.engine.Statement): The feature statement to extract features from.
Returns:
list: A list of all feature statements contained within the given feature statement.
""" """
children = [] children = []
@@ -23,11 +27,15 @@ def get_child_features(feature) -> list:
return children return children
def get_features(rule_path): def get_features(rule_path: str) -> list:
""" """
args: Extracts all features from a given rule file.
\tfeature : rule path
returns a list containg all the features in the rule Args:
rule_path (str): The path to the rule file to extract features from.
Returns:
list: A list of all feature statements contained within the rule file.
""" """
feature_list = [] feature_list = []
with open(rule_path, "r") as f: with open(rule_path, "r") as f: