Skip to content

Commit 8895737

Browse files
authored
Merge pull request #727 from lydionLuna/virustotal_public_module_patch
[Bug] Added asyncio due to virustotal_public module issue
2 parents 36d6012 + 4c31c21 commit 8895737

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

misp_modules/modules/expansion/virustotal_public.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import logging
3+
import asyncio
34
from urllib.parse import urlparse
45

56
import vt
@@ -284,6 +285,11 @@ def parse_error(status_code: int) -> str:
284285
def handler(q=False):
285286
if q is False:
286287
return False
288+
try:
289+
asyncio.get_running_loop()
290+
except RuntimeError:
291+
asyncio.set_event_loop(asyncio.new_event_loop())
292+
287293
request = json.loads(q)
288294
if not request.get("config") or not request["config"].get("apikey"):
289295
misperrors["error"] = "A VirusTotal api key is required for this module."

0 commit comments

Comments
 (0)