fix: Bump describeTypes.json

Add testing
pull/146/head
Raphaël Vinot 2017-12-01 10:36:09 +01:00
parent 298c0873cf
commit 2e46f00055
2 changed files with 48 additions and 2 deletions

View File

@ -409,6 +409,14 @@
"default_category": "Network activity", "default_category": "Network activity",
"to_ids": 1 "to_ids": 1
}, },
"mac-address": {
"default_category": "Network activity",
"to_ids": 0
},
"mac-eui-64": {
"default_category": "Network activity",
"to_ids": 0
},
"email-dst-display-name": { "email-dst-display-name": {
"default_category": "Payload delivery", "default_category": "Payload delivery",
"to_ids": 0 "to_ids": 0
@ -482,7 +490,7 @@
"to_ids": 0 "to_ids": 0
}, },
"gender": { "gender": {
"default_category": "", "default_category": "Person",
"to_ids": 0 "to_ids": 0
}, },
"passport-number": { "passport-number": {
@ -665,6 +673,8 @@
"ip-dst|port", "ip-dst|port",
"ip-src|port", "ip-src|port",
"hostname|port", "hostname|port",
"mac-address",
"mac-eui-64",
"email-dst-display-name", "email-dst-display-name",
"email-src-display-name", "email-src-display-name",
"email-header", "email-header",
@ -777,6 +787,8 @@
"filename|imphash", "filename|imphash",
"filename|impfuzzy", "filename|impfuzzy",
"filename|pehash", "filename|pehash",
"mac-address",
"mac-eui-64",
"ip-src", "ip-src",
"ip-dst", "ip-dst",
"ip-dst|port", "ip-dst|port",
@ -930,6 +942,8 @@
"hostname", "hostname",
"domain", "domain",
"domain|ip", "domain|ip",
"mac-address",
"mac-eui-64",
"email-dst", "email-dst",
"url", "url",
"uri", "uri",
@ -964,7 +978,8 @@
"comment", "comment",
"text", "text",
"x509-fingerprint-sha1", "x509-fingerprint-sha1",
"other" "other",
"dns-soa-email"
], ],
"External analysis": [ "External analysis": [
"md5", "md5",
@ -978,6 +993,8 @@
"ip-dst", "ip-dst",
"ip-dst|port", "ip-dst|port",
"ip-src|port", "ip-src|port",
"mac-address",
"mac-eui-64",
"hostname", "hostname",
"domain", "domain",
"domain|ip", "domain|ip",

View File

@ -241,5 +241,34 @@ class TestOffline(unittest.TestCase):
return unittest.SkipTest() return unittest.SkipTest()
print(json_blob) print(json_blob)
def test_describeTypes_sane_default(self, m):
sane_default = self.types['result']['sane_defaults']
self.assertEqual(sorted(sane_default.keys()), sorted(self.types['result']['types']))
def test_describeTypes_categories(self, m):
category_type_mappings = self.types['result']['category_type_mappings']
self.assertEqual(sorted(category_type_mappings.keys()), sorted(self.types['result']['categories']))
def test_describeTypes_types_in_categories(self, m):
category_type_mappings = self.types['result']['category_type_mappings']
for category, types in category_type_mappings.items():
existing_types = [t for t in types if t in self.types['result']['types']]
self.assertEqual(sorted(existing_types), sorted(types))
def test_describeTypes_types_have_category(self, m):
category_type_mappings = self.types['result']['category_type_mappings']
all_types = set()
for category, types in category_type_mappings.items():
all_types.update(types)
self.assertEqual(sorted(list(all_types)), sorted(self.types['result']['types']))
def test_describeTypes_sane_default_valid_category(self, m):
sane_default = self.types['result']['sane_defaults']
categories = self.types['result']['categories']
for t, sd in sane_default.items():
self.assertTrue(sd['to_ids'] in [0, 1])
self.assertTrue(sd['default_category'] in categories)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()