mirror of https://github.com/MISP/misp-modules
fix: [tests] Fixed tests for some modules waiting for standard MISP Attribute format as input
parent
6dda2d08c0
commit
53e386bf46
|
@ -430,7 +430,14 @@ class TestExpansions(unittest.TestCase):
|
||||||
|
|
||||||
def test_shodan(self):
|
def test_shodan(self):
|
||||||
module_name = "shodan"
|
module_name = "shodan"
|
||||||
query = {"module": module_name, "ip-src": "149.13.33.14"}
|
query = {
|
||||||
|
"module": module_name,
|
||||||
|
"attribute": {
|
||||||
|
"uuid": "a21aae0c-7426-4762-9b79-854314d69059",
|
||||||
|
"type": "ip-src",
|
||||||
|
"value": "149.13.33.14"
|
||||||
|
}
|
||||||
|
}
|
||||||
if module_name in self.configs:
|
if module_name in self.configs:
|
||||||
query['config'] = self.configs[module_name]
|
query['config'] = self.configs[module_name]
|
||||||
response = self.misp_modules_post(query)
|
response = self.misp_modules_post(query)
|
||||||
|
@ -513,16 +520,33 @@ class TestExpansions(unittest.TestCase):
|
||||||
|
|
||||||
def test_virustotal_public(self):
|
def test_virustotal_public(self):
|
||||||
module_name = "virustotal_public"
|
module_name = "virustotal_public"
|
||||||
query_types = ('domain', 'ip-src', 'sha256', 'url')
|
attributes = (
|
||||||
query_values = ('circl.lu', '149.13.33.14',
|
{
|
||||||
'a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3',
|
"uuid": "ffea0594-355a-42fe-9b98-fad28fd248b3",
|
||||||
'http://194.169.88.56:49151/.i')
|
"type": "domain",
|
||||||
|
"value": "circl.lu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "1f3f0f2d-5143-4b05-a0f1-8ac82f51a979",
|
||||||
|
"type": "ip-src",
|
||||||
|
"value": "149.13.33.14"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "b4be6652-f4ff-4515-ae63-3f016df37e8f",
|
||||||
|
"type": "sha256",
|
||||||
|
"value": "a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "6cead544-b683-48cb-b19b-a2561ffa1f51",
|
||||||
|
"type": "url",
|
||||||
|
"value": "http://194.169.88.56:49151/.i"
|
||||||
|
}
|
||||||
|
)
|
||||||
results = ('whois', 'asn', 'file', 'virustotal-report')
|
results = ('whois', 'asn', 'file', 'virustotal-report')
|
||||||
if module_name in self.configs:
|
if module_name in self.configs:
|
||||||
for query_type, query_value, result in zip(query_types, query_values, results):
|
for attribute, result in zip(attributes, results):
|
||||||
query = {"module": module_name,
|
query = {"module": module_name,
|
||||||
"attribute": {"type": query_type,
|
"attribute": attribute,
|
||||||
"value": query_value},
|
|
||||||
"config": self.configs[module_name]}
|
"config": self.configs[module_name]}
|
||||||
response = self.misp_modules_post(query)
|
response = self.misp_modules_post(query)
|
||||||
try:
|
try:
|
||||||
|
@ -538,16 +562,33 @@ class TestExpansions(unittest.TestCase):
|
||||||
|
|
||||||
def test_virustotal(self):
|
def test_virustotal(self):
|
||||||
module_name = "virustotal"
|
module_name = "virustotal"
|
||||||
query_types = ('domain', 'ip-src', 'sha256', 'url')
|
attributes = (
|
||||||
query_values = ('circl.lu', '149.13.33.14',
|
{
|
||||||
'a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3',
|
"uuid": "ffea0594-355a-42fe-9b98-fad28fd248b3",
|
||||||
'http://194.169.88.56:49151/.i')
|
"type": "domain",
|
||||||
|
"value": "circl.lu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "1f3f0f2d-5143-4b05-a0f1-8ac82f51a979",
|
||||||
|
"type": "ip-src",
|
||||||
|
"value": "149.13.33.14"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "b4be6652-f4ff-4515-ae63-3f016df37e8f",
|
||||||
|
"type": "sha256",
|
||||||
|
"value": "a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "6cead544-b683-48cb-b19b-a2561ffa1f51",
|
||||||
|
"type": "url",
|
||||||
|
"value": "http://194.169.88.56:49151/.i"
|
||||||
|
}
|
||||||
|
)
|
||||||
results = ('domain-ip', 'asn', 'virustotal-report', 'virustotal-report')
|
results = ('domain-ip', 'asn', 'virustotal-report', 'virustotal-report')
|
||||||
if module_name in self.configs:
|
if module_name in self.configs:
|
||||||
for query_type, query_value, result in zip(query_types, query_values, results):
|
for attribute, result in zip(attributes, results):
|
||||||
query = {"module": module_name,
|
query = {"module": module_name,
|
||||||
"attribute": {"type": query_type,
|
"attribute": attribute,
|
||||||
"value": query_value},
|
|
||||||
"config": self.configs[module_name]}
|
"config": self.configs[module_name]}
|
||||||
response = self.misp_modules_post(query)
|
response = self.misp_modules_post(query)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue