misp-modules/misp_modules/modules/action_mod/testaction.py

69 lines
1.9 KiB
Python
Raw Permalink Normal View History

2022-05-03 16:10:07 +02:00
import json
misperrors = {'error': 'Error'}
# config fields that your code expects from the site admin
moduleconfig = {
'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
},
# 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'
2024-08-12 11:23:10 +02:00
moduleinfo = {
'version': '0.1',
'author': 'Andras Iklody',
'description': 'This module is merely a test, always returning true. Triggers on event publishing.',
'module-type': ['action'],
'name': 'Test action',
'logo': '',
'requirements': [],
'features': '',
'references': [],
'input': '',
'output': ''
}
2022-05-03 16:10:07 +02:00
def handler(q=False):
if q is False:
return False
request = json.loads(q) # noqa
success = True
r = {"data": success}
2022-05-03 16:10:07 +02:00
return r
def introspection():
modulesetup = {}
try:
modulesetup['config'] = moduleconfig
2022-05-03 16:10:07 +02:00
except NameError:
pass
return modulesetup
def version():
moduleinfo['config'] = moduleconfig
return moduleinfo