django-restit 4.2.119__py3-none-any.whl → 4.2.121__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.
- {django_restit-4.2.119.dist-info → django_restit-4.2.121.dist-info}/METADATA +1 -1
- {django_restit-4.2.119.dist-info → django_restit-4.2.121.dist-info}/RECORD +7 -7
- inbox/models/message.py +26 -0
- incident/models/incident.py +35 -11
- rest/__init__.py +1 -1
- {django_restit-4.2.119.dist-info → django_restit-4.2.121.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.119.dist-info → django_restit-4.2.121.dist-info}/WHEEL +0 -0
@@ -87,7 +87,7 @@ inbox/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
87
87
|
inbox/models/__init__.py,sha256=yARvP31nhJGLjqP-U_ONi2OLjiTUFspdH0AlKynt4Y8,174
|
88
88
|
inbox/models/bounce.py,sha256=3b_pCKH3gwb3NE8I1XlVI6JeoVmobZyKidsILH-jIRg,2881
|
89
89
|
inbox/models/complaint.py,sha256=AcESgSzb26wLLmcW2VCsQ-MApZCkp_TfFJnaghiPf2s,2517
|
90
|
-
inbox/models/message.py,sha256=
|
90
|
+
inbox/models/message.py,sha256=acPm2z0QsucoFFmfzPekehElZm8EMzkcGChX_BpzGLU,3758
|
91
91
|
inbox/models/template.py,sha256=i5vf0vsM1U0251UmVsF61MDCV_c7xt-zdCdx1SiKOG0,1013
|
92
92
|
inbox/rpc.py,sha256=7JXvpXlEGKG7by_NkANPGYLCzagyCnTIGM4rme_htpk,1534
|
93
93
|
inbox/utils/__init__.py,sha256=P_UR2rGK3L0tZNlTN-mf99tpeYM-tLkA18iDKXSSLDM,89
|
@@ -114,7 +114,7 @@ incident/migrations/0015_rule_title_template_alter_incident_state.py,sha256=FPUD
|
|
114
114
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
115
115
|
incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
|
116
116
|
incident/models/event.py,sha256=LNKYdqOj_CO4aGvc2dNmy3K-S52Udi_gZ4-wintbs1s,7901
|
117
|
-
incident/models/incident.py,sha256=
|
117
|
+
incident/models/incident.py,sha256=dhzGlkHZn4ZwBjsW_tDwAJAVMA92d_VkrKIboyNbplw,20596
|
118
118
|
incident/models/ossec.py,sha256=eUDRGawzuLWobKEVGKfdZisDnyjS_Hlxi0T_GCSLCCI,2252
|
119
119
|
incident/models/rules.py,sha256=aRkJ0ZnTv87nAUC1sHVkPExfb3OJ8fgHQIhnCIpIbhQ,7001
|
120
120
|
incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
|
@@ -374,7 +374,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
374
374
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
375
375
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
376
376
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
377
|
-
rest/__init__.py,sha256=
|
377
|
+
rest/__init__.py,sha256=H5p2wiXgFk7-1upHmWGchOgaS_PJww8PEbemgH0umAU,122
|
378
378
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
379
379
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
380
380
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -509,7 +509,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
509
509
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
510
510
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
511
511
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
512
|
-
django_restit-4.2.
|
513
|
-
django_restit-4.2.
|
514
|
-
django_restit-4.2.
|
515
|
-
django_restit-4.2.
|
512
|
+
django_restit-4.2.121.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
513
|
+
django_restit-4.2.121.dist-info/METADATA,sha256=_xO1pbgTC8LQPTUBYTC_hL_Km8cjo35beIfQiji5drc,7663
|
514
|
+
django_restit-4.2.121.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
515
|
+
django_restit-4.2.121.dist-info/RECORD,,
|
inbox/models/message.py
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
from django.db import models
|
2
2
|
from rest import models as rm
|
3
|
+
import time
|
4
|
+
|
5
|
+
POSIX_BODY_BREAK = "\n\n\n"
|
6
|
+
WIN_BODY_BREAK = "\r\n\r\n\r\n"
|
3
7
|
|
4
8
|
|
5
9
|
class Mailbox(models.Model, rm.RestModel, rm.MetaDataModel):
|
@@ -51,9 +55,31 @@ class Message(models.Model, rm.RestModel):
|
|
51
55
|
body = models.TextField(null=True, default=None)
|
52
56
|
html = models.TextField(null=True, default=None)
|
53
57
|
|
58
|
+
def getIdFromSubject(self, prefix="#"):
|
59
|
+
pk = self.subject[self.subject.find(prefix)+len(prefix):]
|
60
|
+
if ' ' in pk:
|
61
|
+
pk = pk[:pk.find(' ')]
|
62
|
+
return pk
|
63
|
+
|
64
|
+
def getLatestBody(self):
|
65
|
+
body = self.body
|
66
|
+
if POSIX_BODY_BREAK in body:
|
67
|
+
body = body[:body.find(POSIX_BODY_BREAK)]
|
68
|
+
elif WIN_BODY_BREAK in body:
|
69
|
+
body = body[:body.find(WIN_BODY_BREAK)]
|
70
|
+
return body
|
71
|
+
|
54
72
|
def __str__(self):
|
55
73
|
return f"message: to:{self.to_email} from:{self.from_email} subject: {self.subject}"
|
56
74
|
|
75
|
+
@staticmethod
|
76
|
+
def GetMessage(pk, delay=2.0):
|
77
|
+
msg = Message.objects.filter(pk=pk).last()
|
78
|
+
if msg is None:
|
79
|
+
time.sleep(delay)
|
80
|
+
msg = Message.objects.filter(pk=pk).last()
|
81
|
+
return msg
|
82
|
+
|
57
83
|
|
58
84
|
class Attachment(models.Model, rm.RestModel):
|
59
85
|
class RestMeta:
|
incident/models/incident.py
CHANGED
@@ -53,7 +53,16 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
53
53
|
"rule": "basic",
|
54
54
|
"assigned_to": "basic"
|
55
55
|
},
|
56
|
-
}
|
56
|
+
},
|
57
|
+
"detailed": {
|
58
|
+
"extra": ["metadata", ("get_state_display", "state_display")],
|
59
|
+
"graphs": {
|
60
|
+
"group": "basic",
|
61
|
+
"rule": "basic",
|
62
|
+
"assigned_to": "basic",
|
63
|
+
"generic__component": "basic"
|
64
|
+
},
|
65
|
+
},
|
57
66
|
}
|
58
67
|
|
59
68
|
created = models.DateTimeField(auto_now_add=True)
|
@@ -220,15 +229,23 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
220
229
|
except Exception:
|
221
230
|
rh.log_exception("triggerAsyncNotify")
|
222
231
|
|
223
|
-
def triggerTask(self):
|
232
|
+
def triggerTask(self, action=None):
|
224
233
|
# task:APP_NAME:FNAME:CHANNEL
|
225
|
-
|
226
|
-
|
234
|
+
if action is None:
|
235
|
+
action = self.rule.action
|
236
|
+
fields = action.split(':')
|
237
|
+
if len(fields) < 3:
|
227
238
|
rh.log_error("triggerTask failed, invalid field count")
|
228
239
|
return
|
229
240
|
self.action_sent = datetime.now()
|
230
241
|
self.save()
|
231
|
-
|
242
|
+
channel = "tq_app_handler"
|
243
|
+
if len(fields) > 3:
|
244
|
+
channel = fields[3]
|
245
|
+
|
246
|
+
Task.Publish(
|
247
|
+
fields[1], fields[2], channel=channel,
|
248
|
+
data=dict(pk=self.pk))
|
232
249
|
|
233
250
|
def triggerEmail(self):
|
234
251
|
if self.lastSentAge() < 300:
|
@@ -258,19 +275,26 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
258
275
|
rh.log_exception("triggerSMS")
|
259
276
|
|
260
277
|
def triggerGroup(self):
|
261
|
-
|
262
|
-
|
278
|
+
parts = self.rule.action.split(":")
|
279
|
+
junk = parts[0]
|
280
|
+
gid = parts[1]
|
281
|
+
perm = None
|
282
|
+
if len(parts) == 2:
|
283
|
+
perm = gid
|
284
|
+
gid = None
|
285
|
+
if len(parts) > 2:
|
286
|
+
perm = parts[2]
|
287
|
+
if gid:
|
263
288
|
self.group = Group.objects.filter(pk=int(gid)).last()
|
264
289
|
self.save()
|
265
|
-
else:
|
266
|
-
action, perm = self.rule.action.split(":")
|
267
|
-
|
268
290
|
if not self.group:
|
269
291
|
self.notifyWith("notify.unknown_incidents")
|
270
292
|
return
|
293
|
+
if perm == "action" and len(parts) > 3:
|
294
|
+
if parts[3] == "task":
|
295
|
+
return self.triggerTask(":".join(parts[3:]))
|
271
296
|
self.action_sent = datetime.now()
|
272
297
|
self.save()
|
273
|
-
|
274
298
|
subject = f"New Issue @ {self.group.name} - {self.description}"
|
275
299
|
details = self.getProperty("details", self.description)
|
276
300
|
username = self.getProperty("username", None)
|
rest/__init__.py
CHANGED
File without changes
|
File without changes
|