@@ -37,6 +37,8 @@ class Configuration(models.Model):
37
37
verbose_name = "Scan retention in days" ,
38
38
help_text = "The number of days to retain scan data, target files, and scan result files." ,
39
39
)
40
+ created = models .DateTimeField (auto_now_add = True )
41
+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
40
42
41
43
class Meta :
42
44
verbose_name_plural = "Configuration"
@@ -63,6 +65,8 @@ class Engine(models.Model):
63
65
description = models .CharField (unique = False , max_length = 255 , blank = True , verbose_name = "Engine Description" )
64
66
api_token = models .CharField (unique = True , max_length = 40 , blank = False , verbose_name = "API Key" )
65
67
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" )
66
70
67
71
def __str__ (self ):
68
72
return str (self .scan_engine )
@@ -77,6 +81,8 @@ class EnginePool(models.Model):
77
81
id = models .AutoField (primary_key = True , verbose_name = "Engine Pool ID" )
78
82
engine_pool_name = models .CharField (unique = True , max_length = 255 , verbose_name = "Engine Pool Name" )
79
83
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" )
80
86
81
87
def __str__ (self ):
82
88
return str (self .engine_pool_name )
@@ -94,7 +100,7 @@ class GloballyExcludedTarget(models.Model):
94
100
# is changed.
95
101
globally_excluded_targets = models .CharField (
96
102
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.
98
104
validators = [
99
105
RegexValidator (
100
106
regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -104,6 +110,7 @@ class GloballyExcludedTarget(models.Model):
104
110
verbose_name = "Globally Excluded Targets" ,
105
111
)
106
112
note = models .TextField (unique = False , blank = True , verbose_name = "Note" )
113
+ created = models .DateTimeField (auto_now_add = True )
107
114
last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
108
115
109
116
def clean (self ):
@@ -142,6 +149,8 @@ class ScanCommand(models.Model):
142
149
scan_binary = models .CharField (max_length = 7 , choices = SCAN_BINARY , default = "nmap" , verbose_name = "Scan binary" )
143
150
scan_command_name = models .CharField (unique = True , max_length = 255 , verbose_name = "Scan command name" )
144
151
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" )
145
154
146
155
def __str__ (self ):
147
156
return f"{ self .scan_binary } ||{ self .scan_command_name } "
@@ -171,7 +180,7 @@ class Site(models.Model):
171
180
# is changed.
172
181
targets = models .CharField (
173
182
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.
175
184
validators = [
176
185
RegexValidator (
177
186
regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -186,7 +195,7 @@ class Site(models.Model):
186
195
excluded_targets = models .CharField (
187
196
unique = False ,
188
197
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.
190
199
validators = [
191
200
RegexValidator (
192
201
regex = "^[a-zA-Z0-9/\.\:\- ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -210,6 +219,8 @@ class Site(models.Model):
210
219
email_scan_diff_addresses = models .CharField (
211
220
unique = False , blank = True , max_length = 4096 , verbose_name = "Email nmap scan diff addresses, comma separated"
212
221
)
222
+ created = models .DateTimeField (auto_now_add = True )
223
+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
213
224
214
225
def clean (self ):
215
226
"""Checks for any invalid IPs, IP subnets, or FQDNs in the targets and excluded_targets fields."""
@@ -288,6 +299,8 @@ class Scan(models.Model):
288
299
null = True ,
289
300
verbose_name = "dtstart is the seed datetime object for recurrences (automatically modifed)" ,
290
301
)
302
+ created = models .DateTimeField (auto_now_add = True )
303
+ last_updated = models .DateTimeField (auto_now = True , verbose_name = "Last updated" )
291
304
292
305
# dtstart is the seed datetime object when determining scan_scheduler.py's
293
306
# scan_occurrences = scan.recurrences.between(beginning_of_today, end_of_today, dtstart=dtstart, inc=True),
@@ -362,7 +375,7 @@ class ScheduledScan(models.Model):
362
375
# is changed.
363
376
targets = models .CharField (
364
377
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.
366
379
validators = [
367
380
RegexValidator (
368
381
regex = "^[a-zA-Z0-9/\.\: ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
@@ -377,7 +390,7 @@ class ScheduledScan(models.Model):
377
390
excluded_targets = models .CharField (
378
391
unique = False ,
379
392
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.
381
394
validators = [
382
395
RegexValidator (
383
396
regex = "^[a-zA-Z0-9/\.\: ]*$" , # Characters to support IPv4, IPv6, and FQDNs only. Space delimited.
0 commit comments