Skip to content

Commit

Permalink
Merge pull request #138 from intezer/fix/fix-machine-type
Browse files Browse the repository at this point in the history
feat: Add sandbox machine type to SDK TKT-3138
  • Loading branch information
yoniabrahamy authored Mar 20, 2024
2 parents dac1304 + 4a872ea commit 947b700
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
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.17'
__version__ = '1.19.18'
11 changes: 5 additions & 6 deletions intezer_sdk/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from intezer_sdk.api import raise_for_status
from intezer_sdk.consts import IndexType
from intezer_sdk.consts import OnPremiseVersion
from intezer_sdk.consts import SandboxMachineType


class IntezerApi:
Expand All @@ -34,7 +33,7 @@ def analyze_by_hash(self,
disable_dynamic_unpacking: Optional[bool],
disable_static_unpacking: Optional[bool],
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
file_name: str = None,
**additional_parameters) -> str:
"""
Expand Down Expand Up @@ -70,7 +69,7 @@ def analyze_by_download_url(self,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters) -> str:
"""
Analyze a file by its download URL.
Expand Down Expand Up @@ -123,7 +122,7 @@ def analyze_by_file(self,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters) -> Optional[str]:
"""
Analyze a file by its path or stream.
Expand Down Expand Up @@ -737,7 +736,7 @@ def _param_initialize(disable_dynamic_unpacking: bool,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters):
data = {}

Expand All @@ -752,7 +751,7 @@ def _param_initialize(disable_dynamic_unpacking: bool,
if sandbox_command_line_arguments:
data['sandbox_command_line_arguments'] = sandbox_command_line_arguments
if sandbox_machine_type:
data['sandbox_machine_type'] = sandbox_machine_type.value
data['sandbox_machine_type'] = sandbox_machine_type

data.update(additional_parameters)

Expand Down
3 changes: 1 addition & 2 deletions intezer_sdk/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from intezer_sdk.api import IntezerApiClient
from intezer_sdk.api import get_global_api
from intezer_sdk.base_analysis import Analysis
from intezer_sdk.consts import SandboxMachineType
from intezer_sdk.sub_analysis import SubAnalysis

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -52,7 +51,7 @@ def __init__(self,
zip_password: str = None,
download_url: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None):
sandbox_machine_type: str = None):
"""
FileAnalysis is a class for analyzing files. It is a subclass of the BaseAnalysis class and requires an API connection to Intezer.
Expand Down
11 changes: 5 additions & 6 deletions intezer_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from intezer_sdk._util import deprecated
from intezer_sdk.consts import IndexType
from intezer_sdk.consts import OnPremiseVersion
from intezer_sdk.consts import SandboxMachineType

_global_api: Optional['IntezerApi'] = None

Expand Down Expand Up @@ -264,7 +263,7 @@ def analyze_by_hash(self,
disable_dynamic_unpacking: Optional[bool],
disable_static_unpacking: Optional[bool],
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters) -> str:
data = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
Expand All @@ -286,7 +285,7 @@ def analyze_by_download_url(self,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters) -> str:
data = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
Expand Down Expand Up @@ -324,7 +323,7 @@ def analyze_by_file(self,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters) -> Optional[str]:
options = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
Expand Down Expand Up @@ -662,7 +661,7 @@ def _param_initialize(disable_dynamic_unpacking: bool,
code_item_type: str = None,
zip_password: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None,
sandbox_machine_type: str = None,
**additional_parameters):
data = {}

Expand All @@ -677,7 +676,7 @@ def _param_initialize(disable_dynamic_unpacking: bool,
if sandbox_command_line_arguments:
data['sandbox_command_line_arguments'] = sandbox_command_line_arguments
if sandbox_machine_type:
data['sandbox_machine_type'] = sandbox_machine_type.value
data['sandbox_machine_type'] = sandbox_machine_type

data.update(additional_parameters)

Expand Down
5 changes: 0 additions & 5 deletions intezer_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ class OnPremiseVersion(enum.IntEnum):
V23_10 = 23.10


class SandboxMachineType(AutoName):
WIN7 = enum.auto()
WIN10 = enum.auto()


ANALYZE_URL = 'https://analyze.intezer.com'
BASE_URL = f'{ANALYZE_URL}/api/'
API_VERSION = 'v2-0'
Expand Down

0 comments on commit 947b700

Please sign in to comment.