Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responder/umbrella blacklister #383

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions responders/UmbrellaBlacklister/UmbrellaBlacklister.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Umbrella Blacklister",
"version": "1.0",
"author": "Kyle Parrish",
"url": "https://github.com/TheHive-Project/Cortex-Analyzers",
"license": "AGPL-V3",
"description": "Add domain to Umbrella blacklist via Enforcement API.",
"dataTypeList": ["thehive:case_artifact"],
"command": "UmbrellaBlacklister/UmbrellaBlacklister.py",
"baseConfig": "UmbrellaBlacklister",
"configurationItems": [
{
"name": "integration_url",
"description": "Custom integration url",
"type": "string",
"multi": false,
"required": true
}
]
}
51 changes: 51 additions & 0 deletions responders/UmbrellaBlacklister/UmbrellaBlacklister.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python
# encoding: utf-8

from cortexutils.responder import Responder
import requests
from datetime import datetime

class UmbrellaBlacklister(Responder):
def __init__(self):
Responder.__init__(self)
self.integration_url = self.get_param('config.integration_url', None, "Integration URL Missing")

def run(self):
Responder.run(self)

if self.get_param('data.dataType') == 'domain':

domain = self.get_param('data.data', None, 'No artifacts available')

dstUrl = "http://" + domain
date = datetime.now().strftime("%Y-%m-%dT%XZ")

headers = {
'user-agent': 'UmbrellaBlacklister-Cortex-Responder',
'Content-Type': 'application/json'
}

payload = {
"alertTime": date,
"deviceId": "cortex_thehive",
"deviceVersion": "2.4.81",
"dstDomain": domain,
"dstUrl": dstUrl,
"eventTime": date,
"protocolVersion": "1.0a",
"providerName": "Security Platform"
}

r = requests.post(self.integration_url, json=payload, headers=headers)
if r.status_code == 200 | 202:
self.report({'message': 'Blacklisted in Umbrella.'})
else:
self.error('Failed to add to blacklist.')
else:
self.error('Incorrect dataType. "Domain" expexted.')

def operations(self, raw):
return [self.build_operation('AddTagToArtifact', tag='Umbrella:blocked')]

if __name__ == '__main__':
UmbrellaBlacklister().run()
1 change: 1 addition & 0 deletions responders/UmbrellaBlacklister/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
datetime