misp-modules 2.4.196__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- misp_modules/__init__.py +379 -0
- misp_modules/helpers/__init__.py +1 -0
- misp_modules/helpers/cache.py +84 -0
- misp_modules/lib/__init__.py +4 -0
- misp_modules/lib/_vmray/__init__.py +0 -0
- misp_modules/lib/_vmray/parser.py +1417 -0
- misp_modules/lib/_vmray/rest_api.py +148 -0
- misp_modules/lib/cof2misp/LICENSE-2.0.txt +202 -0
- misp_modules/lib/cof2misp/__init__.py +0 -0
- misp_modules/lib/cof2misp/cof.py +165 -0
- misp_modules/lib/joe_mapping.py +114 -0
- misp_modules/lib/joe_parser.py +573 -0
- misp_modules/lib/lastline_api.py +841 -0
- misp_modules/lib/qintel_helper.py +263 -0
- misp_modules/lib/stix2misp.py +2080 -0
- misp_modules/lib/stix2misp_mapping.py +460 -0
- misp_modules/lib/synonymsToTagNames.json +1 -0
- misp_modules/lib/vt_graph_parser/__init__.py +8 -0
- misp_modules/lib/vt_graph_parser/errors.py +20 -0
- misp_modules/lib/vt_graph_parser/helpers/__init__.py +7 -0
- misp_modules/lib/vt_graph_parser/helpers/parsers.py +88 -0
- misp_modules/lib/vt_graph_parser/helpers/rules.py +304 -0
- misp_modules/lib/vt_graph_parser/helpers/wrappers.py +58 -0
- misp_modules/lib/vt_graph_parser/importers/__init__.py +7 -0
- misp_modules/lib/vt_graph_parser/importers/base.py +98 -0
- misp_modules/lib/vt_graph_parser/importers/pymisp_response.py +73 -0
- misp_modules/modules/__init__.py +4 -0
- misp_modules/modules/action_mod/__init__.py +1 -0
- misp_modules/modules/action_mod/_utils/__init__.py +1 -0
- misp_modules/modules/action_mod/_utils/utils.py +70 -0
- misp_modules/modules/action_mod/mattermost.py +113 -0
- misp_modules/modules/action_mod/slack.py +96 -0
- misp_modules/modules/action_mod/testaction.py +68 -0
- misp_modules/modules/expansion/__init__.py +36 -0
- misp_modules/modules/expansion/_dnsdb_query/COPYRIGHT +27 -0
- misp_modules/modules/expansion/_dnsdb_query/LICENSE +202 -0
- misp_modules/modules/expansion/_dnsdb_query/README.md +162 -0
- misp_modules/modules/expansion/_dnsdb_query/__init__.py +0 -0
- misp_modules/modules/expansion/_dnsdb_query/dnsdb_query.py +327 -0
- misp_modules/modules/expansion/_ransomcoindb/__init__.py +0 -0
- misp_modules/modules/expansion/_ransomcoindb/ransomcoindb.py +96 -0
- misp_modules/modules/expansion/_vulnerability_parser/__init__.py +0 -0
- misp_modules/modules/expansion/_vulnerability_parser/vulnerability_parser.py +118 -0
- misp_modules/modules/expansion/abuseipdb.py +146 -0
- misp_modules/modules/expansion/apiosintds.py +365 -0
- misp_modules/modules/expansion/apivoid.py +133 -0
- misp_modules/modules/expansion/assemblyline_query.py +179 -0
- misp_modules/modules/expansion/assemblyline_submit.py +100 -0
- misp_modules/modules/expansion/backscatter_io.py +84 -0
- misp_modules/modules/expansion/btc_scam_check.py +54 -0
- misp_modules/modules/expansion/btc_steroids.py +238 -0
- misp_modules/modules/expansion/censys_enrich.py +287 -0
- misp_modules/modules/expansion/circl_passivedns.py +85 -0
- misp_modules/modules/expansion/circl_passivessl.py +113 -0
- misp_modules/modules/expansion/clamav.py +129 -0
- misp_modules/modules/expansion/cluster25_expand.py +239 -0
- misp_modules/modules/expansion/countrycode.py +69 -0
- misp_modules/modules/expansion/cpe.py +140 -0
- misp_modules/modules/expansion/crowdsec.py +235 -0
- misp_modules/modules/expansion/crowdstrike_falcon.py +148 -0
- misp_modules/modules/expansion/cuckoo_submit.py +161 -0
- misp_modules/modules/expansion/cve.py +57 -0
- misp_modules/modules/expansion/cve_advanced.py +185 -0
- misp_modules/modules/expansion/cytomic_orion.py +196 -0
- misp_modules/modules/expansion/dbl_spamhaus.py +78 -0
- misp_modules/modules/expansion/dns.py +71 -0
- misp_modules/modules/expansion/docx_enrich.py +71 -0
- misp_modules/modules/expansion/domaintools.py +290 -0
- misp_modules/modules/expansion/eql.py +91 -0
- misp_modules/modules/expansion/eupi.py +86 -0
- misp_modules/modules/expansion/extract_url_components.py +83 -0
- misp_modules/modules/expansion/farsight_passivedns.py +243 -0
- misp_modules/modules/expansion/geoip_asn.py +75 -0
- misp_modules/modules/expansion/geoip_city.py +75 -0
- misp_modules/modules/expansion/geoip_country.py +73 -0
- misp_modules/modules/expansion/google_safe_browsing.py +86 -0
- misp_modules/modules/expansion/google_search.py +57 -0
- misp_modules/modules/expansion/google_threat_intelligence.py +453 -0
- misp_modules/modules/expansion/greynoise.py +346 -0
- misp_modules/modules/expansion/hashdd.py +53 -0
- misp_modules/modules/expansion/hashlookup.py +118 -0
- misp_modules/modules/expansion/hibp.py +62 -0
- misp_modules/modules/expansion/html_to_markdown.py +63 -0
- misp_modules/modules/expansion/hyasinsight.py +881 -0
- misp_modules/modules/expansion/intel471.py +73 -0
- misp_modules/modules/expansion/intelmq_eventdb.py.experimental +67 -0
- misp_modules/modules/expansion/ip2locationio.py +90 -0
- misp_modules/modules/expansion/ipasn.py +70 -0
- misp_modules/modules/expansion/ipinfo.py +112 -0
- misp_modules/modules/expansion/ipqs_fraud_and_risk_scoring.py +633 -0
- misp_modules/modules/expansion/iprep.py +98 -0
- misp_modules/modules/expansion/jinja_template_rendering.py +54 -0
- misp_modules/modules/expansion/joesandbox_query.py +91 -0
- misp_modules/modules/expansion/joesandbox_submit.py +147 -0
- misp_modules/modules/expansion/lastline_query.py +148 -0
- misp_modules/modules/expansion/lastline_submit.py +180 -0
- misp_modules/modules/expansion/macaddress_io.py +130 -0
- misp_modules/modules/expansion/macvendors.py +55 -0
- misp_modules/modules/expansion/malshare_upload.py +107 -0
- misp_modules/modules/expansion/malwarebazaar.py +67 -0
- misp_modules/modules/expansion/mcafee_insights_enrich.py +249 -0
- misp_modules/modules/expansion/mmdb_lookup.py +138 -0
- misp_modules/modules/expansion/module.py.skeleton +44 -0
- misp_modules/modules/expansion/mwdb.py +152 -0
- misp_modules/modules/expansion/ocr_enrich.py +74 -0
- misp_modules/modules/expansion/ods_enrich.py +71 -0
- misp_modules/modules/expansion/odt_enrich.py +61 -0
- misp_modules/modules/expansion/onyphe.py +243 -0
- misp_modules/modules/expansion/onyphe_full.py +387 -0
- misp_modules/modules/expansion/otx.py +167 -0
- misp_modules/modules/expansion/passive_ssh.py +150 -0
- misp_modules/modules/expansion/passivetotal.py +358 -0
- misp_modules/modules/expansion/pdf_enrich.py +58 -0
- misp_modules/modules/expansion/pptx_enrich.py +65 -0
- misp_modules/modules/expansion/qintel_qsentry.py +229 -0
- misp_modules/modules/expansion/qrcode.py +99 -0
- misp_modules/modules/expansion/ransomcoindb.py +82 -0
- misp_modules/modules/expansion/rbl.py +126 -0
- misp_modules/modules/expansion/recordedfuture.py +544 -0
- misp_modules/modules/expansion/reversedns.py +77 -0
- misp_modules/modules/expansion/securitytrails.py +571 -0
- misp_modules/modules/expansion/shodan.py +244 -0
- misp_modules/modules/expansion/sigma_queries.py +61 -0
- misp_modules/modules/expansion/sigma_syntax_validator.py +49 -0
- misp_modules/modules/expansion/sigmf_expand.py +303 -0
- misp_modules/modules/expansion/socialscan.py +108 -0
- misp_modules/modules/expansion/sophoslabs_intelix.py +146 -0
- misp_modules/modules/expansion/sourcecache.py +57 -0
- misp_modules/modules/expansion/stairwell.py +156 -0
- misp_modules/modules/expansion/stix2_pattern_syntax_validator.py +56 -0
- misp_modules/modules/expansion/threatcrowd.py +170 -0
- misp_modules/modules/expansion/threatfox.py +75 -0
- misp_modules/modules/expansion/threatminer.py +152 -0
- misp_modules/modules/expansion/triage_submit.py +119 -0
- misp_modules/modules/expansion/trustar_enrich.py +235 -0
- misp_modules/modules/expansion/urlhaus.py +164 -0
- misp_modules/modules/expansion/urlscan.py +269 -0
- misp_modules/modules/expansion/variotdbs.py +133 -0
- misp_modules/modules/expansion/virustotal.py +311 -0
- misp_modules/modules/expansion/virustotal_public.py +272 -0
- misp_modules/modules/expansion/virustotal_upload.py +91 -0
- misp_modules/modules/expansion/vmray_submit.py +161 -0
- misp_modules/modules/expansion/vmware_nsx.py +628 -0
- misp_modules/modules/expansion/vulndb.py +292 -0
- misp_modules/modules/expansion/vulnerability_lookup.py +324 -0
- misp_modules/modules/expansion/vulners.py +81 -0
- misp_modules/modules/expansion/vysion.py +221 -0
- misp_modules/modules/expansion/whois.py +72 -0
- misp_modules/modules/expansion/whoisfreaks.py +232 -0
- misp_modules/modules/expansion/wiki.py +58 -0
- misp_modules/modules/expansion/xforceexchange.py +189 -0
- misp_modules/modules/expansion/xlsx_enrich.py +63 -0
- misp_modules/modules/expansion/yara_query.py +70 -0
- misp_modules/modules/expansion/yara_syntax_validator.py +49 -0
- misp_modules/modules/expansion/yeti.py +196 -0
- misp_modules/modules/export_mod/__init__.py +3 -0
- misp_modules/modules/export_mod/cef_export.py +93 -0
- misp_modules/modules/export_mod/cisco_firesight_manager_ACL_rule_export.py +150 -0
- misp_modules/modules/export_mod/defender_endpoint_export.py +141 -0
- misp_modules/modules/export_mod/goamlexport.py +255 -0
- misp_modules/modules/export_mod/liteexport.py +97 -0
- misp_modules/modules/export_mod/mass_eql_export.py +106 -0
- misp_modules/modules/export_mod/nexthinkexport.py +131 -0
- misp_modules/modules/export_mod/osqueryexport.py +125 -0
- misp_modules/modules/export_mod/pdfexport.py +107 -0
- misp_modules/modules/export_mod/testexport.py +73 -0
- misp_modules/modules/export_mod/threatStream_misp_export.py +114 -0
- misp_modules/modules/export_mod/threat_connect_export.py +125 -0
- misp_modules/modules/export_mod/virustotal_collections.py +141 -0
- misp_modules/modules/export_mod/vt_graph.py +120 -0
- misp_modules/modules/export_mod/yara_export.py +290 -0
- misp_modules/modules/import_mod/__init__.py +22 -0
- misp_modules/modules/import_mod/cof2misp.py +264 -0
- misp_modules/modules/import_mod/csvimport.py +319 -0
- misp_modules/modules/import_mod/cuckooimport.py +749 -0
- misp_modules/modules/import_mod/email_import.py +294 -0
- misp_modules/modules/import_mod/goamlimport.py +188 -0
- misp_modules/modules/import_mod/import_blueprint.py +93 -0
- misp_modules/modules/import_mod/joe_import.py +74 -0
- misp_modules/modules/import_mod/lastline_import.py +160 -0
- misp_modules/modules/import_mod/mispjson.py +73 -0
- misp_modules/modules/import_mod/ocr.py +122 -0
- misp_modules/modules/import_mod/openiocimport.py +99 -0
- misp_modules/modules/import_mod/taxii21.py +383 -0
- misp_modules/modules/import_mod/testimport.py +73 -0
- misp_modules/modules/import_mod/threatanalyzer_import.py +552 -0
- misp_modules/modules/import_mod/url_import.py +97 -0
- misp_modules/modules/import_mod/vmray_import.py +96 -0
- misp_modules/modules/import_mod/vmray_summary_json_import.py +87 -0
- misp_modules-2.4.196.dist-info/LICENSE +661 -0
- misp_modules-2.4.196.dist-info/METADATA +281 -0
- misp_modules-2.4.196.dist-info/RECORD +194 -0
- misp_modules-2.4.196.dist-info/WHEEL +4 -0
- misp_modules-2.4.196.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from jinja2.sandbox import SandboxedEnvironment
|
|
4
|
+
|
|
5
|
+
default_template = """
|
|
6
|
+
# Tutorial: How to use jinja2 templating
|
|
7
|
+
|
|
8
|
+
:warning: For these examples, we consider the module received data under the MISP core format
|
|
9
|
+
|
|
10
|
+
1. You can use the dot `.` notation or the subscript syntax `[]` to access attributes of a variable
|
|
11
|
+
- `{% raw %}{{ Event.info }}{% endraw %}` -> {{ Event.info }}
|
|
12
|
+
- `{% raw %}{{ Event['info'] }}{% endraw %}` -> {{ Event['info'] }}
|
|
13
|
+
|
|
14
|
+
2. Jinja2 allows you to easily create list:
|
|
15
|
+
```{% raw %}
|
|
16
|
+
{% for attribute in Event.Attribute %}
|
|
17
|
+
- {{ attribute.value }}
|
|
18
|
+
{% endfor %}
|
|
19
|
+
{% endraw %}```
|
|
20
|
+
|
|
21
|
+
Gives:
|
|
22
|
+
{% for attribute in Event.Attribute %}
|
|
23
|
+
- {{ attribute.value }}
|
|
24
|
+
{% endfor %}
|
|
25
|
+
|
|
26
|
+
3. Jinja2 allows you to add logic
|
|
27
|
+
```{% raw %}
|
|
28
|
+
{% if "tlp:white" in Event.Tag %}
|
|
29
|
+
- This Event has the TLP:WHITE tag
|
|
30
|
+
{% else %}
|
|
31
|
+
- This Event doesn't have the TLP:WHITE tag
|
|
32
|
+
{% endif %}
|
|
33
|
+
{% endraw %}```
|
|
34
|
+
|
|
35
|
+
Gives:
|
|
36
|
+
{% if "tlp:white" in Event.Tag %}
|
|
37
|
+
- This Event has the TLP:WHITE tag
|
|
38
|
+
{% else %}
|
|
39
|
+
- This Event doesn't have the TLP:WHITE tag
|
|
40
|
+
{% endif %}
|
|
41
|
+
|
|
42
|
+
## Jinja2 allows you to modify variables by using filters
|
|
43
|
+
|
|
44
|
+
3. The `reverse` filter
|
|
45
|
+
- `{% raw %}{{ Event.info | reverse }}{% endraw %}` -> {{ Event.info | reverse }}
|
|
46
|
+
|
|
47
|
+
4. The `format` filter
|
|
48
|
+
- `{% raw %}{{ "%s :: %s" | format(Event.Attribute[0].type, Event.Attribute[0].value) }}{% endraw %}` -> {{ "%s :: %s" | format(Event.Attribute[0].type, Event.Attribute[0].value) }}
|
|
49
|
+
|
|
50
|
+
5.The `groupby` filter
|
|
51
|
+
```{% raw %}
|
|
52
|
+
{% for type, attributes in Event.Attribute|groupby("type") %}
|
|
53
|
+
- {{ type }}{% for attribute in attributes %}
|
|
54
|
+
- {{ attribute.value }}
|
|
55
|
+
{% endfor %}
|
|
56
|
+
{% endfor %}
|
|
57
|
+
{% endraw %}```
|
|
58
|
+
|
|
59
|
+
Gives:
|
|
60
|
+
{% for type, attributes in Event.Attribute|groupby("type") %}
|
|
61
|
+
- {{ type }}{% for attribute in attributes %}
|
|
62
|
+
- {{ attribute.value }}
|
|
63
|
+
{% endfor %}
|
|
64
|
+
{% endfor %}
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def renderTemplate(data, template=default_template):
|
|
69
|
+
env = SandboxedEnvironment()
|
|
70
|
+
return env.from_string(template).render(data)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pyfaup.faup import Faup
|
|
3
|
+
from mattermostdriver import Driver
|
|
4
|
+
from ._utils import utils
|
|
5
|
+
|
|
6
|
+
misperrors = {'error': 'Error'}
|
|
7
|
+
|
|
8
|
+
# config fields that your code expects from the site admin
|
|
9
|
+
moduleconfig = {
|
|
10
|
+
'params': {
|
|
11
|
+
'mattermost_hostname': {
|
|
12
|
+
'type': 'string',
|
|
13
|
+
'description': 'The Mattermost domain or URL',
|
|
14
|
+
'value': 'example.mattermost.com',
|
|
15
|
+
},
|
|
16
|
+
'bot_access_token': {
|
|
17
|
+
'type': 'string',
|
|
18
|
+
'description': 'Access token generated when you created the bot account',
|
|
19
|
+
},
|
|
20
|
+
'channel_id': {
|
|
21
|
+
'type': 'string',
|
|
22
|
+
'description': 'The channel you added the bot to',
|
|
23
|
+
},
|
|
24
|
+
'message_template': {
|
|
25
|
+
'type': 'large_string',
|
|
26
|
+
'description': 'The template to be used to generate the message to be posted',
|
|
27
|
+
'value': 'The **template** will be rendered using *Jinja2*!',
|
|
28
|
+
'jinja_supported': True,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
# Blocking modules break the exection of the current of action
|
|
32
|
+
'blocking': False,
|
|
33
|
+
# Indicates whether parts of the data passed to this module should be filtered. Filtered data can be found under the `filteredItems` key
|
|
34
|
+
'support_filters': True,
|
|
35
|
+
# Indicates whether the data passed to this module should be compliant with the MISP core format
|
|
36
|
+
'expect_misp_core_format': False,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# returns either "boolean" or "data"
|
|
41
|
+
# Boolean is used to simply signal that the execution has finished.
|
|
42
|
+
# For blocking modules the actual boolean value determines whether we break execution
|
|
43
|
+
returns = 'boolean'
|
|
44
|
+
|
|
45
|
+
moduleinfo = {
|
|
46
|
+
'version': '0.1',
|
|
47
|
+
'author': 'Sami Mokaddem',
|
|
48
|
+
'description': 'Simplistic module to send message to a Mattermost channel.',
|
|
49
|
+
'module-type': ['action'],
|
|
50
|
+
'name': 'Mattermost',
|
|
51
|
+
'logo': '',
|
|
52
|
+
'requirements': [],
|
|
53
|
+
'features': '',
|
|
54
|
+
'references': [],
|
|
55
|
+
'input': '',
|
|
56
|
+
'output': ''
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
f = Faup()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def createPost(request):
|
|
63
|
+
params = request['params']
|
|
64
|
+
f.decode(params['mattermost_hostname'])
|
|
65
|
+
parsedURL = f.get()
|
|
66
|
+
mm = Driver({
|
|
67
|
+
'url': parsedURL['host'],
|
|
68
|
+
'token': params['bot_access_token'],
|
|
69
|
+
'scheme': parsedURL['scheme'] if parsedURL['scheme'] is not None else 'https',
|
|
70
|
+
'basepath': '/api/v4',
|
|
71
|
+
'port': int(parsedURL['port']) if parsedURL['port'] is not None else 443,
|
|
72
|
+
})
|
|
73
|
+
mm.login()
|
|
74
|
+
|
|
75
|
+
data = {}
|
|
76
|
+
if 'matchingData' in request:
|
|
77
|
+
data = request['matchingData']
|
|
78
|
+
else:
|
|
79
|
+
data = request['data']
|
|
80
|
+
|
|
81
|
+
if params['message_template']:
|
|
82
|
+
message = utils.renderTemplate(data, params['message_template'])
|
|
83
|
+
else:
|
|
84
|
+
message = '```\n{}\n```'.format(json.dumps(data))
|
|
85
|
+
|
|
86
|
+
mm.posts.create_post(options={
|
|
87
|
+
'channel_id': params['channel_id'],
|
|
88
|
+
'message': message
|
|
89
|
+
})
|
|
90
|
+
return True
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def handler(q=False):
|
|
94
|
+
if q is False:
|
|
95
|
+
return False
|
|
96
|
+
request = json.loads(q)
|
|
97
|
+
createPost(request)
|
|
98
|
+
r = {"data": True}
|
|
99
|
+
return r
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def introspection():
|
|
103
|
+
modulesetup = {}
|
|
104
|
+
try:
|
|
105
|
+
modulesetup['config'] = moduleconfig
|
|
106
|
+
except NameError:
|
|
107
|
+
pass
|
|
108
|
+
return modulesetup
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def version():
|
|
112
|
+
moduleinfo['config'] = moduleconfig
|
|
113
|
+
return moduleinfo
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from slack_sdk import WebClient
|
|
3
|
+
from slack_sdk.errors import SlackApiError
|
|
4
|
+
from ._utils import utils
|
|
5
|
+
|
|
6
|
+
misperrors = {'error': 'Error'}
|
|
7
|
+
|
|
8
|
+
# config fields that your code expects from the site admin
|
|
9
|
+
moduleconfig = {
|
|
10
|
+
'params': {
|
|
11
|
+
'slack_bot_token': {
|
|
12
|
+
'type': 'string',
|
|
13
|
+
'description': 'The Slack bot token generated when you created the bot account',
|
|
14
|
+
},
|
|
15
|
+
'channel_id': {
|
|
16
|
+
'type': 'string',
|
|
17
|
+
'description': 'The channel ID you want to post messages to',
|
|
18
|
+
},
|
|
19
|
+
'message_template': {
|
|
20
|
+
'type': 'large_string',
|
|
21
|
+
'description': 'The template to be used to generate the message to be posted',
|
|
22
|
+
'value': 'The **template** will be rendered using *Jinja2*!',
|
|
23
|
+
'jinja_supported': True,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
# Blocking modules break the execution of the current action
|
|
27
|
+
'blocking': False,
|
|
28
|
+
# Indicates whether parts of the data passed to this module should be filtered.
|
|
29
|
+
'support_filters': True,
|
|
30
|
+
# Indicates whether the data passed to this module should be compliant with the MISP core format
|
|
31
|
+
'expect_misp_core_format': False,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# returns either "boolean" or "data"
|
|
35
|
+
# Boolean is used to simply signal that the execution has finished.
|
|
36
|
+
# For blocking modules, the actual boolean value determines whether we break execution
|
|
37
|
+
returns = 'boolean'
|
|
38
|
+
|
|
39
|
+
moduleinfo = {
|
|
40
|
+
'version': '0.1',
|
|
41
|
+
'author': 'goodlandsecurity',
|
|
42
|
+
'description': 'Simplistic module to send messages to a Slack channel.',
|
|
43
|
+
'module-type': ['action'],
|
|
44
|
+
'name': 'Slack',
|
|
45
|
+
'logo': '',
|
|
46
|
+
'requirements': [],
|
|
47
|
+
'features': '',
|
|
48
|
+
'references': [],
|
|
49
|
+
'input': '',
|
|
50
|
+
'output': ''
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def create_post(request):
|
|
55
|
+
params = request['params']
|
|
56
|
+
slack_token = params['slack_bot_token']
|
|
57
|
+
channel_id = params['channel_id']
|
|
58
|
+
|
|
59
|
+
client = WebClient(token=slack_token)
|
|
60
|
+
|
|
61
|
+
data = request.get('matchingData', request.get('data', {}))
|
|
62
|
+
|
|
63
|
+
if params['message_template']:
|
|
64
|
+
message = utils.renderTemplate(data, params['message_template'])
|
|
65
|
+
else:
|
|
66
|
+
message = '```\n{}\n```'.format(json.dumps(data))
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
client.chat_postMessage(channel=channel_id, text=message)
|
|
70
|
+
return True
|
|
71
|
+
except SlackApiError as e:
|
|
72
|
+
error_message = e.response['error']
|
|
73
|
+
print(f"Error posting message: {error_message}")
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def handler(q=False):
|
|
78
|
+
if q is False:
|
|
79
|
+
return False
|
|
80
|
+
request = json.loads(q)
|
|
81
|
+
create_post(request)
|
|
82
|
+
return {"data": True}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def introspection():
|
|
86
|
+
modulesetup = {}
|
|
87
|
+
try:
|
|
88
|
+
modulesetup['config'] = moduleconfig
|
|
89
|
+
except NameError:
|
|
90
|
+
pass
|
|
91
|
+
return modulesetup
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def version():
|
|
95
|
+
moduleinfo['config'] = moduleconfig
|
|
96
|
+
return moduleinfo
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
misperrors = {'error': 'Error'}
|
|
4
|
+
|
|
5
|
+
# config fields that your code expects from the site admin
|
|
6
|
+
moduleconfig = {
|
|
7
|
+
'params': {
|
|
8
|
+
'foo': {
|
|
9
|
+
'type': 'string',
|
|
10
|
+
'description': 'blablabla',
|
|
11
|
+
'value': 'xyz'
|
|
12
|
+
},
|
|
13
|
+
'Data extraction path': {
|
|
14
|
+
# Extracted data can be found under the `matchingData` key
|
|
15
|
+
'type': 'hash_path',
|
|
16
|
+
'description': 'Only post content extracted from this path',
|
|
17
|
+
'value': 'Attribute.{n}.AttributeTag.{n}.Tag.name',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
# Blocking modules break the exection of the current of action
|
|
21
|
+
'blocking': False,
|
|
22
|
+
# Indicates whether parts of the data passed to this module should be extracted. Extracted data can be found under the `filteredItems` key
|
|
23
|
+
'support_filters': False,
|
|
24
|
+
# Indicates whether the data passed to this module should be compliant with the MISP core format
|
|
25
|
+
'expect_misp_core_format': False,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# returns either "boolean" or "data"
|
|
29
|
+
# Boolean is used to simply signal that the execution has finished.
|
|
30
|
+
# For blocking modules the actual boolean value determines whether we break execution
|
|
31
|
+
returns = 'boolean'
|
|
32
|
+
|
|
33
|
+
moduleinfo = {
|
|
34
|
+
'version': '0.1',
|
|
35
|
+
'author': 'Andras Iklody',
|
|
36
|
+
'description': 'This module is merely a test, always returning true. Triggers on event publishing.',
|
|
37
|
+
'module-type': ['action'],
|
|
38
|
+
'name': 'Test action',
|
|
39
|
+
'logo': '',
|
|
40
|
+
'requirements': [],
|
|
41
|
+
'features': '',
|
|
42
|
+
'references': [],
|
|
43
|
+
'input': '',
|
|
44
|
+
'output': ''
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def handler(q=False):
|
|
49
|
+
if q is False:
|
|
50
|
+
return False
|
|
51
|
+
request = json.loads(q) # noqa
|
|
52
|
+
success = True
|
|
53
|
+
r = {"data": success}
|
|
54
|
+
return r
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def introspection():
|
|
58
|
+
modulesetup = {}
|
|
59
|
+
try:
|
|
60
|
+
modulesetup['config'] = moduleconfig
|
|
61
|
+
except NameError:
|
|
62
|
+
pass
|
|
63
|
+
return modulesetup
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def version():
|
|
67
|
+
moduleinfo['config'] = moduleconfig
|
|
68
|
+
return moduleinfo
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
sys.path.append('{}/lib'.format('/'.join((os.path.realpath(__file__)).split('/')[:-3])))
|
|
5
|
+
|
|
6
|
+
__all__ = ['cuckoo_submit', 'vmray_submit', 'circl_passivedns', 'circl_passivessl',
|
|
7
|
+
'cluster25_expand', 'countrycode', 'cve', 'cve_advanced', 'cpe', 'dns', 'btc_steroids', 'domaintools',
|
|
8
|
+
'eupi', 'eql', 'farsight_passivedns', 'ipasn', 'passivetotal', 'sourcecache', 'virustotal',
|
|
9
|
+
'shodan', 'reversedns', 'geoip_asn', 'geoip_city', 'geoip_country', 'wiki', 'iprep',
|
|
10
|
+
'threatminer', 'otx', 'threatcrowd', 'vulndb', 'crowdstrike_falcon',
|
|
11
|
+
'yara_syntax_validator', 'hashdd', 'onyphe', 'onyphe_full', 'rbl',
|
|
12
|
+
'xforceexchange', 'sigma_syntax_validator', 'stix2_pattern_syntax_validator',
|
|
13
|
+
'sigma_queries', 'dbl_spamhaus', 'vulners', 'yara_query', 'macaddress_io',
|
|
14
|
+
'intel471', 'backscatter_io', 'btc_scam_check', 'hibp', 'greynoise', 'macvendors',
|
|
15
|
+
'qrcode', 'ocr_enrich', 'pdf_enrich', 'docx_enrich', 'xlsx_enrich', 'pptx_enrich',
|
|
16
|
+
'ods_enrich', 'odt_enrich', 'joesandbox_submit', 'joesandbox_query', 'urlhaus',
|
|
17
|
+
'virustotal_public', 'apiosintds', 'urlscan', 'securitytrails', 'apivoid',
|
|
18
|
+
'assemblyline_submit', 'assemblyline_query', 'ransomcoindb', 'malwarebazaar',
|
|
19
|
+
'lastline_query', 'lastline_submit', 'sophoslabs_intelix', 'cytomic_orion', 'censys_enrich',
|
|
20
|
+
'trustar_enrich', 'recordedfuture', 'html_to_markdown', 'socialscan', 'passive_ssh',
|
|
21
|
+
'qintel_qsentry', 'mwdb', 'hashlookup', 'mmdb_lookup', 'ipqs_fraud_and_risk_scoring',
|
|
22
|
+
'clamav', 'jinja_template_rendering', 'hyasinsight', 'variotdbs', 'crowdsec',
|
|
23
|
+
'extract_url_components', 'ipinfo', 'whoisfreaks', 'ip2locationio', 'stairwell',
|
|
24
|
+
'google_threat_intelligence', 'vulnerability_lookup', 'vysion', 'mcafee_insights_enrich',
|
|
25
|
+
'threatfox', 'yeti', 'abuseipdb', 'vmware_nsx', 'sigmf_expand', 'google_safe_browsing',
|
|
26
|
+
'google_search', 'whois', 'triage_submit', 'virustotal_upload', 'malshare_upload' ]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
minimum_required_fields = ('type', 'uuid', 'value')
|
|
30
|
+
|
|
31
|
+
checking_error = 'containing at least a "type" field and a "value" field'
|
|
32
|
+
standard_error_message = 'This module requires an "attribute" field as input'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def check_input_attribute(attribute, requirements=minimum_required_fields):
|
|
36
|
+
return all(feature in attribute for feature in requirements)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2013 by Farsight Security, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2010-2012 by Internet Systems Consortium, Inc. ("ISC")
|
|
16
|
+
|
|
17
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
19
|
+
copyright notice and this permission notice appear in all copies.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
|
22
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
|
24
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
25
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
26
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
27
|
+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|