-
Notifications
You must be signed in to change notification settings - Fork 0
[Internal] SentinelOne v2 3.2.37 #4
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
Changes from 8 commits
792e37b
d7abc88
6b98e86
ad1f652
162a032
c21d15d
117060d
be5d4d9
94dde10
aea2216
76320d6
825326f
79b96f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1039,6 +1039,14 @@ def get_remote_script_results_request(self, computer_names: list, task_ids: list | |
| response = self._http_request(method='POST', url_suffix=endpoint_url, json_data=payload) | ||
| return response.get("data", {}).get("download_links", []) | ||
|
|
||
| def list_installed_applications_request(self, params: dict): | ||
| response = self._http_request(method='GET', url_suffix='singularity-marketplace/applications', params=params) | ||
| return response.get('data', []), response.get('pagination', {}) | ||
|
|
||
| def get_service_users_request(self, params: dict): | ||
| response = self._http_request(method='GET', url_suffix='service-users', params=params) | ||
| return response.get('data', []), response.get('pagination', {}) | ||
|
|
||
| def remove_empty_fields(self, json_payload): | ||
| """ | ||
| Removes empty fields from a JSON payload and returns a new JSON object with non-empty fields. | ||
|
|
@@ -3433,6 +3441,144 @@ def get_power_query_results(client: Client, args: dict): | |
| return poll_power_query_results(client=client, cmd="sentinelone-get-power-query-results", args=args) | ||
|
|
||
|
|
||
| def list_installed_singu_mark_apps_command(client: Client, args: dict) -> CommandResults: | ||
| """ | ||
| List all installed applications matching the input filter | ||
| """ | ||
| # Get arguments | ||
| query_params = assign_params( | ||
| accountIds=args.get('account_ids'), | ||
| applicationCatalogId=args.get('application_catalog_id'), | ||
| creator__contains=args.get('creator_contains'), | ||
| cursor=args.get('cursor'), | ||
| id=args.get('id'), | ||
| limit=int(args.get('limit', 1000)), | ||
| name__contains=args.get('name_contains'), | ||
| siteIds=args.get('site_ids') | ||
| ) | ||
|
|
||
| # Make request and get raw response | ||
| installed_applications, pagination = client.list_installed_applications_request(query_params) | ||
|
|
||
| if pagination and pagination.get("nextCursor") is not None: | ||
| demisto.results("Use the below cursor value to get the next page installed applications \n {}".format( | ||
| pagination['nextCursor'])) | ||
| all_scopes = [] | ||
| if installed_applications: | ||
| for each_app in installed_applications: | ||
| scopes = each_app.get("scopes") | ||
| if scopes is not None and len(scopes) > 0: | ||
| for scope in scopes: | ||
| scope["applicationCatalogId"] = each_app["applicationCatalogId"] | ||
| scope["applicationCatalogName"] = each_app["name"] | ||
| all_scopes.append(scope) | ||
| meta = "Provides summary information and details for all the installed applications that matched your search criteria." | ||
| else: | ||
| meta = "The search filters provided are returning no results. Please review and adjust them accordingly." | ||
|
|
||
| context_entries = [] | ||
| for each_scope in all_scopes: | ||
| entry = { | ||
| 'ID': each_scope.get('id'), | ||
| 'Account': each_scope.get('account'), | ||
| 'AccountId': each_scope.get('accountId'), | ||
| 'ApplicationCatalogId': each_scope.get('applicationCatalogId'), | ||
| 'applicationCatalogName': each_scope.get('applicationCatalogName'), | ||
| 'AlertMessage': each_scope.get('alertMessage'), | ||
| 'CreatedAt': each_scope.get('createdAt'), | ||
| 'Creator': each_scope.get('creator'), | ||
| 'CreatorId': each_scope.get('creatorId'), | ||
| 'DesiredStatus': each_scope.get('desiredStatus'), | ||
| 'HasAlert': each_scope.get('hasAlert'), | ||
| 'LastEntityCreatedAt': each_scope.get('lastEntityCreatedAt'), | ||
| 'Modifier': each_scope.get('modifier'), | ||
| 'ModifierId': each_scope.get('modifierId'), | ||
| 'ScopeId': each_scope.get('scopeId'), | ||
| 'ScopeLevel': each_scope.get('scopeLevel'), | ||
| 'Status': each_scope.get('status'), | ||
| 'UpdatedAt': each_scope.get('updatedAt'), | ||
| 'ApplicationInstanceName': each_scope.get('applicationInstanceName'), | ||
saurabh-metron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| context_entries.append(entry) | ||
|
|
||
| return CommandResults( | ||
| readable_output=tableToMarkdown( | ||
| 'SentinelOne - List of Installed Applications', | ||
| context_entries, | ||
| headerTransform=pascalToSpace, | ||
| removeNull=True, | ||
| metadata=meta | ||
| ), | ||
| outputs_prefix='SentinelOne.InstalledApps', | ||
| outputs_key_field='ID', | ||
| outputs=context_entries, | ||
| raw_response=installed_applications) | ||
|
|
||
|
|
||
| def get_service_users_command(client: Client, args: dict) -> CommandResults: | ||
| """ | ||
| Get all service users matching the input filter | ||
| """ | ||
| # Get arguments | ||
| query_params = assign_params( | ||
saurabh-metron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| accountIds=args.get('account_ids'), | ||
| roleIds=args.get('role_ids'), | ||
| cursor=args.get('cursor'), | ||
| ids=args.get('ids'), | ||
| limit=int(args.get('limit', 1000)), | ||
| siteIds=args.get('site_ids') | ||
| ) | ||
| # Make request and get raw response | ||
| service_users, pagination = client.get_service_users_request(query_params) | ||
|
|
||
| if pagination and pagination.get("nextCursor") is not None: | ||
| demisto.results("Use the below cursor value to get the next page service users \n {}".format( | ||
|
||
| pagination['nextCursor'])) | ||
|
|
||
| context_entries = [] | ||
| if service_users: | ||
| for each_service_user in service_users: | ||
| entry = { | ||
| 'ID': each_service_user.get('id'), | ||
| 'ApiTokenCreatedAt': each_service_user.get('apiToken', {}).get('createdAt'), | ||
| 'ApiTokenExpiresAt': each_service_user.get('apiToken', {}).get('expiresAt'), | ||
| 'CreatedAt': each_service_user.get('createdAt'), | ||
| 'CreatedById': each_service_user.get('createdBy', {}).get('id'), | ||
| 'CreatedByName': each_service_user.get('createdBy', {}).get('name'), | ||
| 'Description': each_service_user.get('description'), | ||
| 'LastActivation': each_service_user.get('lastActivation'), | ||
| 'Name': each_service_user.get('name'), | ||
| 'Scope': each_service_user.get('scope'), | ||
| 'UpdatedAt': each_service_user.get('updatedAt'), | ||
| 'UpdatedById': each_service_user.get('updatedBy', {}).get("id"), | ||
| 'UpdatedByName': each_service_user.get('updatedBy', {}).get("name"), | ||
| } | ||
| if each_service_user.get('scopeRoles') and len(each_service_user.get('scopeRoles')) > 0: | ||
| scope_role_items = each_service_user['scopeRoles'][0] | ||
| if scope_role_items: | ||
| entry['ScopeRolesRoleId'] = scope_role_items.get('roleId') | ||
| entry['ScopeRolesRoleName'] = scope_role_items.get('roleName') | ||
| entry['ScopeRolesAccountName'] = scope_role_items.get('accountName') | ||
| entry['ScopeRolesId'] = scope_role_items.get('id') | ||
| context_entries.append(entry) | ||
| meta = "Provides summary information and details for all the service users that matched your search criteria." | ||
| else: | ||
| meta = "The search filters provided are returning no results. Please review and adjust them accordingly." | ||
|
|
||
| return CommandResults( | ||
| readable_output=tableToMarkdown( | ||
| 'SentinelOne - Get Service Users', | ||
| context_entries, | ||
| headerTransform=pascalToSpace, | ||
| removeNull=True, | ||
| metadata=meta | ||
| ), | ||
| outputs_prefix='SentinelOne.ServiceUsers', | ||
| outputs_key_field='ID', | ||
| outputs=context_entries, | ||
| raw_response=service_users) | ||
|
|
||
|
|
||
| def get_mapping_fields_command(): | ||
| """ | ||
| Returns the list of fields to map in outgoing mirroring, for incidents. | ||
|
|
@@ -3872,6 +4018,8 @@ def main(): | |
| 'sentinelone-get-remote-script-task-results': get_remote_script_results, | ||
| 'sentinelone-remote-script-automate-results': remote_script_automate_results, | ||
| 'sentinelone-get-power-query-results': get_power_query_results, | ||
| 'sentinelone-list-installed-singularity-marketplace-applications': list_installed_singu_mark_apps_command, | ||
| 'sentinelone-get-service-users': get_service_users_command, | ||
| }, | ||
| 'commands_with_params': { | ||
| 'get-remote-data': get_remote_data_command, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.