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

Adding some analyzers for common tools #86

Closed
wants to merge 8 commits into from
Closed
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
16 changes: 16 additions & 0 deletions analyzers/Bluecoat/Bluecoat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Bluecoat",
"version": "0.1",
"author": "IFX-CDC Alexander Goedeke",
"url": "https://github.com/IFX-CDC/Cortex-Analyzers",
"license": "AGPL-V3",
"baseConfig": "Bluecoat",
"config": {
"check_tlp": true,
"max_tlp": 0,
"service": "search"
},
"description": "The analyser search for a url in bluecoat.",
"dataTypeList": ["domain", "url"],
"command": "Bluecoat/bluecoat_analyzer.py"
}
55 changes: 55 additions & 0 deletions analyzers/Bluecoat/bluecoat_analyzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python
# encoding: utf-8

from cortexutils.analyzer import Analyzer
import json
import requests
import re

class BluecoatAnalyzer(Analyzer):

def __init__(self):
Analyzer.__init__(self)
self.service = self.getParam('config.service', 'search', 'Bluecoat service is missing, default method is used')

def summary(self, raw):
taxonomies = []
if raw.get('categorization') and len(raw.get('categorization')) > 0:
for cat in raw.get('categorization'):
taxonomies.append(self.build_taxonomy("info", "Bluecoat", "Category", cat))
return {"taxonomies": taxonomies}

def run(self):
# get input data
Analyzer.run(self)
data = self.getParam('data', None, 'Data is missing')
try:
# send service
if self.service == 'search':
payload = {'url': data}
r = requests.post('https://sitereview.bluecoat.com/rest/categorization', data=payload)
rep = json.loads(r.content.decode())

try:
rep["categorization"] = re.findall('<a[^>]*>([^<]*?)</a>', rep["categorization"])
except:
pass
try:
rep["ratedate"] = re.findall('Last Time Rated/Reviewed[^:]*: ([^<]*?)<img', rep["ratedate"])[0]
except:
pass
try:
del rep['locked_message']
except:
pass

# send result
self.report(rep)
else:
self.error('Unknown Bluecoat service')

except Exception as e:
self.unexpectedError(e)

if __name__ == '__main__':
BluecoatAnalyzer().run()
1 change: 1 addition & 0 deletions analyzers/Bluecoat/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cortexutils
17 changes: 17 additions & 0 deletions analyzers/MailParser/MailParser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "MailParser",
"version": "1.0",
"author": "IFX-CDC Alexander Goedeke",
"url": "https://github.com/IFX-CDC/Cortex-Analyzers",
"license": "AGPL-V3",
"baseConfig":"MailParser",
"config": {
"check_tlp": false,
"service": "analyse"
},
"description": "Parse Outlook MSG files and extract the main artifacts",
"dataTypeList": [
"file"
],
"command": "MailParser/parse.py"
}
1 change: 1 addition & 0 deletions analyzers/MailParser/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# __import__('pkg_resources').declare_namespace(__name__)
Loading