Merge pull request #651 from JakubOnderka/fix-json

Fix json
pull/653/head
Jakub Onderka 2024-01-09 12:23:54 +01:00 committed by GitHub
commit 66c0cecb21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -41,7 +41,7 @@ jobs:
- name: Run server in background
run: |
misp-modules -l 127.0.0.1 -s 2>error.log &
sleep 5
sleep 3
- name: Check if server is running
run: |
curl -sS localhost:6666/healthcheck

View File

@ -39,6 +39,7 @@ import tornado.process
from tornado.ioloop import IOLoop
from tornado.concurrent import run_on_executor
from concurrent.futures import ThreadPoolExecutor
from pymisp import pymisp_json_default
try:
from .modules import * # noqa
@ -202,7 +203,7 @@ class QueryModule(tornado.web.RequestHandler):
response = module.dict_handler(request=dict_payload)
else:
response = module.handler(q=json_payload)
return json.dumps(response)
return json.dumps(response, default=pymisp_json_default)
@tornado.gen.coroutine
def post(self):
@ -303,6 +304,9 @@ def main():
return 1
print(e)
print("misp-modules might still be running.")
else:
log.exception(f"Could not listen on {args.listen}:{args.port}")
return 1
log.info(f'MISP modules server started on {args.listen} port {args.port}')
if args.test: