Skip to content
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

v3.0.10 #49

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading