Fixed the responder and improvment
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
cortexutils
|
||||||
|
requests
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"url": "https://github.com/frikky/shuffle",
|
"url": "https://github.com/frikky/shuffle",
|
||||||
"license": "AGPL-V3",
|
"license": "AGPL-V3",
|
||||||
"description": "Execute a workflow in Shuffle",
|
"description": "Execute a workflow in Shuffle",
|
||||||
"dataTypeList": ["thehive:case", "thehive:alert"],
|
"dataTypeList": ["thehive:case", "thehive:alert", "thehive:case_artifact"],
|
||||||
"command": "Shuffle/shuffle.py",
|
"command": "Shuffle/shuffle.py",
|
||||||
"baseConfig": "Shuffle",
|
"baseConfig": "Shuffle",
|
||||||
"configurationItems": [
|
"configurationItems": [
|
||||||
@@ -24,6 +24,14 @@
|
|||||||
"multi": false,
|
"multi": false,
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "verifyssl",
|
||||||
|
"description": "Verify SSL certificate",
|
||||||
|
"type": "boolean",
|
||||||
|
"multi": false,
|
||||||
|
"required": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "workflow_id",
|
"name": "workflow_id",
|
||||||
"description": "The ID of the workflow to execute",
|
"description": "The ID of the workflow to execute",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
#!/usr/bin/env python
|
#encoding: utf-8
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
from cortexutils.responder import Responder
|
from cortexutils.responder import Responder
|
||||||
import requests
|
import requests
|
||||||
@@ -11,18 +10,17 @@ class Shuffle(Responder):
|
|||||||
self.api_key = self.get_param("config.api_key", "")
|
self.api_key = self.get_param("config.api_key", "")
|
||||||
self.url = self.get_param("config.url", "")
|
self.url = self.get_param("config.url", "")
|
||||||
self.workflow_id = self.get_param("config.workflow_id", "")
|
self.workflow_id = self.get_param("config.workflow_id", "")
|
||||||
|
self.verify = self.get_param('config.verifyssl', True, None)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
Responder.run(self)
|
Responder.run(self)
|
||||||
|
|
||||||
parsed_url = "%s/api/v1/workflows/%s/execute" % (self.url, self.workflow_id)
|
parsed_url = "%s/api/v1/workflows/%s/execute" % (self.url, self.workflow_id)
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": "Bearer %s" % self.api_key
|
"Authorization": "Bearer %s" % self.api_key
|
||||||
}
|
}
|
||||||
requests.post(parsed_url, headers=headers)
|
requests.post(parsed_url, headers=headers,verify=self.verify)
|
||||||
|
|
||||||
self.report({'message': 'message sent'})
|
self.report({'message': 'message sent'})
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Shuffle().run()
|
Shuffle().run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user