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 - name: Run server in background
run: | run: |
misp-modules -l 127.0.0.1 -s 2>error.log & misp-modules -l 127.0.0.1 -s 2>error.log &
sleep 5 sleep 3
- name: Check if server is running - name: Check if server is running
run: | run: |
curl -sS localhost:6666/healthcheck curl -sS localhost:6666/healthcheck

View File

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