Merge branch 'main' of github.com:MISP/misp-modules

pull/613/head
Christian Studer 2023-05-11 16:11:00 +02:00
commit 88962aba19
1 changed files with 3 additions and 4 deletions

View File

@ -9,7 +9,7 @@ moduleinfo = {
"version": "1.0",
"author": "Shivam Sandbhor <shivam@crowdsec.net>",
"description": "Module to access CrowdSec CTI API.",
"module-type": ["hover"],
"module-type": ["hover", "expansion"],
}
moduleconfig = ["api_key", "api_version"]
@ -25,8 +25,7 @@ def handler(q=False):
if not request["config"].get("api_key"):
return {"error": "Missing CrowdSec API key"}
if not request["config"].get("api_version"):
return {"error": "Missing CrowdSec API version parameter"}
request["config"]["api_version"] = "v2"
if request["config"]["api_version"] == "v2":
return _handler_v2(request)
@ -43,7 +42,7 @@ def _handler_v2(request_data):
f"https://cti.api.crowdsec.net/v2/smoke/{ip}",
headers={
"x-api-key": request_data["config"]["api_key"],
"User-Agent": "crowdsec-misp/v1.0.0",
"User-Agent": "crowdsec-misp/v1.0.0",
},
)
crowdsec_cti.raise_for_status()