forked from CybercentreCanada/assemblyline-service-yara
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add externals to TagCheck, fix handling them
TagCheck support now the default YARA_EXTERNALS together with tag data. The usage of YARA_EXTERNALS was unified across all classes. In collecting values of externals, fixed using keys with prefix against original fields as well as attempts to get values from __dict__, which does not contain properties Closes CybercentreCanada/assemblyline#269
- Loading branch information
Showing
5 changed files
with
19 additions
and
13 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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
from assemblyline.odm.models.tagging import Tagging | ||
|
||
from yara_.helper import YARA_EXTERNALS | ||
from yara_.yara_ import Yara | ||
|
||
tags_ext = list(Tagging.flat_fields().keys()) | ||
TAGCHECK_EXTERNALS = [*tags_ext, *YARA_EXTERNALS] | ||
|
||
|
||
class TagCheck(Yara): | ||
def __init__(self, config=None): | ||
externals = list(Tagging.flat_fields().keys()) | ||
super().__init__(config, externals=externals) | ||
super().__init__(config, externals=TAGCHECK_EXTERNALS) |
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,8 +1,8 @@ | ||
from assemblyline.odm.models.tagging import Tagging | ||
from tagcheck.tagcheck import TAGCHECK_EXTERNALS | ||
from yara_.update_server import YaraUpdateServer | ||
|
||
YARA_EXTERNALS = {f'al_{x.replace(".", "_")}': '' for x in list(Tagging.flat_fields().keys())} | ||
|
||
if __name__ == '__main__': | ||
with YaraUpdateServer(externals=YARA_EXTERNALS, default_pattern=".*\.rules") as server: | ||
if __name__ == "__main__": | ||
with YaraUpdateServer( | ||
externals=TAGCHECK_EXTERNALS, default_pattern=".*\.rules" | ||
) as server: | ||
server.serve_forever() |
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