Skip to content

Commit

Permalink
Merge pull request #117 from intezer/feature/add-file-name-to-hash-an…
Browse files Browse the repository at this point in the history
…alysis

feat(analysis): Add file name to hash analysis
  • Loading branch information
davidt99 authored Sep 19, 2023
2 parents fb9da8d + 73b379f commit d3edd36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.19.3
------
- Add file name to hash analysis.

1.19.2
------
- Formatting fixes.
Expand Down
2 changes: 1 addition & 1 deletion intezer_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.19.2'
__version__ = '1.19.3'
4 changes: 4 additions & 0 deletions intezer_sdk/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def analyze_by_hash(self,
disable_dynamic_unpacking: Optional[bool],
disable_static_unpacking: Optional[bool],
sandbox_command_line_arguments: str = None,
file_name: str = None,
**additional_parameters) -> str:
"""
Analyze a file by its hash.
Expand All @@ -41,13 +42,16 @@ def analyze_by_hash(self,
:param disable_dynamic_unpacking: Whether to disable dynamic unpacking.
:param disable_static_unpacking: Whether to disable static unpacking.
:param sandbox_command_line_arguments: Command line arguments to pass to the sandbox.
:param file_name: The file name of the file if exists.
:param additional_parameters: Additional parameters to pass to the API.
:return: The analysis id.
"""
data = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
sandbox_command_line_arguments=sandbox_command_line_arguments,
**additional_parameters)
if file_name and (not self.api.on_premise_version or self.api.on_premise_version > OnPremiseVersion.V22_10):
data['file_name'] = file_name

data['hash'] = file_hash
response = self.api.request_with_refresh_expired_access_token('POST', '/analyze-by-hash', data)
Expand Down
1 change: 1 addition & 0 deletions intezer_sdk/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def _send_analyze_to_api(self, **additional_parameters) -> str:
self._disable_dynamic_unpacking,
self._disable_static_unpacking,
self._sandbox_command_line_arguments,
self._file_name,
**additional_parameters)
elif self._download_url:
return self._api.analyze_by_download_url(
Expand Down

0 comments on commit d3edd36

Please sign in to comment.