-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sxiuyang
committed
Sep 25, 2024
1 parent
764ae3d
commit c73750c
Showing
5 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
Binary file modified
BIN
+33.1 KB
(100%)
Solutions/Fortinet FortiNDR Cloud/Data Connectors/fortinetFortiNdrCloudDataConn.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ns/Fortinet FortiNDR Cloud/Data Connectors/fortinetFortiNdrCloudDataConn/FncRestClient.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from fnc.api import FncRestClient | ||
from fnc.errors import ErrorMessages, ErrorType, FncClientError | ||
import requests | ||
|
||
class FncSentinelRestClient(FncRestClient): | ||
def validate_request(self, req_args: dict): | ||
if not req_args or 'url' not in req_args: | ||
raise FncClientError( | ||
error_type=ErrorType.REQUEST_VALIDATION_ERROR, | ||
error_message=ErrorMessages.REQUEST_URL_NOT_PROVIDED | ||
) | ||
|
||
if 'method' not in req_args: | ||
raise FncClientError( | ||
error_type=ErrorType.REQUEST_VALIDATION_ERROR, | ||
error_message=ErrorMessages.REQUEST_METHOD_NOT_PROVIDED | ||
) | ||
|
||
def send_request(self, req_args: dict = None): | ||
url = req_args['url'] | ||
method = req_args['method'] | ||
headers = req_args.get('headers', {}) | ||
timeout = req_args.get('timeout', 70) | ||
verify = req_args.get('verify', True) | ||
parameters = req_args.get('params', {}) | ||
json = req_args.get('json', None) | ||
data = req_args.get('data', None) | ||
payload = json or data | ||
response = requests.request(method, url, headers=headers, timeout=timeout, params=parameters, json=payload, verify=verify) | ||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters