django-restit 4.2.9__py3-none-any.whl → 4.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- account/models/member.py +1 -1
- auditlog/rpc.py +0 -69
- {django_restit-4.2.9.dist-info → django_restit-4.2.11.dist-info}/METADATA +1 -1
- {django_restit-4.2.9.dist-info → django_restit-4.2.11.dist-info}/RECORD +11 -11
- incident/models/incident.py +12 -0
- incident/periodic.py +5 -0
- incident/tq.py +12 -1
- rest/__init__.py +1 -1
- rest/templates/rest_html.html +2 -1
- {django_restit-4.2.9.dist-info → django_restit-4.2.11.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.9.dist-info → django_restit-4.2.11.dist-info}/WHEEL +0 -0
account/models/member.py
CHANGED
@@ -468,7 +468,7 @@ class Member(User, RestModel, MetaDataModel):
|
|
468
468
|
def disable(self, by="system", reason="", notify=True):
|
469
469
|
self.is_active = False
|
470
470
|
self.save()
|
471
|
-
self.memberships.update(state=-
|
471
|
+
self.memberships.update(state=-25)
|
472
472
|
|
473
473
|
[s.delete() for s in Session.objects.all() if s.get_decoded().get('_auth_user_id') == self.pk]
|
474
474
|
# notify account disabled
|
auditlog/rpc.py
CHANGED
@@ -57,72 +57,3 @@ def plogList(request):
|
|
57
57
|
qset = qset.filter(message__icontains=term)
|
58
58
|
|
59
59
|
return rv.restList(request, qset.order_by('-when'), **auditlog.PersistentLog.getGraph(graph))
|
60
|
-
|
61
|
-
|
62
|
-
@rd.urlGET (r'^list$')
|
63
|
-
def auditList(request):
|
64
|
-
"""
|
65
|
-
| Parameter: model=<string> (default=all)
|
66
|
-
| Parameter: id=<int> (default=all)
|
67
|
-
| Parameter: attributes=<string> (default=all)
|
68
|
-
| Parameter: user=<id|username> (default=all)
|
69
|
-
|
|
70
|
-
| Return: audit log entries
|
71
|
-
"""
|
72
|
-
ret = auditlog.AuditLog.objects.all()
|
73
|
-
|
74
|
-
model = request.DATA.get('model')
|
75
|
-
if model:
|
76
|
-
ret = ret.filter(model=model)
|
77
|
-
|
78
|
-
id = request.DATA.get('id')
|
79
|
-
if id:
|
80
|
-
ret = ret.filter(pkey=int(id))
|
81
|
-
|
82
|
-
attributes = request.DATA.get('attributes')
|
83
|
-
if attributes:
|
84
|
-
attributes = attributes.split(',')
|
85
|
-
print(attributes)
|
86
|
-
ret = ret.filter(attribute__in=attributes)
|
87
|
-
|
88
|
-
user = request.DATA.get('user')
|
89
|
-
if user:
|
90
|
-
ret = ret.filter(user=user)
|
91
|
-
|
92
|
-
return rv.restList(
|
93
|
-
request, ret, sort='-when',
|
94
|
-
fields=(
|
95
|
-
'when',
|
96
|
-
'model',
|
97
|
-
'pkey',
|
98
|
-
'attribute',
|
99
|
-
'user.id',
|
100
|
-
'user.username',
|
101
|
-
'reference',
|
102
|
-
'how',
|
103
|
-
'referer',
|
104
|
-
'stack',
|
105
|
-
'oldval',
|
106
|
-
'newval',
|
107
|
-
), recurse_into=(
|
108
|
-
'user',
|
109
|
-
), require_perms=(
|
110
|
-
'auditlog.can_read',
|
111
|
-
),
|
112
|
-
)
|
113
|
-
|
114
|
-
|
115
|
-
@rd.url(r'^nuke$')
|
116
|
-
@rd.perm_required("nuke_logs")
|
117
|
-
def nuke_log_data(request):
|
118
|
-
# nuclear option used for testing system to clear out all wallet data
|
119
|
-
# make sure this is enabled for this setup
|
120
|
-
confirm_nuke = request.DATA.get("nuke_code", None)
|
121
|
-
if confirm_nuke != "launch" or not getattr(auditlog.settings, "CAN_NUKE_DATABASE", False):
|
122
|
-
return rv.restPermissionDenied(request)
|
123
|
-
|
124
|
-
# first nuke all transactions
|
125
|
-
auditlog.PersistentLog.objects.all().delete()
|
126
|
-
auditlog.AuditLog.objects.all().delete()
|
127
|
-
auditlog.SessionLog.objects.all().delete()
|
128
|
-
return rv.restStatus(request, True)
|
@@ -23,7 +23,7 @@ account/models/device.py,sha256=XipNpByreGubB5-d4ZBOoIV5Xw14b2Btcgn6fXz8HAc,4105
|
|
23
23
|
account/models/feeds.py,sha256=4n4Mv8HjcXpUmMPWafHlsGbVQ1fDKdtblL1hp30sDrg,1437
|
24
24
|
account/models/group.py,sha256=jj4csGHDyDRMS_maL8AeV1k3whSxBdeffHxmnXrn-sg,20064
|
25
25
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
26
|
-
account/models/member.py,sha256=
|
26
|
+
account/models/member.py,sha256=QZ64pwPzk0Z10XHVgFgHuJfxSrguxJabce1bSpJbCho,49326
|
27
27
|
account/models/membership.py,sha256=Qmp0xQa_3ObB581L83gce69t9eSfyH-mZZuGqW3ueI8,7763
|
28
28
|
account/models/notify.py,sha256=YnZujSHJHY7B09e6FIyZIEJRWLPYk1Sk1e92tFzB1IA,12078
|
29
29
|
account/models/session.py,sha256=swhxcx_lWzOpGCmfifXoACgWYqmKmS7eZsD9s9jSToc,3509
|
@@ -57,7 +57,7 @@ auditlog/migrations/0001_initial.py,sha256=X171gKQZIaTO9FGNG1yKTjGSZS0ZjZj5gvimF
|
|
57
57
|
auditlog/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
58
|
auditlog/models.py,sha256=6CyWMRNvqCYoyiXE9_qk41EJFjutwo6nfoP9KKYWiYw,16294
|
59
59
|
auditlog/periodic.py,sha256=AUhDeVsZtC47BJ-lklvYEegHoxAzj1RpIvRFSsM7g5E,363
|
60
|
-
auditlog/rpc.py,sha256=
|
60
|
+
auditlog/rpc.py,sha256=lhme-ScqwVSKfHo3RlzMVm_C-Yx4xOxPogBEv7b3w1M,1720
|
61
61
|
auditlog/tq.py,sha256=OgzJVspWI6FL92GEhDPtabYoP_Hd3zGNh0E297abz3Y,2415
|
62
62
|
auditlog/urls.py,sha256=GNqpN74EpYlMND2UFUdPt5rOkTYYrdbTV0W3fg4zLfQ,163
|
63
63
|
inbox/README.md,sha256=jsklDrzD5d94r7cwgaU6Gi1HCjBDfWq7jd92qB0JYPU,2169
|
@@ -97,18 +97,18 @@ incident/migrations/0013_rulecheck_is_required.py,sha256=cL7tOj5XGPpKd2f5BojIKfN
|
|
97
97
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
98
98
|
incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
|
99
99
|
incident/models/event.py,sha256=Nzy21glVc7V8Z6YziTt3SeQB3xCEKWuVaF01ufjB6xk,6849
|
100
|
-
incident/models/incident.py,sha256=
|
100
|
+
incident/models/incident.py,sha256=S3Z6PO-kYcpjBW3s_pGVEA14FOFc1Jrs5L3GRjiC0DA,15686
|
101
101
|
incident/models/ossec.py,sha256=p1ptr-8lnaj1EP_VmPR58b2LmaYBGaYYKAMqhWK5yZM,2227
|
102
102
|
incident/models/rules.py,sha256=DR7IW18Nxp_cEl3mN0E8jiTdL9eUmY_38Uag8OS7YOU,6024
|
103
103
|
incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
|
104
104
|
incident/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
incident/parsers/ossec.py,sha256=XbiOmZ2CeRejABDeSUYBlK3iSwV68N7MQHkSk4ZwMGw,6247
|
106
|
-
incident/periodic.py,sha256=
|
106
|
+
incident/periodic.py,sha256=eX1rQK6v65A9ugofTvJPSmAWei6C-3EYgzCMuGZ03jM,381
|
107
107
|
incident/rpc.py,sha256=MoEEPRwayjkS4TNn4jVRicjJAMmGuNCZ9BoZhHbW65g,7546
|
108
108
|
incident/templates/email/incident_change.html,sha256=O_5ocWTsnqmmOuQhAtXEiE4rWecnZnJjoKU4MwV6ILo,14178
|
109
109
|
incident/templates/email/incident_new.html,sha256=IPX3CqIrvdrZSn13_jlR6sEb0If8ftvUrUpkzC5G2Gc,15173
|
110
110
|
incident/templates/email/incident_plain.html,sha256=fx4zsoldG1AQEBA6IYx5BJp_MAMizgjjx9EmuR5m4SQ,14727
|
111
|
-
incident/tq.py,sha256=
|
111
|
+
incident/tq.py,sha256=Wzzsuyj6LLgeY9Sd71TAdz1vov-NHtU2TCES0eY_A3c,5029
|
112
112
|
location/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
113
|
location/admin.py,sha256=6S97Rlgjkk0jM15sbT1OJRPZbgvKn2rn7duCSazOXq4,297
|
114
114
|
location/geolocate.py,sha256=UgV129vmSxnqYFBYJD2RQVOcC1-lJJ1zUaxDqOJRbG4,1694
|
@@ -353,7 +353,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
353
353
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
354
354
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
355
355
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
356
|
-
rest/__init__.py,sha256=
|
356
|
+
rest/__init__.py,sha256=nv6oOALCMbitZIAgHoohQVuEIESvc6Izm4HxqbY69rc,121
|
357
357
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
358
358
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
359
359
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -413,7 +413,7 @@ rest/static/rest/rest.scss,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
413
413
|
rest/templates/email/error.html,sha256=JDtB0egYLHDZS6KCNFslgB4ZiaidfPdjkTXaHiyVbDY,529
|
414
414
|
rest/templates/email/error.subject,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
415
415
|
rest/templates/rest_docs.html,sha256=lr5p3ic0uCRli9KEvoULTa5a3_54wNE5yL16kN1uau8,7148
|
416
|
-
rest/templates/rest_html.html,sha256=
|
416
|
+
rest/templates/rest_html.html,sha256=utOzvXEE6LiHFUvcAQUDOQ0yl3J_2F3-22r0K611eTQ,11048
|
417
417
|
rest/ua.py,sha256=0wwOtJPWCiCxUKzWKyMApRbSaiuAxCCk0Pe3OwzYBhE,185398
|
418
418
|
rest/uberdict.py,sha256=ivDpzfchQqX8dM2_TtuyMW7NNO-j7zDmxkdKixQxvU4,17064
|
419
419
|
rest/url_docs.py,sha256=O8O_CQso3fB-7o-huidIT1BRGv5R6lDW-yKHnsGyAPk,11881
|
@@ -485,7 +485,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
485
485
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
486
486
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
487
487
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
488
|
-
django_restit-4.2.
|
489
|
-
django_restit-4.2.
|
490
|
-
django_restit-4.2.
|
491
|
-
django_restit-4.2.
|
488
|
+
django_restit-4.2.11.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
489
|
+
django_restit-4.2.11.dist-info/METADATA,sha256=wcPSgtYyuZ3H10nYpwHd2yTIp2N5Rvat6q-KkEqD84g,7573
|
490
|
+
django_restit-4.2.11.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
491
|
+
django_restit-4.2.11.dist-info/RECORD,,
|
incident/models/incident.py
CHANGED
@@ -74,6 +74,18 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
74
74
|
def first_event(self):
|
75
75
|
return self.events.first()
|
76
76
|
|
77
|
+
@property
|
78
|
+
def action_triggered(self):
|
79
|
+
if self.rule is None or self.rule.action_after == 0:
|
80
|
+
return True
|
81
|
+
return self.events.all().count() >= abs(self.rule.action_after)
|
82
|
+
|
83
|
+
@property
|
84
|
+
def bundle_expired(self):
|
85
|
+
if self.rule is not None:
|
86
|
+
return self.created < (datetime.now() - timedelta(minutes=self.rule.bundle))
|
87
|
+
return True
|
88
|
+
|
77
89
|
def set_action(self, value):
|
78
90
|
if value == "merge":
|
79
91
|
request = self.getActiveRequest()
|
incident/periodic.py
CHANGED
@@ -5,3 +5,8 @@ from taskqueue.models import Task
|
|
5
5
|
@periodic(minute=50, hour=8)
|
6
6
|
def run_cleanup(force=False, verbose=False, now=None):
|
7
7
|
Task.Publish("incident", "run_cleanup", channel="tq_app_handler")
|
8
|
+
|
9
|
+
|
10
|
+
@periodic(minute=30)
|
11
|
+
def run_auto_close(force=False, verbose=False, now=None):
|
12
|
+
Task.Publish("incident", "run_auto_close", channel="tq_app_handler")
|
incident/tq.py
CHANGED
@@ -123,7 +123,7 @@ def run_cleanup(task):
|
|
123
123
|
task.log(f"deleted {count} old ServerOssecAlert")
|
124
124
|
# delete all events older then 90 days
|
125
125
|
count = ia.Event.objects.filter(created__lte=stale).filter(
|
126
|
-
Q(incident__state=ia.INCIDENT_STATE_IGNORE)|Q(incident__isnull=True)).delete()
|
126
|
+
Q(incident__state=ia.INCIDENT_STATE_IGNORE) | Q(incident__isnull=True)).delete()
|
127
127
|
if count:
|
128
128
|
task.log(f"deleted {count} old Events")
|
129
129
|
|
@@ -131,3 +131,14 @@ def run_cleanup(task):
|
|
131
131
|
if count:
|
132
132
|
task.log(f"deleted {count} duplicate IPs")
|
133
133
|
|
134
|
+
|
135
|
+
def run_auto_close(task):
|
136
|
+
# lets check any incidents that haven't reached action threshold and older then bundle time
|
137
|
+
qset = ia.Incident.objects.filter(state=ia.INCIDENT_STATE_NEW, rule__action_after__gt=0)
|
138
|
+
for inc in qset:
|
139
|
+
if inc.bundle_expired and not inc.action_triggered:
|
140
|
+
inc.state = ia.INCIDENT_STATE_IGNORE
|
141
|
+
inc.save()
|
142
|
+
inc.logHistory("history", "auto ignore", notify=False)
|
143
|
+
|
144
|
+
|
rest/__init__.py
CHANGED
rest/templates/rest_html.html
CHANGED
@@ -59,6 +59,8 @@
|
|
59
59
|
font-size: 18px;
|
60
60
|
height: 100%;
|
61
61
|
background: #333333;
|
62
|
+
background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(50,43,56,1) 35%, rgba(56,54,85,1) 100%);
|
63
|
+
|
62
64
|
}
|
63
65
|
|
64
66
|
footer {
|
@@ -251,7 +253,6 @@
|
|
251
253
|
<div class="path">
|
252
254
|
{{path}}
|
253
255
|
</div>
|
254
|
-
<h4 class='subtitle'>request:</h4>
|
255
256
|
<div class="request">
|
256
257
|
<pre>{{req_out}}</pre>
|
257
258
|
</div>
|
File without changes
|
File without changes
|