24
24
import signal
25
25
import uuid
26
26
from lxml .etree import tostring , SubElement , Element
27
+ from datetime import datetime
27
28
import psutil
28
29
29
30
from ospd .ospd import OSPDaemon , logger
30
31
from ospd .misc import main as daemon_main
31
32
from ospd .misc import target_str_to_list
32
33
from ospd .cvss import CVSS
34
+ from ospd .vtfilter import VtsFilter
33
35
from ospd_openvas import __version__
34
36
35
37
from ospd_openvas .nvticache import NVTICache
@@ -201,6 +203,20 @@ def _from_bool_to_str(value):
201
203
uses 1 and 0."""
202
204
return 'yes' if value == 1 else 'no'
203
205
206
+ class OpenVasVtsFilter (VtsFilter ):
207
+ """ Methods to overwrite the ones in the original class.
208
+ Each method formats the value to be compatible with the filter
209
+ """
210
+ def format_vt_modification_time (self , value ):
211
+ """ Convert the datetime value in an 19 character string
212
+ representing YearMonthDateHourMinuteSecond.
213
+ e.g. 20190319122532
214
+ """
215
+
216
+ date = value [7 :26 ].replace (" " , "" )
217
+ date = date .replace ("-" , "" )
218
+ date = date .replace (":" ,"" )
219
+ return date
204
220
205
221
class OSPDopenvas (OSPDaemon ):
206
222
@@ -210,7 +226,8 @@ def __init__(self, certfile, keyfile, cafile):
210
226
""" Initializes the ospd-openvas daemon's internal data. """
211
227
212
228
super (OSPDopenvas , self ).__init__ (certfile = certfile , keyfile = keyfile ,
213
- cafile = cafile )
229
+ cafile = cafile ,
230
+ customvtfilter = OpenVasVtsFilter ())
214
231
self .server_version = __version__
215
232
self .scanner_info ['name' ] = 'openvassd'
216
233
self .scanner_info ['version' ] = '' # achieved during self.check()
0 commit comments