Skip to content

Commit

Permalink
Merge pull request #118 from truckydev/master
Browse files Browse the repository at this point in the history
Add indent field for export
  • Loading branch information
adulau committed Apr 23, 2017
2 parents eda88c5 + 24c51a6 commit 3cb12d6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions misp_modules/modules/export_mod/liteexport.py
Expand Up @@ -8,23 +8,29 @@
'description': 'export lite',
'module-type': ['export']}

#~ config form admin site but do not work
#~ moduleconfig = ["indent_json_export"]
moduleconfig = []
moduleconfig = ["indent_json_export"]

#~ mispattributes = {'input':'all'} ?
mispattributes = {}
outputFileExtension = "json"
responseType = "application/json"

def handler(q=False):
if q is False:
return False

request = json.loads(q)

config = {}
if "config" in request:
config = request["config"]
config = request["config"]
else:
config = {"indent_json_export":None}
config = {"indent_json_export" : None}

if config['indent_json_export'] is not None:
try:
config['indent_json_export'] = int(config['indent_json_export'])
except:
config['indent_json_export'] = None

if 'data' not in request:
return False
Expand All @@ -46,8 +52,8 @@ def handler(q=False):
liteAttr['value'] = attr['value']
liteEvent['Event']['Attribute'].append(liteAttr)

return {"response":[],
'data': str(base64.b64encode(
return {'response' : [],
'data' : str(base64.b64encode(
bytes(
json.dumps(liteEvent, indent=config['indent_json_export']),
'utf-8')),
Expand Down

0 comments on commit 3cb12d6

Please sign in to comment.