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

GetIndicatorDBotScoreFromContext Automation #28576

Merged
merged 4 commits into from
Jul 30, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Packs/CommunityCommonScripts/ReleaseNotes/1_1_0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### New: GetIndicatorCustomFieldsByQuery

- New: Returns indicator custom fields into the context by the given query. (Available from Cortex XSOAR 6.9.0).
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401

"""
Searches the TIM DB for device indicators based on the provided query string and returns along with their custom fields.
"""


def search_indicators(query, max_size):
result = []
indicators = demisto.searchIndicators(
query=query,
size=max_size, page=0
)

for indicator in indicators.get("iocs"):
indicator_dict = {
"value": indicator.get("value"),
"type": indicator.get("indicator_type")
}

if (indicator.get("CustomFields")):
indicator_dict = {**indicator_dict, **indicator.get("CustomFields")}
result.append(indicator_dict)

return result


def main():
query = demisto.args().get("query", "")
max_size = arg_to_number(demisto.args().get("max", 1000))
outputs = search_indicators(query, max_size)
return_results(
CommandResults(
outputs_prefix="GetIndicatorCustomFieldsByQuery",
outputs=outputs,
readable_output=tableToMarkdown("Indicator Query Result", outputs)
))


if __name__ in ('__main__', '__builtin__', 'builtins'):
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
commonfields:
id: GetIndicatorCustomFieldsByQuery
version: -1
name: GetIndicatorCustomFieldsByQuery
script: ''
type: python
tags: []
comment: Returns indicator custom fields into the context by the given query.
enabled: true
args:
- name: query
description: The complete XSOAR indicator query.
outputs:
- contextPath: GetIndicatorFieldsByQuery
description: The matched indicator value, type, and custom fields.
scripttarget: 0
subtype: python3
runonce: false
dockerimage: demisto/python3:3.10.12.66339
runas: DBotWeakRole
fromversion: 6.9.0
tests:
- No tests (auto formatted)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Purpose: This automation will return indicator custom fields into the context by the given query.
Author: Mahmood Azmat
Input1: Query for retrieving indicator(s).


## Script Data

---

| **Name** | **Description** |
| --- | --- |
| Script Type | python3 |
| Cortex XSOAR Version | 6.9.0 |

## Inputs

---

| **Argument Name** | **Description** |
| --- | --- |
| query | The complete XSOAR indicator query. |

## Outputs

---

| **Path** | **Description** | **Type** |
| --- | --- | --- |
| GetIndicatorFieldsByQuery | The matched indicator value, type, and custom fields. | Unknown |
2 changes: 1 addition & 1 deletion Packs/CommunityCommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Community Common Scripts",
"description": "A pack that contains community scripts",
"support": "community",
"currentVersion": "1.0.15",
"currentVersion": "1.1.0",
"author": "",
"url": "https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/bd-p/Cortex_XSOAR_Discussions",
"email": "",
Expand Down