Merge pull request #366 from azgaviperr/thehive_responder
Cortex responder
This commit is contained in:
@@ -15,8 +15,8 @@ SHUFFLE_DOWNLOAD_AUTH_BRANCH=
|
|||||||
SHUFFLE_APP_FORCE_UPDATE=false
|
SHUFFLE_APP_FORCE_UPDATE=false
|
||||||
|
|
||||||
# User config for first load. Username & PW: min length 3
|
# User config for first load. Username & PW: min length 3
|
||||||
SHUFFLE_DEFAULT_USERNAME=
|
SHUFFLE_DEFAULT_USERNAME=shuffle
|
||||||
SHUFFLE_DEFAULT_PASSWORD=
|
SHUFFLE_DEFAULT_PASSWORD==Fr1kky1sN0t@D0g
|
||||||
SHUFFLE_DEFAULT_APIKEY=
|
SHUFFLE_DEFAULT_APIKEY=
|
||||||
|
|
||||||
# Local location of your app directory. Can't use ~/
|
# Local location of your app directory. Can't use ~/
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -7,7 +7,8 @@ The Docker setup is done with docker-compose and is a single command to get set
|
|||||||
**PS: if you're setting up Shuffle on Windows, go to the next step (Windows Docker setup)**
|
**PS: if you're setting up Shuffle on Windows, go to the next step (Windows Docker setup)**
|
||||||
|
|
||||||
1. Make sure you have Docker and [docker-compose](https://docs.docker.com/compose/install/) installed.
|
1. Make sure you have Docker and [docker-compose](https://docs.docker.com/compose/install/) installed.
|
||||||
2. Run docker-compose.
|
2. Adapt the .env file to your convenience.
|
||||||
|
3. Run docker-compose.
|
||||||
```
|
```
|
||||||
git clone https://github.com/frikky/Shuffle
|
git clone https://github.com/frikky/Shuffle
|
||||||
cd Shuffle
|
cd Shuffle
|
||||||
|
|||||||
@@ -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,28 +1,27 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
class Shuffle(Responder):
|
class Shuffle(Responder):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Responder.__init__(self)
|
Responder.__init__(self)
|
||||||
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)
|
||||||
|
headers = {
|
||||||
|
"Authorization": "Bearer %s" % self.api_key,
|
||||||
|
"User-Agent": "Cortex-Analyzer"
|
||||||
|
}
|
||||||
|
requests.post(parsed_url, headers=headers,verify=self.verify)
|
||||||
|
|
||||||
parsed_url = "%s/api/v1/workflows/%s/execute" % (self.url, self.workflow_id)
|
self.report({'message': 'message sent'})
|
||||||
headers = {
|
|
||||||
"Authorization": "Bearer %s" % self.api_key
|
|
||||||
}
|
|
||||||
requests.post(parsed_url, headers=headers)
|
|
||||||
|
|
||||||
self.report({'message': 'message sent'})
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Shuffle().run()
|
Shuffle().run()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cortexutils
|
||||||
|
requests
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "Shuffle_webhook",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "@azgaviperr",
|
||||||
|
"url": "https://github.com/frikky/shuffle",
|
||||||
|
"license": "AGPL-V3",
|
||||||
|
"description": "Execute a webhook in Shuffle",
|
||||||
|
"dataTypeList": ["thehive:case", "thehive:alert", "thehive:case_artifact"],
|
||||||
|
"command": "Shuffle_Webhook/shuffle_webhook.py",
|
||||||
|
"baseConfig": "Shuffle_Webhook",
|
||||||
|
"configurationItems": [
|
||||||
|
{
|
||||||
|
"name": "webhook_url",
|
||||||
|
"description": "The URL to your shuffle instance",
|
||||||
|
"type": "string",
|
||||||
|
"multi": false,
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "verifyssl",
|
||||||
|
"description": "Verify SSL certificate",
|
||||||
|
"type": "boolean",
|
||||||
|
"multi": false,
|
||||||
|
"required": true,
|
||||||
|
"defaultValue": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#encoding: utf-8
|
||||||
|
|
||||||
|
from cortexutils.responder import Responder
|
||||||
|
import requests
|
||||||
|
|
||||||
|
class Shuffle(Responder):
|
||||||
|
def __init__(self):
|
||||||
|
Responder.__init__(self)
|
||||||
|
self.api_key = self.get_param("config.api_key", "")
|
||||||
|
self.webhook_url = self.get_param("config.webhook_url", "")
|
||||||
|
self.webhook_id = self.get_param("config.webhook_id", "")
|
||||||
|
self.verify = self.get_param('config.verifyssl', True, None)
|
||||||
|
self.data = self.get_param('data')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
Responder.run(self)
|
||||||
|
headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"User-Agent": "Cortex-Analyzer"
|
||||||
|
}
|
||||||
|
requests.post(self.webhook_url, headers=headers,verify=self.verify, json=self.data)
|
||||||
|
|
||||||
|
self.report({'message': 'message sent'})
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Shuffle().run()
|
||||||
Reference in New Issue
Block a user