address @mr-tz main.py review comments

This commit is contained in:
Yacine Elhamer
2023-07-21 12:48:03 +01:00
parent bd8331678c
commit 736b2cd689

View File

@@ -139,7 +139,7 @@ def find_instruction_capabilities(
returns: tuple containing (features for instruction, match results for instruction)
"""
# all features found for the instruction.
features = collections.defaultdict(set) # type: FeatureSet
features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
for feature, addr in itertools.chain(
extractor.extract_insn_features(f, bb, insn), extractor.extract_global_features()
@@ -167,7 +167,7 @@ def find_basic_block_capabilities(
"""
# all features found within this basic block,
# includes features found within instructions.
features = collections.defaultdict(set) # type: FeatureSet
features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
# matches found at the instruction scope.
# might be found at different instructions, thats ok.
@@ -207,7 +207,7 @@ def find_code_capabilities(
"""
# all features found within this function,
# includes features found within basic blocks (and instructions).
function_features = collections.defaultdict(set) # type: FeatureSet
function_features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
# matches found at the basic block scope.
# might be found at different basic blocks, thats ok.
@@ -236,7 +236,7 @@ def find_code_capabilities(
def find_file_capabilities(ruleset: RuleSet, extractor: FeatureExtractor, function_features: FeatureSet):
file_features = collections.defaultdict(set) # type: FeatureSet
file_features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
for feature, va in itertools.chain(extractor.extract_file_features(), extractor.extract_global_features()):
# not all file features may have virtual addresses.
@@ -362,7 +362,7 @@ def find_thread_capabilities(
returns: tuple containing (features for thread, match results for thread)
"""
# all features found for the thread.
features = collections.defaultdict(set) # type: FeatureSet
features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
for feature, addr in itertools.chain(
extractor.extract_thread_features(ph, th), extractor.extract_global_features()
@@ -390,7 +390,7 @@ def find_process_capabilities(
"""
# all features found within this process,
# includes features found within threads.
process_features = collections.defaultdict(set) # type: FeatureSet
process_features: FeatureSet = collections.defaultdict(set) # type: FeatureSet
# matches found at the thread scope.
# might be found at different threads, thats ok.
@@ -954,7 +954,7 @@ def collect_metadata(
md5=md5,
sha1=sha1,
sha256=sha256,
path=os.path.normpath(sample_path),
path=str(Path(sample_path).resolve()),
),
analysis=get_sample_analysis(
format_,