Skip to content

Commit b411eff

Browse files
jshcodesShane ShellenbargerCalebSchwartz
authored
[DEPLOY] Version 0.4.4 Update - Sensor Download Service Class, Fixes (#118)
* Update label_request.yml Labeller fails on forks, removing workflow from dev branches. * Sample code: Sample Uploads API * Code sample: Sample Uploads API * Sample config.json file * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Documentation updates * Uploading simple example of containing and uncontaining a host via API * Documentation updates * Documentation updates * Documentation updates * Update labeler.yml Added code samples label tagging * Update labeler.yml * Update wordlist.txt * Linting * Update linting.yml * Sample Uploads sample adjustments * Added samples to bandit analysis * Update bandit.yml * Documentation updates * Documentation updates * Documentation updates * Falcon Discover example * Update bandit.yml Bandit analysis of samples no longer stops the build * Adjustments * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update labeler.yml * Update test_uber_api_complete.py * Comment update * Update bandit.yml * Update linting.yml * Update unit_testing.yml * Update dev-deploy.yml * Issue #114 - action_name parameter fix * Updated unit tests for issue #114 * Feature/sensordownloads (#113) * function stubs * function stubs * added base functionality for interacting with sensor download api * updated readme with file path * writing downloaded sensor * adding tests for sensor_download.py * working pytests * Update tests/test_sensor_download.py * added ok result, decorators and moved sensor download code w/ some fixes * Update _util.py Headers should return a dictionary not a list * Update _util.py Resolves linting issue * Update _util.py More linting * Update src/falconpy/sensor_download.py * Update src/falconpy/sensor_download.py * Update src/falconpy/sensor_download.py * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update test_uber_api_complete.py * Update sensor_download.py Realized what was bothering me here. The DownloadSensorInstallerById endpoint doesn't define the ?id={} variable in _endpoints.py because there is only one ID, so it's not an array. This means we can easily pass it as part of the parameters dictionary instead. Couple of other minor pattern updates. * Update test_sensor_download.py * Update sensor_download.py Ooops * Update sensor_download.py * Update sensor_download.py * Update tests/test_sensor_download.py Co-authored-by: Caleb Schwartz <[email protected]> Co-authored-by: jshcodes <[email protected]> * Updated unit test to complete coverage * Documentation updates * Parameter handling fix * Updated sample to reflect fix for issue #114 * Labelling updates to cover unit testing * Bump version 0.4.3 -> 0.4.4 Co-authored-by: Shane Shellenbarger <[email protected]> Co-authored-by: rewgord <[email protected]> Co-authored-by: Caleb Schwartz <[email protected]>
1 parent efef8ed commit b411eff

25 files changed

+224
-23
lines changed

.github/labeler.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ pipeline:
1515
- .github/ISSUE_TEMPLATE/*
1616

1717
unit testing:
18-
- any: ['tests/*', 'util/*']
18+
- tests/*
19+
- util/*
1920

2021
code samples:
2122
- samples/*.py

.github/workflows/bandit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
name: Bandit
22
on:
33
push:
4+
paths:
5+
- '**.py'
46
branches:
57
- main
68
- 'ver_*'
79
pull_request:
10+
paths:
11+
- '**.py'
812
branches:
913
- main
1014
- 'ver_*'

.github/workflows/dev-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Test Package Build and Deploy
22

33
on:
44
push:
5+
paths:
6+
- '**.py'
57
branches:
68
- main
79

.github/workflows/linting.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
name: Flake8
22
on:
33
push:
4+
paths:
5+
- '**.py'
46
branches:
57
- main
68
- 'ver_*'
79
pull_request:
10+
paths:
11+
- '**.py'
812
branches:
913
- main
1014
- 'ver_*'

.github/workflows/unit_testing.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Python package
22
on:
33
push:
4+
paths:
5+
- '**.py'
46
branches: [ main ]
57
pull_request:
8+
paths:
9+
- '**.py'
610
branches:
711
- main
812
- 'ver_*'

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ env/
88
.vscode/
99
build/
1010
dist
11-
falconpy.egg-info/
12-
__pycache__/
11+
*.egg-info/
12+
sensor_downloads/
13+
__pycache__/
14+
.env
15+
.coverage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $ python3 -m pip uninstall crowdstrike-falconpy
5757
| [CrowdStrike Real Time Response (RTR) APIs](https://falcon.crowdstrike.com/support/documentation/90/real-time-response-apis) | [real_time_response.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/real_time_response.py) |
5858
| [CrowdStrike Realtime Response (RTR) Administration API](https://falcon.crowdstrike.com/support/documentation/90/real-time-response-apis) | [real_time_response_admin.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/real_time_response_admin.py) |
5959
| CrowdStrike Sample Uploads API | [sample_uploads.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/sample_uploads.py) |
60-
| [CrowdStrike Sensor Download APIs](https://falcon.crowdstrike.com/support/documentation/109/sensor-download-apis) | *Coming Soon* |
60+
| [CrowdStrike Sensor Download APIs](https://falcon.crowdstrike.com/support/documentation/109/sensor-download-apis) | [sensor_download.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/sensor_download.py) |
6161
| [CrowdStrike Spotlight APIs](https://falcon.crowdstrike.com/support/documentation/98/spotlight-apis) | [spotlight_vulnerabilities.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/spotlight_vulnerabilities.py) |
6262
| [CrowdStrike User and Roles API](https://falcon.crowdstrike.com/support/documentation/87/users-and-roles-apis) | [user_management.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/user_management.py) |
6363
| [Falcon Discover for Cloud and Containers - AWS Accounts APIs](https://falcon.crowdstrike.com/support/documentation/91/discover-for-aws-apis) | [cloud_connect_aws.py](https://github.com/CrowdStrike/falconpy/blob/main/src/falconpy/cloud_connect_aws.py) |

samples/real_time_response/quarantine_hosts.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@
8383
print(f"\n[+] Lifting Containment: {hostname}\n")
8484

8585
# Perform the requested action
86-
# TODO: Get rid of action_name="contain" once bug is resolved
87-
# BUG: https://github.com/CrowdStrike/falconpy/issues/114
88-
response = falcon.PerformActionV2(parameters=PARAMS, body=BODY,
89-
action_name="contain")
86+
response = falcon.PerformActionV2(parameters=PARAMS, body=BODY)
9087
# Output the result
9188
print(json.dumps(response, indent=4))

src/falconpy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This folder contains the FalconPy project, a Python 3 interface handler for the
2222
+ `real_time_response_admin.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/real-time-response-admin
2323
+ `real_time_response.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/real-time-response
2424
+ `sample_uploads.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/sample-uploads
25+
+ `sensor_download.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/sensor-download
2526
+ `sensor_update_policy.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/sensor-update-policies
2627
+ `spotlight_vulnerabilities.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/spotlight-vulnerabilities
2728
+ `user_management.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/user-management
@@ -35,7 +36,6 @@ This folder contains the FalconPy project, a Python 3 interface handler for the
3536
+ `ml_exclusions.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/ml-exclusions
3637
+ `sensor_visibility_exclusions.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/sensor-visibility-exclusions
3738
+ `quick_scan.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/quick-scan
38-
+ `sensor_download.py` https://assets.falcon.crowdstrike.com/support/api/swagger.html#/sensor-download
3939

4040
## The Uber Class
4141
### A single class to interface with the entire API

src/falconpy/_util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,7 @@ def perform_request(method: str = "", endpoint: str = "", headers: dict = None,
190190
def generate_error_result(message: str = "An error has occurred. Check your payloads and try again.", code: int = 500) -> dict:
191191
""" Normalized error messaging handler. """
192192
return Result()(status_code=code, headers={}, body={"errors": [{"message": f"{message}"}], "resources": []})
193+
194+
195+
def generate_ok_result(message: str = "Request returned with success", code: int = 200) -> dict:
196+
return Result()(status_code=code, headers={}, body={"message": message, "resources": []})

0 commit comments

Comments
 (0)