-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3.12 support #1141
Merged
Merged
Python3.12 support #1141
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a547ba1
replaced abandoned package 'si-prefix' with 'quantiphy'
jstucke 5879f27
update matplotlib version and remove setuptools pin
jstucke f5d33b6
added new package 'quantiphy' to sphinx mock list
jstucke f6473cf
removed now obsolete dependency 'pyxdameraulevenshtein' of cve_lookup
jstucke 976b0fb
update remaining dependencies for python 3.12
jstucke 1b08d26
Merge remote-tracking branch 'origin/master' into python3.12-support
jstucke 67ac7c9
updated docker-py version to fix compatibility with newer requests
jstucke 531d086
Merge branch 'master' into python3.12-support
jstucke 780d1e5
fixed matplotlib version mismatch
jstucke dcbf802
upgrade yara version
jstucke 96ce0cc
plugin compat: updated for new yara version + added test
jstucke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I think it is useful since you can't easily look at the YARA source (because it is a compiled C library)