3
3
from dotmap import DotMap
4
4
5
5
SCANS_FROM_DB_TEST_V1 = [
6
- {"id" : 1 , "uuid" : "uuid_1" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
6
+ {"id" : 1 , "uuid" : "uuid_1" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
7
7
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
8
8
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
9
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : [
9
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : [
10
10
{"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
11
- {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
12
- {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
11
+ {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
12
+ {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
13
13
]
14
14
}, "result_hash" : "d41d8cd98f00b204e9800998ecf8427e" , "created_at" : "2021-01-01 00:00:00" },
15
- {"id" : 2 , "uuid" : "uuid_2" , "host_subnet" : "0.0.0.0/24" ,"host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
15
+ {"id" : 2 , "uuid" : "uuid_2" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
16
16
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
17
17
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
18
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : [
19
- {"portid" : "80" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
20
- {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
21
- {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
18
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : [
19
+ {"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
20
+ {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
21
+ {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
22
22
]
23
23
}, "result_hash" : "d41d8cd98asw0b204e9800998ecf8427e" , "created_at" : "2021-01-02 00:00:00" },
24
- {"id" : 3 , "uuid" : "uuid_3" , "host_subnet" : "0.0.0.0/24" ,"host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
24
+ {"id" : 3 , "uuid" : "uuid_3" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
25
25
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
26
26
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
27
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : [
28
- {"portid" : "80" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
29
- {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
30
- {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
27
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : [
28
+ {"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
29
+ {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
30
+ {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
31
31
]
32
32
}, "result_hash" : "d41d8cd98f00b204e9800998ecf8427e" , "created_at" : "2021-01-03 00:00:00" }
33
33
]
34
34
35
35
36
36
SCANS_FROM_DB_TEST_V1_PORTS_KEYS = [
37
- {"id" : 1 , "uuid" : "uuid_1" , "host_subnet" : "0.0.0.0/24" ,"host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
37
+ {"id" : 1 , "uuid" : "uuid_1" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
38
38
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
39
39
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
40
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : {
41
- "80" : {"portid" : "80" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
42
- "22" : {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
43
- "443" : {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
40
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : {
41
+ "80" : {"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
42
+ "22" : {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
43
+ "443" : {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
44
44
}}, "result_hash" : "d41d8cd98f00b204e9800998ecf8427e" , "created_at" : "2021-01-01 00:00:00" },
45
45
46
- {"id" : 2 , "uuid" : "uuid_2" , "host_subnet" : "0.0.0.0/24" ,"host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
46
+ {"id" : 2 , "uuid" : "uuid_2" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
47
47
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
48
48
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
49
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : {
50
- "80" : {"portid" : "80" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
51
- "22" : {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
52
- "443" : {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
49
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : {
50
+ "80" : {"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
51
+ "22" : {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
52
+ "443" : {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
53
53
}}, "result_hash" : "d41d8cd98asw0b204e9800998ecf8427e" , "created_at" : "2021-01-01 00:00:00" },
54
- {"id" : 3 , "uuid" : "uuid_3" , "host_subnet" : "0.0.0.0/24" ,"host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
54
+ {"id" : 3 , "uuid" : "uuid_3" , "host_subnet" : "0.0.0.0/24" , "host" : "0.0.0.0" , "profile_name" : "TEST_V1" , "arguments" : "-vv" , "results" : {
55
55
"host" : "0.0.0.0" , "status" : "up" , "last_boot" : "none" , "os" : ["none" ], "osfingerprint" : "none" , "hops" : [
56
56
{"ipaddr" : "10.0.0.0" , "host" : "host_1" },
57
- {"ipaddr" : "10.0.0.1" , "host" : "host_2" }],"ports" : {
58
- "80" : {"portid" : "80" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
59
- "22" : {"portid" : "22" , "proto" : "tcp" ,"state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
60
- "443" : {"portid" : "443" , "proto" : "tcp" ,"state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
57
+ {"ipaddr" : "10.0.0.1" , "host" : "host_2" }], "ports" : {
58
+ "80" : {"portid" : "80" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "http" , "servicefp" : "s_fp_test" , "service_product" : "Apache" },
59
+ "22" : {"portid" : "22" , "proto" : "tcp" , "state" : {"state" : "closed" }, "service" : "ssh" , "servicefp" : "s_fp_test" , "service_product" : "OpenSSH" },
60
+ "443" : {"portid" : "443" , "proto" : "tcp" , "state" : {"state" : "open" }, "service" : "https" , "servicefp" : "s_fp_test" , "service_product" : "Nginx" }
61
61
}}, "result_hash" : "d41d8cd98f00b204e9800998ecf8427e" , "created_at" : "2021-01-01 00:00:00" },
62
62
]
63
63
64
+
64
65
def mock_data_with_real_hash (test_data ):
65
66
for scan in test_data :
66
67
scan ["result_hash" ] = hash_string (json .dumps (scan ["results" ]))
67
68
return test_data
68
69
70
+
69
71
DIFFS = [
70
72
{
71
- "ids" : [1 ,2 ],
73
+ "ids" : [1 , 2 ],
72
74
"dates" : ["2024-02-01 00:00:00" , "2024-01-01 00:00:00" ],
73
75
"generic" : [{
74
76
"host" : "0.0.0.0" ,
75
77
"arguments" : "-vv" ,
76
78
"profile_name" : "PROFILE_1"
77
- },{
79
+ }, {
78
80
"host" : "0.0.0.0" ,
79
81
"arguments" : "-vv" ,
80
82
"profile_name" : "PROFILE_1"
@@ -93,7 +95,7 @@ def mock_data_with_real_hash(test_data):
93
95
"result_hashes" : ["a123456" , "a123411" ]
94
96
},
95
97
{
96
- "ids" : [1 ,2 ],
98
+ "ids" : [1 , 2 ],
97
99
"dates" : ["2024-02-06 00:00:00" , "2024-02-04 00:00:00" ],
98
100
"generic" : [
99
101
{
@@ -132,7 +134,6 @@ def mock_data_with_real_hash(test_data):
132
134
"from" : "open" ,
133
135
"to" : "closed"
134
136
}
135
-
136
137
}
137
138
}
138
139
}
0 commit comments