fix: [tests] Fixed tests for some modules waiting for standard MISP Attribute format as input

pull/488/head
chrisr3d 2021-04-15 16:08:56 +02:00
parent 6dda2d08c0
commit 53e386bf46
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 56 additions and 15 deletions

View File

@ -430,7 +430,14 @@ class TestExpansions(unittest.TestCase):
def test_shodan(self):
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:
query['config'] = self.configs[module_name]
response = self.misp_modules_post(query)
@ -513,16 +520,33 @@ class TestExpansions(unittest.TestCase):
def test_virustotal_public(self):
module_name = "virustotal_public"
query_types = ('domain', 'ip-src', 'sha256', 'url')
query_values = ('circl.lu', '149.13.33.14',
'a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3',
'http://194.169.88.56:49151/.i')
attributes = (
{
"uuid": "ffea0594-355a-42fe-9b98-fad28fd248b3",
"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')
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,
"attribute": {"type": query_type,
"value": query_value},
"attribute": attribute,
"config": self.configs[module_name]}
response = self.misp_modules_post(query)
try:
@ -538,16 +562,33 @@ class TestExpansions(unittest.TestCase):
def test_virustotal(self):
module_name = "virustotal"
query_types = ('domain', 'ip-src', 'sha256', 'url')
query_values = ('circl.lu', '149.13.33.14',
'a04ac6d98ad989312783d4fe3456c53730b212c79a426fb215708b6c6daa3de3',
'http://194.169.88.56:49151/.i')
attributes = (
{
"uuid": "ffea0594-355a-42fe-9b98-fad28fd248b3",
"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')
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,
"attribute": {"type": query_type,
"value": query_value},
"attribute": attribute,
"config": self.configs[module_name]}
response = self.misp_modules_post(query)
try: