2022-05-03 16:10:07 +02:00
|
|
|
import json
|
2022-08-05 15:39:12 +02:00
|
|
|
from ._utils import utils
|
2022-05-03 16:10:07 +02:00
|
|
|
|
|
|
|
misperrors = {'error': 'Error'}
|
|
|
|
|
|
|
|
# config fields that your code expects from the site admin
|
|
|
|
moduleconfig = {
|
2022-08-05 15:39:12 +02:00
|
|
|
'params': {
|
|
|
|
'foo': {
|
|
|
|
'type': 'string',
|
|
|
|
'description': 'blablabla',
|
|
|
|
'value': 'xyz'
|
|
|
|
},
|
|
|
|
'Data extraction path': {
|
|
|
|
# Extracted data can be found under the `matchingData` key
|
|
|
|
'type': 'hash_path',
|
|
|
|
'description': 'Only post content extracted from this path',
|
|
|
|
'value': 'Attribute.{n}.AttributeTag.{n}.Tag.name',
|
|
|
|
},
|
2022-05-03 16:10:07 +02:00
|
|
|
},
|
2022-08-05 15:39:12 +02:00
|
|
|
# Blocking modules break the exection of the current of action
|
|
|
|
'blocking': False,
|
|
|
|
# Indicates whether parts of the data passed to this module should be extracted. Extracted data can be found under the `filteredItems` key
|
|
|
|
'support_filters': False,
|
|
|
|
# Indicates whether the data passed to this module should be compliant with the MISP core format
|
|
|
|
'expect_misp_core_format': False,
|
|
|
|
}
|
2022-05-03 16:10:07 +02:00
|
|
|
|
|
|
|
# returns either "boolean" or "data"
|
|
|
|
# Boolean is used to simply signal that the execution has finished.
|
|
|
|
# For blocking modules the actual boolean value determines whether we break execution
|
|
|
|
returns = 'boolean'
|
|
|
|
|
|
|
|
moduleinfo = {'version': '0.1', 'author': 'Andras Iklody',
|
|
|
|
'description': 'This module is merely a test, always returning true. Triggers on event publishing.',
|
|
|
|
'module-type': ['action']}
|
|
|
|
|
|
|
|
|
|
|
|
def handler(q=False):
|
|
|
|
if q is False:
|
|
|
|
return False
|
2022-08-05 15:39:12 +02:00
|
|
|
request = json.loads(q) # noqa
|
|
|
|
success = True
|
|
|
|
r = {"data": success}
|
2022-05-03 16:10:07 +02:00
|
|
|
return r
|
|
|
|
|
|
|
|
|
|
|
|
def introspection():
|
|
|
|
modulesetup = {}
|
|
|
|
try:
|
2022-08-05 15:39:12 +02:00
|
|
|
modulesetup['config'] = moduleconfig
|
2022-05-03 16:10:07 +02:00
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
return modulesetup
|
|
|
|
|
|
|
|
|
|
|
|
def version():
|
|
|
|
moduleinfo['config'] = moduleconfig
|
|
|
|
return moduleinfo
|