mirror of
https://github.com/valitydev/Cortex-Analyzers.git
synced 2024-11-07 01:25:21 +00:00
use api_key parameter, add detail in case of api issue and fix name to avoid template issues
This commit is contained in:
parent
9d113c09f6
commit
3e97eb8eea
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "LIS Get Report",
|
"name": "LIS_Get_Report",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"author": "LastInfoSec",
|
"author": "LastInfoSec",
|
||||||
"url": "https://github.com/TheHive-Project/Cortex-Analyzers",
|
"url": "https://github.com/TheHive-Project/Cortex-Analyzers",
|
||||||
|
@ -12,10 +12,10 @@ class LIS_GetReport(Analyzer):
|
|||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
url = "https://api.client.lastinfosec.com/v2/lis/search_hash/{0}?key={1}".format(self.observable_value,
|
url = "https://api.client.lastinfosec.com/v2/lis/search_hash/{0}?api_key={1}".format(self.observable_value,
|
||||||
self.api_key)
|
self.api_key)
|
||||||
if self.data_type == 'domain':
|
if self.data_type == 'domain':
|
||||||
url = "https://api.client.lastinfosec.com/v2/lis/search_hash/{0}?key={1}".format(self.observable_value,
|
url = "https://api.client.lastinfosec.com/v2/lis/search_hash/{0}?api_key={1}".format(self.observable_value,
|
||||||
self.api_key)
|
self.api_key)
|
||||||
|
|
||||||
useragent = {
|
useragent = {
|
||||||
@ -25,7 +25,15 @@ class LIS_GetReport(Analyzer):
|
|||||||
|
|
||||||
def check_response(self, response):
|
def check_response(self, response):
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
self.error('Bad status: {0}'.format(response.status_code))
|
try:
|
||||||
|
result = response.json()
|
||||||
|
if "detail" in result and "details" in result["detail"] and "error" in result["detail"]["details"][0]:
|
||||||
|
self.error(
|
||||||
|
'Bad status: {0}. {1}'.format(response.status_code, result["detail"]["details"][0]["error"]))
|
||||||
|
else:
|
||||||
|
self.error('Bad status: {0}'.format(response.status_code))
|
||||||
|
except Exception as ex:
|
||||||
|
self.error('Bad status: {0}'.format(response.status_code))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
Loading…
Reference in New Issue
Block a user