django-restit 4.2.79__py3-none-any.whl → 4.2.81__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.
- auditlog/migrations/0002_alter_persistentlog_session.py +20 -0
- {django_restit-4.2.79.dist-info → django_restit-4.2.81.dist-info}/METADATA +1 -1
- {django_restit-4.2.79.dist-info → django_restit-4.2.81.dist-info}/RECORD +11 -8
- inbox/migrations/0005_alter_mailbox_state.py +18 -0
- incident/migrations/0015_rule_title_template_alter_incident_state.py +23 -0
- incident/models/event.py +8 -2
- incident/models/rules.py +1 -0
- incident/parsers/ossec.py +8 -3
- wiki/migrations/0002_alter_pagemedia_entry.py +19 -0
- incident/server.py +0 -0
- {django_restit-4.2.79.dist-info → django_restit-4.2.81.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.79.dist-info → django_restit-4.2.81.dist-info}/WHEEL +0 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-13 02:34
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
import django.db.models.deletion
|
5
|
+
|
6
|
+
|
7
|
+
class Migration(migrations.Migration):
|
8
|
+
|
9
|
+
dependencies = [
|
10
|
+
('sessionlog', '0001_initial'),
|
11
|
+
('auditlog', '0001_initial'),
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
migrations.AlterField(
|
16
|
+
model_name='persistentlog',
|
17
|
+
name='session',
|
18
|
+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='sessionlog.sessionlog'),
|
19
|
+
),
|
20
|
+
]
|
@@ -65,6 +65,7 @@ auditlog/cloudwatch.py,sha256=R-B_ByVM3We26YnDoFYIQeWV31CUyS63QTojRAkfWa8,2805
|
|
65
65
|
auditlog/decorators.py,sha256=ZoIv0fhZjxtMEV15NcKijW4xPF5UEScPna60zB3TxZo,6553
|
66
66
|
auditlog/middleware.py,sha256=Q4bXg8rnm8y2fMnAsN6ha3Fz6TW8jIzLnvpu4H9SpWE,1537
|
67
67
|
auditlog/migrations/0001_initial.py,sha256=X171gKQZIaTO9FGNG1yKTjGSZS0ZjZj5gvimF9-_kks,3309
|
68
|
+
auditlog/migrations/0002_alter_persistentlog_session.py,sha256=DkkcIobbHdbniKg5bOlRmiF-Nc4hX55Y6KuQySrCcJ8,541
|
68
69
|
auditlog/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
70
|
auditlog/models.py,sha256=skDAiuzR4chC-WNIaH2nm_VVcbnDD6ZtUxBwhk7UY8U,16517
|
70
71
|
auditlog/periodic.py,sha256=AUhDeVsZtC47BJ-lklvYEegHoxAzj1RpIvRFSsM7g5E,363
|
@@ -79,6 +80,7 @@ inbox/migrations/0001_initial.py,sha256=P1OmbSHZGhj3wVBdFKWEzNrPdbyKzR9fFBXP8rhX
|
|
79
80
|
inbox/migrations/0002_alter_message_cc.py,sha256=dsnDHCs1-dFZfSEWJmufBOs5gvNbI7u99kru6fVas0Y,380
|
80
81
|
inbox/migrations/0003_attachment_content_type.py,sha256=dh_km90V6R3O0-N2oNTWhWLZZ96MylRgDY7Poua9CZ8,416
|
81
82
|
inbox/migrations/0004_mailtemplate.py,sha256=yV51UdsRWmKC5Dy34-h2bXBeYeFtjoWQ7kOw7cuYCQo,1140
|
83
|
+
inbox/migrations/0005_alter_mailbox_state.py,sha256=trr-CCLupHQ7e-tjJK08LACdxhCApGMNBTOeWFcyXnI,393
|
82
84
|
inbox/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
83
85
|
inbox/models/__init__.py,sha256=yARvP31nhJGLjqP-U_ONi2OLjiTUFspdH0AlKynt4Y8,174
|
84
86
|
inbox/models/bounce.py,sha256=3b_pCKH3gwb3NE8I1XlVI6JeoVmobZyKidsILH-jIRg,2881
|
@@ -106,18 +108,18 @@ incident/migrations/0011_ticket.py,sha256=Ml5E_Qi4Z0MD89fetoOFOL3rPlVQdjaaDCcFBf
|
|
106
108
|
incident/migrations/0012_rule_match_by.py,sha256=PGclGnnc_8JEsJZ8znoXm-iAC6Y0i2WM6C2cmFgdKlA,372
|
107
109
|
incident/migrations/0013_rulecheck_is_required.py,sha256=cL7tOj5XGPpKd2f5BojIKfNJeDB1IL-jGRU6-g-Co5o,387
|
108
110
|
incident/migrations/0014_event_group_alter_rulecheck_index.py,sha256=v3gm5k0LVoas27qUDOt7el7YtK4yjFVLeEpuFUCoXaQ,724
|
111
|
+
incident/migrations/0015_rule_title_template_alter_incident_state.py,sha256=FPUDhFwqBC39EjeknRT7BPddEf6ExCjsXVb9LMqIn3U,687
|
109
112
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
110
113
|
incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
|
111
|
-
incident/models/event.py,sha256=
|
114
|
+
incident/models/event.py,sha256=Dw6fUi2tbLeA_ZRDcvGQNFkCkMGMBdtNeaLikXdAyE8,7769
|
112
115
|
incident/models/incident.py,sha256=HPbi6J9qm7_-FMjnDUPV9NcbmP_60WU-IO9HJSpoLTY,19360
|
113
116
|
incident/models/ossec.py,sha256=eUDRGawzuLWobKEVGKfdZisDnyjS_Hlxi0T_GCSLCCI,2252
|
114
|
-
incident/models/rules.py,sha256=
|
117
|
+
incident/models/rules.py,sha256=tiPx2ytyRwPbRmbt3aYKTK-I-4osWTu55QINaA96t5g,6963
|
115
118
|
incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
|
116
119
|
incident/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
117
|
-
incident/parsers/ossec.py,sha256=
|
120
|
+
incident/parsers/ossec.py,sha256=ZUGycC6jn07ltQR6_wjr80BeVa2m12rpfTUgGktNsww,11093
|
118
121
|
incident/periodic.py,sha256=eX1rQK6v65A9ugofTvJPSmAWei6C-3EYgzCMuGZ03jM,381
|
119
122
|
incident/rpc.py,sha256=viJt873b8T8SiAq10EM57lF8g7ghyj3ymdkaXzh2Ass,8181
|
120
|
-
incident/server.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
121
123
|
incident/templates/email/incident_change.html,sha256=tQYphypwLukkVdwH0TB2Szz2VEJ7GnsfRS3_ZJ-MYeE,13895
|
122
124
|
incident/templates/email/incident_msg.html,sha256=MZdKhTddUF2MpiH8Z3RTQEmW_ko1n3ajeZ11KLtiLlU,13780
|
123
125
|
incident/templates/email/incident_new.html,sha256=W6nwFQROnyDfMlXub8s02ws4hGnJp16pfgp9xTm_aEc,15185
|
@@ -473,6 +475,7 @@ telephony/phone_util.py,sha256=5NwSBnwBEC3EaeSeN42ggBiAQ00Ujvr6CepDjXLsCyw,5067
|
|
473
475
|
telephony/rpc.py,sha256=PXPDFvgoXkCKlfMzIbt6lYZPay3fcveNj2X4Pjby7p4,3473
|
474
476
|
wiki/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
475
477
|
wiki/migrations/0001_initial.py,sha256=9jvUyjrbJrbDilRnwzQUPhPV8Xi_olEPBk_N0nycvM0,3606
|
478
|
+
wiki/migrations/0002_alter_pagemedia_entry.py,sha256=9CUnfvBmj0D4akCkux7HFuXgw9B9avE8V-iMCm5cjds,485
|
476
479
|
wiki/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
477
480
|
wiki/models/__init__.py,sha256=jE-9r_Hqpyo7ysKu9BschXOn5Zg34wUt894GwJpxA28,132
|
478
481
|
wiki/models/faq.py,sha256=nvcEFerllQKT61kIYlasvZzRKwpXyfmQpiqkpHP1V1o,1745
|
@@ -503,7 +506,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
503
506
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
504
507
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
505
508
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
506
|
-
django_restit-4.2.
|
507
|
-
django_restit-4.2.
|
508
|
-
django_restit-4.2.
|
509
|
-
django_restit-4.2.
|
509
|
+
django_restit-4.2.81.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
510
|
+
django_restit-4.2.81.dist-info/METADATA,sha256=woePfZaxmJu12i3nYR9Lk_dsQFASwS7iF_ytN_tuhKk,7645
|
511
|
+
django_restit-4.2.81.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
512
|
+
django_restit-4.2.81.dist-info/RECORD,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-13 02:34
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('inbox', '0004_mailtemplate'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AlterField(
|
14
|
+
model_name='mailbox',
|
15
|
+
name='state',
|
16
|
+
field=models.IntegerField(db_index=True, default=1),
|
17
|
+
),
|
18
|
+
]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-13 02:34
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('incident', '0014_event_group_alter_rulecheck_index'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AddField(
|
14
|
+
model_name='rule',
|
15
|
+
name='title_template',
|
16
|
+
field=models.CharField(default=None, max_length=200, null=True),
|
17
|
+
),
|
18
|
+
migrations.AlterField(
|
19
|
+
model_name='incident',
|
20
|
+
name='state',
|
21
|
+
field=models.IntegerField(choices=[(0, 'new'), (1, 'opened'), (2, 'paused'), (3, 'ignored'), (4, 'resolved'), (5, 'pending')], default=0),
|
22
|
+
),
|
23
|
+
]
|
incident/models/event.py
CHANGED
@@ -155,7 +155,7 @@ class Event(JSONMetaData, rm.RestModel):
|
|
155
155
|
incident = None
|
156
156
|
action_count = 0
|
157
157
|
if hit_rule is not None:
|
158
|
-
logger.error(f"RULE HIT: {hit_rule.name}")
|
158
|
+
# logger.error(f"RULE HIT: {hit_rule.name}")
|
159
159
|
priority = hit_rule.priority
|
160
160
|
if hit_rule.action == "ignore":
|
161
161
|
self.save()
|
@@ -184,7 +184,13 @@ class Event(JSONMetaData, rm.RestModel):
|
|
184
184
|
if hit_rule is not None and hit_rule.action_after != 0:
|
185
185
|
incident.state = INCIDENT_STATE_PENDING
|
186
186
|
# TODO possibly make this smarter?
|
187
|
-
if
|
187
|
+
if hit_rule and hit_rule.title_template and "{" in hit_rule.title_template:
|
188
|
+
try:
|
189
|
+
incident.description = hit_rule.title_template.format(event=self)
|
190
|
+
except Exception:
|
191
|
+
logger.exception(hit_rule.title_template)
|
192
|
+
incident.description = self.description
|
193
|
+
elif self.category == "ossec":
|
188
194
|
incident.description = f"{self.hostname}: {self.description}"
|
189
195
|
else:
|
190
196
|
incident.description = self.description
|
incident/models/rules.py
CHANGED
@@ -63,6 +63,7 @@ class Rule(models.Model, rm.RestModel):
|
|
63
63
|
modified = models.DateTimeField(auto_now=True)
|
64
64
|
|
65
65
|
name = models.CharField(max_length=200)
|
66
|
+
title_template = models.CharField(max_length=200, default=None, null=True)
|
66
67
|
# the group the rule gets assigned to when triggered
|
67
68
|
group = models.ForeignKey("account.Group", on_delete=models.CASCADE, null=True, default=None)
|
68
69
|
# category allows us to limit running rules to only those with a category
|
incident/parsers/ossec.py
CHANGED
@@ -131,8 +131,12 @@ def parse_alert_metadata(alert):
|
|
131
131
|
if match:
|
132
132
|
return dict(filename=match.group(1), action="added")
|
133
133
|
elif alert.rule_id == "5402":
|
134
|
-
match = re.search(r'(?P<username
|
135
|
-
|
134
|
+
match = re.search(r'(?P<username>[\w-]+) : PWD=(?P<pwd>\S+) ; USER=(?P<user>\w+) ; COMMAND=(?P<command>.+)', alert.text)
|
135
|
+
if match:
|
136
|
+
return match.groupdict()
|
137
|
+
match = re.search(r'(?P<username>[\w-]+) : TTY=(?P<tty>\S+) ; PWD=(?P<pwd>\S+) ; USER=(?P<user>\w+) ; COMMAND=(?P<command>.+)', alert.text)
|
138
|
+
if match:
|
139
|
+
return match.groupdict()
|
136
140
|
elif alert.rule_id in ["5501", "5502"]:
|
137
141
|
match = re.search(r"session (?P<action>\S+) for user (?P<username>\S+)*", alert.text)
|
138
142
|
if match:
|
@@ -239,7 +243,8 @@ def update_by_rule(data, geoip=None):
|
|
239
243
|
elif data.rule_id == "533":
|
240
244
|
data.title = f"Network Open Port Change Detected on {data.hostname}"
|
241
245
|
elif data.rule_id == "5402":
|
242
|
-
|
246
|
+
cmd = truncate_str(data.command, 50)
|
247
|
+
data.title = f"Sudo(user: {data.user}) executed '{cmd}' on {data.hostname}"
|
243
248
|
elif data.rule_id in ["551", "554"] and data.filename:
|
244
249
|
name = truncate_str(data.filename, 50)
|
245
250
|
data.title = f"File {data.action.capitalize()} on {data.hostname}: {name}"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-05-13 02:34
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
import django.db.models.deletion
|
5
|
+
|
6
|
+
|
7
|
+
class Migration(migrations.Migration):
|
8
|
+
|
9
|
+
dependencies = [
|
10
|
+
('wiki', '0001_initial'),
|
11
|
+
]
|
12
|
+
|
13
|
+
operations = [
|
14
|
+
migrations.AlterField(
|
15
|
+
model_name='pagemedia',
|
16
|
+
name='entry',
|
17
|
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='media_library', to='wiki.page'),
|
18
|
+
),
|
19
|
+
]
|
incident/server.py
DELETED
File without changes
|
File without changes
|
File without changes
|