2016-08-04 08:00:09 +02:00
|
|
|
import json
|
|
|
|
import base64
|
|
|
|
|
|
|
|
misperrors = {'error': 'Error'}
|
|
|
|
userConfig = {
|
2018-12-11 15:29:09 +01:00
|
|
|
'number1': {
|
|
|
|
'type': 'Integer',
|
|
|
|
'regex': '/^[0-4]$/i',
|
|
|
|
'errorMessage': 'Expected a number in range [0-4]',
|
|
|
|
'message': 'Column number used for value'
|
|
|
|
},
|
|
|
|
'some_string': {
|
|
|
|
'type': 'String',
|
|
|
|
'message': 'A text field'
|
|
|
|
},
|
|
|
|
'boolean_field': {
|
|
|
|
'type': 'Boolean',
|
|
|
|
'message': 'Boolean field test'
|
|
|
|
},
|
|
|
|
'comment': {
|
|
|
|
'type': 'Integer',
|
|
|
|
'message': 'Column number used for comment'
|
|
|
|
}
|
|
|
|
}
|
2016-08-04 08:00:09 +02:00
|
|
|
|
|
|
|
inputSource = ['file', 'paste']
|
|
|
|
|
|
|
|
moduleinfo = {'version': '0.2', 'author': 'Andras Iklody',
|
|
|
|
'description': 'Simple CSV import tool with mapable columns',
|
|
|
|
'module-type': ['import']}
|
|
|
|
|
|
|
|
moduleconfig = []
|
|
|
|
|
|
|
|
|
|
|
|
def handler(q=False):
|
|
|
|
if q is False:
|
|
|
|
return False
|
|
|
|
r = {'results': []}
|
|
|
|
request = json.loads(q)
|
|
|
|
request["data"] = base64.b64decode(request["data"])
|
2018-12-11 15:29:09 +01:00
|
|
|
# fields = ["value", "category", "type", "comment"]
|
|
|
|
r = {"results": [{"values": ["192.168.56.1"], "types":["ip-src"], "categories": ["Network activity"]}]}
|
2016-08-04 08:00:09 +02:00
|
|
|
return r
|
|
|
|
|
|
|
|
|
|
|
|
def introspection():
|
|
|
|
modulesetup = {}
|
|
|
|
try:
|
|
|
|
userConfig
|
|
|
|
modulesetup['userConfig'] = userConfig
|
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
inputSource
|
|
|
|
modulesetup['inputSource'] = inputSource
|
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
return modulesetup
|
|
|
|
|
|
|
|
|
|
|
|
def version():
|
|
|
|
moduleinfo['config'] = moduleconfig
|
|
|
|
return moduleinfo
|