File tree 5 files changed +18
-18
lines changed
5 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ class Config:
60
60
-------------------------------------------------------
61
61
- Scans in Db : {}
62
62
- Profiles in Db : {}
63
- - Profiles : {}
63
+ - Profile : {}
64
64
- Configuration file : {}
65
65
- Output file : {}
66
66
-------------------------------------------------------
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ def extract_port_scan_dict_results(cls, results):
91
91
Exception: If an error occurs during the scan parser.
92
92
93
93
"""
94
+ # TODO: We can add here as many fields as we want!
94
95
try :
95
96
scan_results = []
96
97
for host in results .hosts :
@@ -107,22 +108,21 @@ def extract_port_scan_dict_results(cls, results):
107
108
"servicefp" : "none" if isinstance (s .servicefp , str ) and s .servicefp == "" else s .servicefp ,
108
109
"service_product" : "none" if isinstance (s .banner , str ) and s .banner == "" else s .banner ,
109
110
})
110
-
111
- scan ["os" ] = []
111
+
112
+ scan ["os" ] = {}
112
113
try :
113
- for _idx in range (3 ):
114
- scan ["os" ].append (
115
- host ._extras ["os" ]["osmatches" ][_idx ]["osmatch" ]["name" ])
114
+ for _idx , _match in enumerate (host ._extras ["os" ]["osmatches" ][:3 ]):
115
+ scan ["os" ][str (_idx + 1 )] = _match ["osmatch" ]["name" ]
116
116
except (KeyError , IndexError ):
117
117
if len (scan ["os" ]) == 0 :
118
118
scan ["os" ] = ["none" ]
119
119
else :
120
120
pass
121
121
122
- scan ["hops" ] = []
122
+ scan ["hops" ] = {}
123
123
try :
124
- for _hop in host ._extras ["trace" ]["hops" ]:
125
- scan ["hops" ]. append ({ _k : _hop [ _k ] for _k in ["ipaddr" , "host" ]})
124
+ for _idx , _hop in enumerate ( host ._extras ["trace" ]["hops" ]) :
125
+ scan ["hops" ][ str ( _idx + 1 )] = _hop ["ipaddr" ]
126
126
except (KeyError , IndexError ):
127
127
if len (scan ["hops" ]) == 0 :
128
128
scan ["hops" ] = ["none" ]
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class Scan(Schema):
38
38
host = fields .Str (required = True )
39
39
status = fields .Str (required = True )
40
40
ports = fields .Nested (ScanPorts , many = True , required = True )
41
- os = fields .List ( fields . Str (), required = True )
41
+ os = fields .Raw ( required = True )
42
42
hops = fields .Raw (required = True )
43
43
osfingerprint = fields .Str (required = True )
44
44
last_boot = fields .Str (required = True )
Original file line number Diff line number Diff line change 26
26
"marshmallow==3.14.0" ,
27
27
"jinja2==3.1.3" ,
28
28
"getkey==0.6" ,
29
- "python-libnmap @ git+https://github.com/Logisek/python-libnmap.git@develop #egg=libnmap" ,
29
+ "python-libnmap @ git+https://github.com/Logisek/python-libnmap.git@master #egg=libnmap" ,
30
30
"pdfkit" ,
31
31
"inputimeout"
32
32
],
Original file line number Diff line number Diff line change @@ -50,13 +50,13 @@ def test_scan(self):
50
50
"service_product" : "Nginx"
51
51
}
52
52
],
53
- "os" : [
54
- "os_name"
55
- ] ,
56
- "hops" : [
57
- { "ipaddr " : "10.0.0.0" , "host" : "host_1" } ,
58
- { "ipaddr " : "10.0.0.1" , "host" : "host_2" },
59
- ] ,
53
+ "os" : {
54
+ "1" : " os_name"
55
+ } ,
56
+ "hops" : {
57
+ "1 " : "10.0.0.0" ,
58
+ "2 " : "10.0.0.1"
59
+ } ,
60
60
"osfingerprint" : "os_fingerprint" ,
61
61
"last_boot" : "12345678"
62
62
}
You can’t perform that action at this time.
0 commit comments