Skip to content

Commit

Permalink
Update show-unused-features.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush-Goel-04 committed Aug 9, 2023
1 parent f1e737a commit d81f3a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/show-unused-features.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""
import os
import sys
import typing
import logging
import argparse
from typing import Set, Tuple
Expand Down Expand Up @@ -52,8 +53,8 @@ def get_rules_feature_set(rules_path) -> Set[Feature]:

def get_file_features(
functions: Tuple[FunctionHandle, ...], extractor: capa.features.extractors.base_extractor.FeatureExtractor
) -> Counter[Feature]:
feature_map: Counter[Feature] = Counter()
) -> typing.Counter[Feature]:
feature_map: typing.Counter[Feature] = Counter()

for f in functions:
if extractor.is_library_function(f.address):
Expand Down Expand Up @@ -89,7 +90,7 @@ def get_colored(s: str):
return colored(s, "cyan")


def print_unused_features(feature_map: Counter[Feature], rules_feature_set: Set[Feature]):
def print_unused_features(feature_map: typing.Counter[Feature], rules_feature_set: Set[Feature]):
unused_features = []
for feature, count in feature_map.items():
if feature in rules_feature_set:
Expand Down Expand Up @@ -147,7 +148,7 @@ def main(argv=None):
log_unsupported_runtime_error()
return -1

feature_map: Counter[Feature] = Counter()
feature_map: typing.Counter[Feature] = Counter()

feature_map.update([feature for feature, _ in extractor.extract_global_features()])

Expand Down Expand Up @@ -190,7 +191,7 @@ def ida_main():
print(f"getting features for current function {hex(function)}")

extractor = capa.features.extractors.ida.extractor.IdaFeatureExtractor()
feature_map: Counter[Feature] = Counter()
feature_map: typing.Counter[Feature] = Counter()

feature_map.update([feature for feature, _ in extractor.extract_file_features()])

Expand Down

0 comments on commit d81f3a4

Please sign in to comment.