From 5317e1e11e53b0070d59b791ff457eb93fabbb8c Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Fri, 3 Jul 2020 09:32:37 -0600 Subject: [PATCH] feature extractor: null: add get_base_address() closes #88 --- capa/features/extractors/__init__.py | 4 ++++ tests/test_freeze.py | 1 + 2 files changed, 5 insertions(+) diff --git a/capa/features/extractors/__init__.py b/capa/features/extractors/__init__.py index fed476f2..75426041 100644 --- a/capa/features/extractors/__init__.py +++ b/capa/features/extractors/__init__.py @@ -180,6 +180,7 @@ class NullFeatureExtractor(FeatureExtractor): example:: extractor = NullFeatureExtractor({ + 'base address: 0x401000, 'file features': [ (0x402345, capa.features.Characteristic('embedded pe')), ], @@ -214,6 +215,9 @@ class NullFeatureExtractor(FeatureExtractor): super(NullFeatureExtractor, self).__init__() self.features = features + def get_base_address(self): + return self.features["base address"] + def extract_file_features(self): for p in self.features.get("file features", []): va, feature = p diff --git a/tests/test_freeze.py b/tests/test_freeze.py index 7b251264..f81114ca 100644 --- a/tests/test_freeze.py +++ b/tests/test_freeze.py @@ -10,6 +10,7 @@ from fixtures import * EXTRACTOR = capa.features.extractors.NullFeatureExtractor( { + "base address": 0x401000, "file features": [(0x402345, capa.features.Characteristic("embedded pe")),], "functions": { 0x401000: {