Skip to content

Commit 9936530

Browse files
committed
fixed linting errors
1 parent 940e54c commit 9936530

File tree

10 files changed

+59
-48
lines changed

10 files changed

+59
-48
lines changed

Packs/EDL/EDL.zip

62 KB
Binary file not shown.

Packs/EDL/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Simple, manual process to modify external dynamic lists (EDLs) in Cortex <~XSOAR>XSOAR</~XSOAR><~XSIAM>XSIAM</~XSIAM>. This pack may help replace an existing manual process for updating firewall allowlists and blocklists, so analysts may make these changes directly in Cortex <~XSOAR>XSOAR</~XSOAR><~XSIAM>XSIAM</~XSIAM>. You just need to simply paste in a list of indicators to add or remove them from the EDL.
1+
Simple, manual process to modify external dynamic lists (EDLs) in Cortex XSOAR. This pack may help replace an existing manual process for updating firewall allowlists and blocklists, so analysts may make these changes directly in Cortex XSOAR. You just need to simply paste in a list of indicators to add or remove them from the EDL.
22

33
Note: This pack does not perform indicator type validation at this time. Indicators will be added to the EDL exactly as entered.
44

Packs/EDL/Scripts/EDLMetricWidget/EDLMetricWidget.py renamed to Packs/EDL/Scripts/EDLMetricWidget.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import requests
22
import traceback
3+
import ast
34
from requests.auth import HTTPBasicAuth
45
from datetime import date
6+
from typing import List
57
from CommonServerPython import *
68

79

810
def get_edl(instance_name):
911

10-
url = str(DemistoException.args()['server_url'])
12+
url = str(demisto.args()['server_url'])
1113
if 'https://' not in url:
1214
url = 'https://' + url
1315
port = demisto.args()['edl_port']
@@ -19,20 +21,20 @@ def get_edl(instance_name):
1921

2022
params = demisto.params()
2123
credentials = params.get('credentials') if params.get('credentials') else {}
22-
usern: str = credentials.get('identifier', '')
24+
username: str = credentials.get('identifier', '')
2325
password: str = credentials.get('password', '')
24-
if (usern and not password) or (password and not usern):
26+
if (username and not password) or (password and not username):
2527
err_msg: str = 'If using credentials, both username and password should be provided.'
2628
demisto.debug(err_msg)
2729
raise DemistoException(err_msg)
2830

29-
payload = {}
30-
headers = {}
31+
payload = {} # type: ignore
32+
headers = {} # type: ignore
3133
verify_ssl = demisto.args()['verify_ssl']
32-
if eval(verify_ssl) is False:
34+
if ast.literal_eval(verify_ssl) is False:
3335
try:
3436
# ssl._create_default_https_context = ssl._create_unverified_context
35-
response = requests.get(endpoint, verify=False, auth=HTTPBasicAuth(username, password))
37+
response = requests.get(endpoint, verify=False, auth=HTTPBasicAuth(username, password)) # nosec
3638
except AttributeError:
3739
# Legacy Python that doesn't verify HTTPS certificates by default
3840
pass
@@ -62,7 +64,7 @@ def build_widget():
6264
str_entries = demisto.executeCommand("getList", {"listName": "EDLMetrics_Size"})[0]['Contents']
6365
entries = str_entries.split(';,')
6466
entries[-1] = entries[-1].rstrip(';')
65-
builder = []
67+
builder: List[dict] = []
6668
for entry in entries:
6769
entry = json.loads(entry)
6870
date = entry['name']
@@ -82,7 +84,8 @@ def build_widget():
8284
b['groups'].append({"name": entry['groups']['name'], "data": [int(entry['groups']['data'])]})
8385
found = True
8486
if found is False:
85-
builder.append({"name": date, "data": [total], "groups": [{"name": str(entry['groups']['name']), "data": [int(entry['groups']['data'])]}]})
87+
builder.append({"name": date, "data": [total], "groups": [{"name":
88+
str(entry['groups']['name']), "data": [int(entry['groups']['data'])]}]})
8689
return builder
8790

8891

Packs/EDL/Scripts/EDLMetricWidget.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
args:
2+
- default: false
3+
description: 'Demisto server URL'
4+
isArray: false
5+
name: server_url
6+
required: true
7+
secret: false
8+
- default: true
9+
description: 'If using a port and not instance name'
10+
isArray: false
11+
name: edl_port
12+
required: false
13+
secret: false
14+
defaultValue: None
15+
- default: false
16+
description: 'Integration instances to not track or ignore in widget'
17+
isArray: false
18+
name: edl_exclusions
19+
required: false
20+
secret: false
21+
- default: true
22+
description: 'Trust any certificate (insecure)'
23+
isArray: false
24+
defaultValue: None
25+
name: verify_ssl
26+
required: false
27+
secret: false
28+
comment: 'Schedule a daily job to run this widget script in a playbook to track EDL size over time'
29+
commonfields:
30+
id: EDLMetricWidget
31+
version: -1
32+
enabled: false
33+
name: EDLMetricWidget
34+
script: '-'
35+
system: false
36+
tags:
37+
- widget
38+
timeout: '0'
39+
type: python
40+
subtype: python3
41+
dockerimage: demisto/python3:3.10.5.31797
42+
fromversion: 5.5.0

Packs/EDL/Scripts/EDLMetricWidget/EDLMetricWidget.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

Packs/EDL/Scripts/EDLMetricWidget/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

Packs/EDL/Scripts/EDLMetricWidget/test_data/basescript-dummy.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Packs/EDL/Scripts/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Schedule a daily job to run this widget script in a playbook to track EDL size over time
1+
Schedule a daily job to run this widget script as a playbook step to track EDL size over time
22

33
## Script Data
44
---
@@ -14,9 +14,9 @@ Schedule a daily job to run this widget script in a playbook to track EDL size o
1414

1515
| **Argument Name** | **Description** |
1616
| --- | --- |
17-
| server_url | Demisto server URL |
18-
| edl_port | If using a port and not instance name |
19-
| edl_exclusions | Integration instances to not track or ignore in widget |
17+
| server_url | Demisto Server URL |
18+
| edl_port | See integration documentation. Required if using a port vs. instance name. |
19+
| edl_exclusions | Integration instances to not track/ignore in widget |
2020
| verify_ssl | Trust any certificate \(insecure\) |
2121

2222
## Outputs

Packs/EDL/uploadable_packs/EDL.zip

62.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)