-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replaced abandoned package 'si-prefix' with 'quantiphy' * update matplotlib version and remove setuptools pin * removed now obsolete dependency 'pyxdameraulevenshtein' of cve_lookup * update remaining dependencies for python 3.12 * updated docker-py version to fix compatibility with newer requests * fixed matplotlib version mismatch * upgrade yara version * plugin compat: updated for new yara version + added test
- Loading branch information
Showing
12 changed files
with
84 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ | |
'pytest-cov', | ||
'pytest-timeout', | ||
'redis', | ||
'quantiphy', | ||
'requests', | ||
'rich', | ||
'semver', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
capstone==4.0.2 | ||
cstruct==4.0 | ||
matplotlib==3.5.3 | ||
matplotlib==3.7.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
pyxdameraulevenshtein==1.7.1 | ||
retry==0.9.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
git+https://github.com/fkie-cad/common_analysis_ip_and_uri.git | ||
geoip2==4.6.0 | ||
geoip2==4.7.0 | ||
# dependency of geoip2 for python >= 3.12 | ||
aiohttp~=3.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from io import FileIO | ||
from pathlib import Path | ||
|
||
import yara | ||
|
||
from analysis.YaraPluginBase import YaraBasePlugin | ||
from analysis.plugin.addons import Yara | ||
from analysis.plugin.compat import yara_match_to_dict | ||
from helperFunctions.fileSystem import get_src_dir | ||
from test.common_helper import create_test_file_object | ||
|
||
signature_file = str(Path(get_src_dir()) / 'test/unit/analysis/test.yara') | ||
test_target = str(Path(get_src_dir()) / 'test/data/files/get_files_test/testfile1') | ||
|
||
EXPECTED_RESULT = { | ||
'matches': True, | ||
'meta': { | ||
'description': 'Generic Software', | ||
'open_source': False, | ||
'software_name': 'Test Software', | ||
'website': 'http://www.fkie.fraunhofer.de', | ||
}, | ||
'rule': 'testRule', | ||
'strings': [(0, '$a', 'test'), (22, '$a', 'Test')], | ||
} | ||
|
||
|
||
class MockYaraPlugin(YaraBasePlugin): | ||
def __init__(self): | ||
self.signature_path = signature_file | ||
self.NAME = 'test_plugin' | ||
|
||
|
||
class MockYaraAddonPlugin(Yara): | ||
def __init__(self): | ||
self._rules = yara.compile(signature_file) | ||
|
||
|
||
def test_output_is_compatible(): | ||
fo = create_test_file_object(test_target) | ||
plugin = MockYaraPlugin() | ||
plugin.process_object(fo) | ||
assert fo.processed_analysis['test_plugin']['testRule'] == EXPECTED_RESULT | ||
|
||
yara_addon_plugin = MockYaraAddonPlugin() | ||
file = FileIO(test_target) | ||
yara_matches = yara_addon_plugin.match(file) | ||
assert all(isinstance(m, yara.Match) for m in yara_matches) | ||
converted_match = yara_match_to_dict(yara_matches[0]) | ||
assert converted_match['strings'] == EXPECTED_RESULT['strings'] | ||
for key, value in EXPECTED_RESULT['meta'].items(): | ||
assert converted_match['meta'][key] == value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters