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

Version 1.2.1 - Minor docstring updates. Add post_device_details_v2 alias. #777

Merged
merged 8 commits into from
Sep 9, 2022
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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Version 1.2.1
## Added features and functionality
+ Added: Added alias for `post_device_details_v2` to Hosts Service Class. Closes #773.
- `hosts.py`
- `tests/manual/test_get_device_details.py`

## Issues resolved
+ Fixed: Typo in docstring for `perform_incident_action` method. Closes #776.
- `incidents.py`
+ Fixed: Added `host_timeout_duration` documentation to docstrings within operations in the Real Time Response Service Class.
- `real_time_response.py`

## Other
+ Updated: Adjusted unit testing to cover new API returns.
- `tests/falcon_container.py`
- `tests/kubernetes_protection.py`

# Version 1.2.0
## Added features and functionality
+ Updated: Updated operation payload parameter datatype details.
Expand Down
2 changes: 1 addition & 1 deletion src/falconpy/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

For more information, please refer to <https://unlicense.org>
"""
_VERSION = '1.2.0'
_VERSION = '1.2.1'
_MAINTAINER = 'Joshua Hiller'
_AUTHOR = 'CrowdStrike'
_AUTHOR_EMAIL = 'falconpy@crowdstrike.com'
Expand Down
1 change: 1 addition & 0 deletions src/falconpy/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def query_network_address_history(self: object, *args, body: dict = None, **kwar
GetDeviceDetailsV1 = get_device_details_v1
GetDeviceDetailsV2 = get_device_details_v2
PostDeviceDetailsV2 = get_device_details
post_device_details_v2 = get_device_details
QueryHiddenDevices = query_hidden_devices
GetOnlineState_V1 = get_online_state
get_online_state_v1 = get_online_state # Issue 739 Helper alias
Expand Down
4 changes: 3 additions & 1 deletion src/falconpy/incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def get_behaviors(self: object, body: dict = None, **kwargs) -> dict:
def perform_incident_action(self: object, body: dict = None, **kwargs) -> dict:
"""Perform a set of actions on one or more incidents.

Such as: adding tags or comments or updating the incident name or description.
Such as: adding tags or updating the incident name or description.

A maximum of 5000 incidents may be updated per request.

Keyword arguments:
action_parameters -- Action specific parameters. List of dictionaries.
Expand Down
16 changes: 16 additions & 0 deletions src/falconpy/real_time_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def batch_active_responder_command(self: object,
Refer to the RTR documentation for the full list of commands.
batch_id -- Batch ID to execute the command on. Received from batch_init_session. String.
command_string -- Full command string for the command. For example `get some_file.txt`.
host_timeout_duration -- Timeout duration for how long a host has time to complete processing.
Default value is a bit less than the overall timeout value.
It cannot be greater than the overall request timeout. Maximum is < 10 minutes.
Example, `10s`. Valid units: `ns, us, ms, s, m, h`.
optional_hosts -- List of a subset of hosts we want to run the command on.
If this list is supplied, only these hosts will receive the command.
parameters -- full parameters payload in JSON format. Not required if using other keywords.
Expand Down Expand Up @@ -210,6 +214,10 @@ def batch_command(self: object, body: dict = None, parameters: dict = None, **kw
Refer to the RTR documentation for the full list of commands.
batch_id -- Batch ID to execute the command on. Received from batch_init_session. String.
command_string -- Full command string for the command. For example `get some_file.txt`.
host_timeout_duration -- Timeout duration for how long a host has time to complete processing.
Default value is a bit less than the overall timeout value.
It cannot be greater than the overall request timeout. Maximum is < 10 minutes.
Example, `10s`. Valid units: `ns, us, ms, s, m, h`.
optional_hosts -- List of a subset of hosts we want to run the command on.
If this list is supplied, only these hosts will receive the command.
parameters -- full parameters payload in JSON format. Not required if using other keywords.
Expand Down Expand Up @@ -296,6 +304,10 @@ def batch_get_command(self: object,

batch_id -- Batch ID to execute the command on. Received from batch_init_session. String.
file_path -- Full path to the file that is to be retrieved from each host in the batch.
host_timeout_duration -- Timeout duration for how long a host has time to complete processing.
Default value is a bit less than the overall timeout value.
It cannot be greater than the overall request timeout. Maximum is < 10 minutes.
Example, `10s`. Valid units: `ns, us, ms, s, m, h`.
optional_hosts -- List of a subset of hosts we want to run the command on.
If this list is supplied, only these hosts will receive the command.
parameters -- full parameters payload in JSON format. Not required if using other keywords.
Expand Down Expand Up @@ -349,6 +361,10 @@ def batch_init_sessions(self: object,
existing_batch_id -- Optional batch ID. Use an existing batch ID if you want to
initialize new hosts and add them to the existing batch. String.
host_ids -- List of host agent ID's to initialize a RTR session on. List of strings.
host_timeout_duration -- Timeout duration for how long a host has time to complete processing.
Default value is a bit less than the overall timeout value.
It cannot be greater than the overall request timeout. Maximum is < 10 minutes.
Example, `10s`. Valid units: `ns, us, ms, s, m, h`.
queue_offline -- Boolean indicating if the command should be queued for execution when
the host returns online.
parameters -- full parameters payload in JSON format. Not required if using other keywords.
Expand Down
12 changes: 12 additions & 0 deletions tests/manual/test_get_device_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def new_pep_syntax(self):
returned = True
return returned

def alias_pep_syntax(self):
"""Test the new PostDeviceDetailsV2 operation using PEP 8 syntax."""
returned = False
if self.get_a_device_id():
if self.valid_status_code(falcon.post_device_details_v2(ids=DEVICE_ID)):
returned = True
return returned

def redirected_pep_syntax(self):
"""Tests PEP 8 syntax variations using the newly redirected method."""
returned = self.get_a_device_id()
Expand Down Expand Up @@ -141,6 +149,10 @@ def test_new_pep_syntax(self):
"""Pytest harness hook."""
assert self.new_pep_syntax() is True

def test_alias_pep_syntax(self):
"""Pytest harness hook."""
assert self.alias_pep_syntax() is True

def test_redirected_opid_syntax(self):
"""Pytest harness hook."""
assert self.redirected_opid_syntax() is True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_falcon_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
client_secret=falcon.auth_object.creds["client_secret"],
base_url=falcon.auth_object.base_url
)
AllowedResponses = [200, 201, 400, 403, 404, 429] # Allowing 400 for now
AllowedResponses = [200, 201, 400, 403, 404, 429, 502] # Allowing no content returned as code paths are confirmed


class TestFalconContainer:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_kubernetes_protection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
auth = Authorization.TestAuthorization()
config = auth.getConfigObject()
falcon = KubernetesProtection(auth_object=config)
AllowedResponses = [200, 207, 400, 404, 403, 429, 500] # Allowing 500 to reduce flakiness
AllowedResponses = [200, 201, 207, 400, 404, 403, 429, 500] # Allowing 500 to reduce flakiness


class TestKubeProtect:
Expand Down