@@ -37,6 +37,8 @@ class Configuration(models.Model):
3737 verbose_name = "Scan retention in days" ,
3838 help_text = "The number of days to retain scan data, target files, and scan result files." ,
3939 )
40+ created = models .DateTimeField (auto_now_add = True )
41+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
4042
4143 class Meta :
4244 verbose_name_plural = "Configuration"
@@ -63,6 +65,8 @@ class Engine(models.Model):
6365 description = models .CharField (unique = False , max_length = 255 , blank = True , verbose_name = "Engine Description" )
6466 api_token = models .CharField (unique = True , max_length = 40 , blank = False , verbose_name = "API Key" )
6567 last_checkin = models .DateTimeField (blank = True , null = True , verbose_name = "Last Engine Check In" )
68+ created = models .DateTimeField (auto_now_add = True )
69+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
6670
6771 def __str__ (self ):
6872 return str (self .scan_engine )
@@ -77,6 +81,8 @@ class EnginePool(models.Model):
7781 id = models .AutoField (primary_key = True , verbose_name = "Engine Pool ID" )
7882 engine_pool_name = models .CharField (unique = True , max_length = 255 , verbose_name = "Engine Pool Name" )
7983 scan_engines = models .ManyToManyField (Engine , verbose_name = "Scan engines in pool" )
84+ created = models .DateTimeField (auto_now_add = True )
85+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
8086
8187 def __str__ (self ):
8288 return str (self .engine_pool_name )
@@ -94,7 +100,7 @@ class GloballyExcludedTarget(models.Model):
94100 # is changed.
95101 globally_excluded_targets = models .CharField (
96102 unique = False ,
97- max_length = 4194304 , # 2^22 = 4194304. See note above if this value is changed.
103+ max_length = 4_194_304 , # 2^22 = 4194304. See note above if this value is changed.
98104 validators = [
99105 RegexValidator (
100106 regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -104,6 +110,7 @@ class GloballyExcludedTarget(models.Model):
104110 verbose_name = "Globally Excluded Targets" ,
105111 )
106112 note = models .TextField (unique = False , blank = True , verbose_name = "Note" )
113+ created = models .DateTimeField (auto_now_add = True )
107114 last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
108115
109116 def clean (self ):
@@ -142,6 +149,8 @@ class ScanCommand(models.Model):
142149 scan_binary = models .CharField (max_length = 7 , choices = SCAN_BINARY , default = "nmap" , verbose_name = "Scan binary" )
143150 scan_command_name = models .CharField (unique = True , max_length = 255 , verbose_name = "Scan command name" )
144151 scan_command = models .TextField (unique = False , verbose_name = "Scan command" )
152+ created = models .DateTimeField (auto_now_add = True )
153+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
145154
146155 def __str__ (self ):
147156 return f"{ self .scan_binary } ||{ self .scan_command_name } "
@@ -171,7 +180,7 @@ class Site(models.Model):
171180 # is changed.
172181 targets = models .CharField (
173182 unique = False ,
174- max_length = 4194304 , # 2^22 = 4194304. See note above if this value is changed.
183+ max_length = 4_194_304 , # 2^22 = 4194304. See note above if this value is changed.
175184 validators = [
176185 RegexValidator (
177186 regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -186,7 +195,7 @@ class Site(models.Model):
186195 excluded_targets = models .CharField (
187196 unique = False ,
188197 blank = True ,
189- max_length = 4194304 , # 2^22 = 4194304. See note above if this value is changed.
198+ max_length = 4_194_304 , # 2^22 = 4194304. See note above if this value is changed.
190199 validators = [
191200 RegexValidator (
192201 regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -210,6 +219,8 @@ class Site(models.Model):
210219 email_scan_diff_addresses = models .CharField (
211220 unique = False , blank = True , max_length = 4096 , verbose_name = "Email nmap scan diff addresses, comma separated"
212221 )
222+ created = models .DateTimeField (auto_now_add = True )
223+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
213224
214225 def clean (self ):
215226 """Checks for any invalid IPs, IP subnets, or FQDNs in the targets and excluded_targets fields."""
@@ -288,6 +299,8 @@ class Scan(models.Model):
288299 null = True ,
289300 verbose_name = "dtstart is the seed datetime object for recurrences (automatically modifed)" ,
290301 )
302+ created = models .DateTimeField (auto_now_add = True )
303+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
291304
292305 # dtstart is the seed datetime object when determining scan_scheduler.py's
293306 # scan_occurrences = scan.recurrences.between(beginning_of_today, end_of_today, dtstart=dtstart, inc=True),
@@ -362,7 +375,7 @@ class ScheduledScan(models.Model):
362375 # is changed.
363376 targets = models .CharField (
364377 unique = False ,
365- max_length = 4194304 , # 2^22 = 4194304. See note above if this value is changed.
378+ max_length = 4_194_304 , # 2^22 = 4194304. See note above if this value is changed.
366379 validators = [
367380 RegexValidator (
368381 regex = "^[a-zA-Z0-9/\.\: ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -377,7 +390,7 @@ class ScheduledScan(models.Model):
377390 excluded_targets = models .CharField (
378391 unique = False ,
379392 blank = True ,
380- max_length = 4194304 , # 2^22 = 4194304. See note above if this value is changed.
393+ max_length = 4_194_304 , # 2^22 = 4194304. See note above if this value is changed.
381394 validators = [
382395 RegexValidator (
383396 regex = "^[a-zA-Z0-9/\.\: ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
0 commit comments