Skip to content

Commit

Permalink
Revert "feat: Add sandbox machine type to SDK TKT-3138"
Browse files Browse the repository at this point in the history
This reverts commit 79f3587.
  • Loading branch information
yoniabrahamy committed Mar 18, 2024
1 parent 79f3587 commit b56c8ad
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 42 deletions.
4 changes: 0 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
1.19.17
_______
- Add sandbox_machine_type to FileAnalysis

1.19.15
_______
- Remove pip-system-certs from dependencies
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.17'
__version__ = '1.19.16'
13 changes: 0 additions & 13 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,6 @@ 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,
file_name: str = None,
**additional_parameters) -> str:
"""
Expand All @@ -44,15 +42,13 @@ 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 sandbox_machine_type: The machine type to use in the sandbox. options are WIN7 or WIN10
: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,
sandbox_machine_type=sandbox_machine_type,
**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
Expand All @@ -70,7 +66,6 @@ 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,
**additional_parameters) -> str:
"""
Analyze a file by its download URL.
Expand All @@ -81,7 +76,6 @@ def analyze_by_download_url(self,
:param code_item_type: The type of the code item to analyze.
:param zip_password: The password of the zip file to analyze.
:param sandbox_command_line_arguments: Command line arguments to pass to the sandbox.
:param sandbox_machine_type: The machine type to use in the sandbox. options are WIN7 or WIN10
:param additional_parameters: Additional parameters to pass to the API.
:return: The analysis id.
"""
Expand All @@ -90,7 +84,6 @@ def analyze_by_download_url(self,
code_item_type=code_item_type,
zip_password=zip_password,
sandbox_command_line_arguments=sandbox_command_line_arguments,
sandbox_machine_type=sandbox_machine_type,
**additional_parameters)

data['download_url'] = download_url
Expand Down Expand Up @@ -123,7 +116,6 @@ 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,
**additional_parameters) -> Optional[str]:
"""
Analyze a file by its path or stream.
Expand All @@ -136,7 +128,6 @@ def analyze_by_file(self,
:param code_item_type: The type of the code item to analyze.
:param zip_password: The password of the zip file to analyze.
:param sandbox_command_line_arguments: Command line arguments to pass to the sandbox.
:param sandbox_machine_type: The machine type to use in the sandbox. options are WIN7 or WIN10
:param additional_parameters: Additional parameters to pass to the API.
:return: The analysis id.
"""
Expand All @@ -145,7 +136,6 @@ def analyze_by_file(self,
code_item_type=code_item_type,
zip_password=zip_password,
sandbox_command_line_arguments=sandbox_command_line_arguments,
sandbox_machine_type=sandbox_machine_type,
**additional_parameters)

if file_stream:
Expand Down Expand Up @@ -737,7 +727,6 @@ 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,
**additional_parameters):
data = {}

Expand All @@ -751,8 +740,6 @@ def _param_initialize(disable_dynamic_unpacking: bool,
data['zip_password'] = zip_password
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

data.update(additional_parameters)

Expand Down
9 changes: 1 addition & 8 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 @@ -51,8 +50,7 @@ def __init__(self,
code_item_type: str = None,
zip_password: str = None,
download_url: str = None,
sandbox_command_line_arguments: str = None,
sandbox_machine_type: SandboxMachineType = None):
sandbox_command_line_arguments: 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 All @@ -67,7 +65,6 @@ def __init__(self,
:param zip_password: The password for a password-protected zip file.
:param download_url: A URL from which to download the file to be analyzed.
:param sandbox_command_line_arguments: The command line arguments for sandbox analysis.
:param sandbox_machine_type: The machine type to use in the sandbox. options are WIN7 or WIN10
"""
super().__init__(api)
if [file_path, file_hash, file_stream, download_url].count(None) < 3:
Expand All @@ -91,7 +88,6 @@ def __init__(self,
self._code_item_type = code_item_type
self._zip_password = zip_password
self._sandbox_command_line_arguments = sandbox_command_line_arguments
self._sandbox_machine_type = sandbox_machine_type
self._sub_analyses: List[SubAnalysis] = None
self._root_analysis = None
self._iocs_report = None
Expand Down Expand Up @@ -174,7 +170,6 @@ def _send_analyze_to_api(self, **additional_parameters) -> str:
self._disable_dynamic_unpacking,
self._disable_static_unpacking,
self._sandbox_command_line_arguments,
self._sandbox_machine_type,
self._file_name,
**additional_parameters)
elif self._download_url:
Expand All @@ -185,7 +180,6 @@ def _send_analyze_to_api(self, **additional_parameters) -> str:
code_item_type=self._code_item_type,
zip_password=self._zip_password,
sandbox_command_line_arguments=self._sandbox_command_line_arguments,
sandbox_machine_type=self._sandbox_machine_type,
**additional_parameters)
else:
return self._api.analyze_by_file(self._file_path,
Expand All @@ -196,7 +190,6 @@ def _send_analyze_to_api(self, **additional_parameters) -> str:
code_item_type=self._code_item_type,
zip_password=self._zip_password,
sandbox_command_line_arguments=self._sandbox_command_line_arguments,
sandbox_machine_type=self._sandbox_machine_type,
**additional_parameters)

def get_sub_analyses(self) -> List[SubAnalysis]:
Expand Down
11 changes: 0 additions & 11 deletions intezer_sdk/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime
import logging
import os
import typing
from http import HTTPStatus
from typing import Any
from typing import BinaryIO
Expand All @@ -20,7 +19,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,12 +262,10 @@ 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,
**additional_parameters) -> str:
data = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
sandbox_command_line_arguments=sandbox_command_line_arguments,
sandbox_machine_type=sandbox_machine_type,
**additional_parameters)

data['hash'] = file_hash
Expand All @@ -286,14 +282,12 @@ 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,
**additional_parameters) -> str:
data = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
code_item_type=code_item_type,
zip_password=zip_password,
sandbox_command_line_arguments=sandbox_command_line_arguments,
sandbox_machine_type=sandbox_machine_type,
**additional_parameters)

data['download_url'] = download_url
Expand Down Expand Up @@ -324,14 +318,12 @@ 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,
**additional_parameters) -> Optional[str]:
options = self._param_initialize(disable_dynamic_unpacking=disable_dynamic_unpacking,
disable_static_unpacking=disable_static_unpacking,
code_item_type=code_item_type,
zip_password=zip_password,
sandbox_command_line_arguments=sandbox_command_line_arguments,
sandbox_machine_type=sandbox_machine_type,
**additional_parameters)

if file_stream:
Expand Down Expand Up @@ -662,7 +654,6 @@ 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,
**additional_parameters):
data = {}

Expand All @@ -676,8 +667,6 @@ def _param_initialize(disable_dynamic_unpacking: bool,
data['zip_password'] = zip_password
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

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(enum.StrEnum):
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 b56c8ad

Please sign in to comment.