Skip to content

Commit

Permalink
Merge pull request #49
Browse files Browse the repository at this point in the history
v3.0.10
  • Loading branch information
MatteoCampinoti94 authored Sep 13, 2024
2 parents 6e3bbfe + f803548 commit 0a391cd
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 102 deletions.
2 changes: 1 addition & 1 deletion acacore/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.9"
__version__ = "3.0.10"
8 changes: 5 additions & 3 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def from_file(
action = file.get_action(actions, file_classes)

if action and action.reidentify and custom_signatures:
custom_match = file.identify_custom(custom_signatures)
custom_match = file.identify_custom(custom_signatures, chunk_size=action.reidentify.chunk_size)
if custom_match:
file.puid = custom_match.puid
file.signature = custom_match.signature
Expand Down Expand Up @@ -208,6 +208,7 @@ def identify_custom(
self,
custom_signatures: list[CustomSignature],
*,
chunk_size: int | None = 1024,
set_match: bool = False,
) -> CustomSignature | None:
"""
Expand All @@ -217,10 +218,11 @@ def identify_custom(
nothing.
:param custom_signatures: A list of the custom_signatures that the file should be checked against.
:param chunk_size: Optionally, the chunk size to use to search for custom signatures. Defaults to 1024.
:param set_match: Set results of match if True, defaults to False.
"""
bof = get_bof(self.get_absolute_path(self.root)).hex()
eof = get_eof(self.get_absolute_path(self.root)).hex()
bof = get_bof(self.get_absolute_path(self.root), chunk_size or 1024).hex()
eof = get_eof(self.get_absolute_path(self.root), chunk_size or 1024).hex()
signature: CustomSignature | None = None
signature_length: int = 0

Expand Down
2 changes: 2 additions & 0 deletions acacore/models/reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ class ReIdentifyAction(NoDefaultsModel):
Class representing an action to ignore a specific file based on the given reason.
:ivar reason: The reason for ignoring the file.
:ivar chunk_size: Specifies how many bytes should be used to search for custom signatures.
:ivar on_fail: The action to take if the re-identification fails. Defaults to "null".
"""

reason: str
chunk_size: int | None = Field(None, ge=1)
on_fail: Literal["action", "null"] = "null"


Expand Down
Loading

0 comments on commit 0a391cd

Please sign in to comment.