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

Update UmbrellaBlacklister #547

Merged
Merged
Changes from 1 commit
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
31 changes: 23 additions & 8 deletions responders/UmbrellaBlacklister/UmbrellaBlacklister.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@
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")
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':
data_type = self.get_param('data.dataType')
ioc_types = {"domain": "domain", "url": "url","fqdn": "fqdn"}
if data_type in ioc_types:

if data_type == "domain" or data_type == "fqdn":
domain = self.get_param(
'data.data', None, 'No artifacts available')

dstUrl = "http://" + domain

domain = self.get_param('data.data', None, 'No artifacts available')
elif data_type == "url":
dstUrl = self.get_param(
'data.data', None, 'No artifacts available')

domain = dstUrl.split('/')[2]

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

headers = {
Expand All @@ -36,16 +49,18 @@ def run(self):
"providerName": "Security Platform"
}

r = requests.post(self.integration_url, json=payload, headers=headers)
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.')
else:
self.error('Incorrect dataType. "Domain", "FQDN", or "URL" expected.')

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


if __name__ == '__main__':
UmbrellaBlacklister().run()
UmbrellaBlacklister().run()