mirror of
https://github.com/mandiant/capa.git
synced 2025-12-23 15:37:37 -08:00
Update detect_duplicate_features.py
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user