Skip to content

Commit

Permalink
fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gbouzar committed Jan 26, 2023
1 parent 940e54c commit 9936530
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 48 deletions.
Binary file added Packs/EDL/EDL.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Packs/EDL/README.md
@@ -1,4 +1,4 @@
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.
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.

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

@@ -1,13 +1,15 @@
import requests
import traceback
import ast
from requests.auth import HTTPBasicAuth
from datetime import date
from typing import List
from CommonServerPython import *


def get_edl(instance_name):

url = str(DemistoException.args()['server_url'])
url = str(demisto.args()['server_url'])
if 'https://' not in url:
url = 'https://' + url
port = demisto.args()['edl_port']
Expand All @@ -19,20 +21,20 @@ def get_edl(instance_name):

params = demisto.params()
credentials = params.get('credentials') if params.get('credentials') else {}
usern: str = credentials.get('identifier', '')
username: str = credentials.get('identifier', '')
password: str = credentials.get('password', '')
if (usern and not password) or (password and not usern):
if (username and not password) or (password and not username):
err_msg: str = 'If using credentials, both username and password should be provided.'
demisto.debug(err_msg)
raise DemistoException(err_msg)

payload = {}
headers = {}
payload = {} # type: ignore
headers = {} # type: ignore
verify_ssl = demisto.args()['verify_ssl']
if eval(verify_ssl) is False:
if ast.literal_eval(verify_ssl) is False:
try:
# ssl._create_default_https_context = ssl._create_unverified_context
response = requests.get(endpoint, verify=False, auth=HTTPBasicAuth(username, password))
response = requests.get(endpoint, verify=False, auth=HTTPBasicAuth(username, password)) # nosec
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by default
pass
Expand Down Expand Up @@ -62,7 +64,7 @@ def build_widget():
str_entries = demisto.executeCommand("getList", {"listName": "EDLMetrics_Size"})[0]['Contents']
entries = str_entries.split(';,')
entries[-1] = entries[-1].rstrip(';')
builder = []
builder: List[dict] = []
for entry in entries:
entry = json.loads(entry)
date = entry['name']
Expand All @@ -82,7 +84,8 @@ def build_widget():
b['groups'].append({"name": entry['groups']['name'], "data": [int(entry['groups']['data'])]})
found = True
if found is False:
builder.append({"name": date, "data": [total], "groups": [{"name": str(entry['groups']['name']), "data": [int(entry['groups']['data'])]}]})
builder.append({"name": date, "data": [total], "groups": [{"name":
str(entry['groups']['name']), "data": [int(entry['groups']['data'])]}]})
return builder


Expand Down
42 changes: 42 additions & 0 deletions Packs/EDL/Scripts/EDLMetricWidget.yml
@@ -0,0 +1,42 @@
args:
- default: false
description: 'Demisto server URL'
isArray: false
name: server_url
required: true
secret: false
- default: true
description: 'If using a port and not instance name'
isArray: false
name: edl_port
required: false
secret: false
defaultValue: None
- default: false
description: 'Integration instances to not track or ignore in widget'
isArray: false
name: edl_exclusions
required: false
secret: false
- default: true
description: 'Trust any certificate (insecure)'
isArray: false
defaultValue: None
name: verify_ssl
required: false
secret: false
comment: 'Schedule a daily job to run this widget script in a playbook to track EDL size over time'
commonfields:
id: EDLMetricWidget
version: -1
enabled: false
name: EDLMetricWidget
script: '-'
system: false
tags:
- widget
timeout: '0'
type: python
subtype: python3
dockerimage: demisto/python3:3.10.5.31797
fromversion: 5.5.0
26 changes: 0 additions & 26 deletions Packs/EDL/Scripts/EDLMetricWidget/EDLMetricWidget.yml

This file was deleted.

5 changes: 0 additions & 5 deletions Packs/EDL/Scripts/EDLMetricWidget/README.md

This file was deleted.

This file was deleted.

File renamed without changes.
8 changes: 4 additions & 4 deletions Packs/EDL/Scripts/README.md
@@ -1,4 +1,4 @@
Schedule a daily job to run this widget script in a playbook to track EDL size over time
Schedule a daily job to run this widget script as a playbook step to track EDL size over time

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

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

## Outputs
Expand Down
Binary file added Packs/EDL/uploadable_packs/EDL.zip
Binary file not shown.

0 comments on commit 9936530

Please sign in to comment.