django-restit 4.1.31__py3-none-any.whl → 4.1.33__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.1.31.dist-info → django_restit-4.1.33.dist-info}/METADATA +1 -1
- {django_restit-4.1.31.dist-info → django_restit-4.1.33.dist-info}/RECORD +11 -10
- incident/migrations/0009_incident_reporter_ip.py +18 -0
- incident/models/event.py +4 -1
- incident/models/incident.py +6 -0
- rest/__init__.py +1 -1
- taskqueue/models.py +5 -5
- taskqueue/transports/http.py +4 -2
- taskqueue/worker.py +1 -2
- {django_restit-4.1.31.dist-info → django_restit-4.1.33.dist-info}/LICENSE.md +0 -0
- {django_restit-4.1.31.dist-info → django_restit-4.1.33.dist-info}/WHEEL +0 -0
@@ -84,10 +84,11 @@ incident/migrations/0005_incident_component_alter_incident_state.py,sha256=qC8-T
|
|
84
84
|
incident/migrations/0006_delete_eventmetadata.py,sha256=buSEY_TmmXi9ShPFxB74Os2q0XP3KWejFX9RESoKDDU,324
|
85
85
|
incident/migrations/0007_event_metadata.py,sha256=syxcM4gIcBwSjcpdU69CXq5dGS1Gu8OodZtPJFDpY5U,414
|
86
86
|
incident/migrations/0008_incident_action_sent_incident_hostname_and_more.py,sha256=N2D47E9k4PxOo-9C72gqYkb6K0GqVIO4PkvdnWlrSuA,903
|
87
|
+
incident/migrations/0009_incident_reporter_ip.py,sha256=JOrTGBPJw9g7cg--HH3zqnbsMowjNSgzxJTrKojcPJA,473
|
87
88
|
incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
89
|
incident/models/__init__.py,sha256=adTSOSVrYJgHD4hZNJJjFj_M1QZbpwhZZQiIzanUKA8,167
|
89
|
-
incident/models/event.py,sha256=
|
90
|
-
incident/models/incident.py,sha256=
|
90
|
+
incident/models/event.py,sha256=TcnpP2b6EGOHC4FrGg0fEXYxR72ijpG15Da6QIYPd3Y,5664
|
91
|
+
incident/models/incident.py,sha256=_59XYgAxIrcXwjwowJkNmOWpWe5uq9DEgjeWaVsymXA,10325
|
91
92
|
incident/models/ossec.py,sha256=pWMqcuTRxPFTEF-OZQSMn7YpNEE9mfsI4GMhWWjJs5I,2187
|
92
93
|
incident/models/rules.py,sha256=67fbtEDfznxCYb-B89417lgYesN12PzmY25WBF_65a8,5300
|
93
94
|
incident/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -342,7 +343,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
342
343
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
343
344
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
344
345
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
345
|
-
rest/__init__.py,sha256=
|
346
|
+
rest/__init__.py,sha256=6U9nBasTmc58hTcdKLJO_tYr-kAllDsYaEEg4B5ezTU,121
|
346
347
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
347
348
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
348
349
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -422,17 +423,17 @@ taskqueue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
422
423
|
taskqueue/admin.py,sha256=E6zXoToS_ea3MdoGjZzF1JiepWFtDSoZUQdan8H-pXI,208
|
423
424
|
taskqueue/migrations/0001_initial.py,sha256=JwYib8CK5ftSXlfxKZUcKEEVsXktNB5q3h-2tu9inGk,4738
|
424
425
|
taskqueue/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
425
|
-
taskqueue/models.py,sha256=
|
426
|
+
taskqueue/models.py,sha256=0hqAYWfbWn-EhXL4cvzJNIIblC6gcLceyW3rhmZvnDs,19208
|
426
427
|
taskqueue/periodic.py,sha256=2i0271khrCow3hDmlNEcoAZnesBVl40jd7MIim2Cxs4,3543
|
427
428
|
taskqueue/rpc.py,sha256=CrxWKMTXi1EDvjB6iW5rAlwCpQIP_n1RW8Yfx9aKB9Y,5711
|
428
429
|
taskqueue/tq.py,sha256=PzSoDrawYcqZylruEgsK95gcJ4J_VhdM6rxg9V6_X8E,942
|
429
430
|
taskqueue/transports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
430
431
|
taskqueue/transports/email.py,sha256=H4GaomiyCck5R_AOcsrMawCl-_Bp_Zg-uWto9t1Xcoo,623
|
431
|
-
taskqueue/transports/http.py,sha256=
|
432
|
+
taskqueue/transports/http.py,sha256=WFRLOfto_ODYzRUtYqeJq2GyV63pLfAWbvnRZTzaLIY,2409
|
432
433
|
taskqueue/transports/s3.py,sha256=KI0paoIuQktk1c40Aa5LkzInVVCjXPdL7tPuTfXOtzs,1099
|
433
434
|
taskqueue/transports/sftp.py,sha256=jT1_krjTHA7DCAukD85aGYRCg9m0cEH9EWzOC-wJGdk,1891
|
434
435
|
taskqueue/transports/sms.py,sha256=H1-LIGEMfbUNqJD9amRcsvKUSwtz9yBj1QNfB7EHjHE,142
|
435
|
-
taskqueue/worker.py,sha256=
|
436
|
+
taskqueue/worker.py,sha256=bt3rFrw7Ahf1-RHAqAFCv_M6sMad6u2m2WygnFPsaxI,15960
|
436
437
|
telephony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
437
438
|
telephony/admin.py,sha256=iOdsBfFFbBisdqKSZ36bIrh_z5sU0Wx_PkaFi8wd1iA,243
|
438
439
|
telephony/decorators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -473,7 +474,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
473
474
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
474
475
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
475
476
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
476
|
-
django_restit-4.1.
|
477
|
-
django_restit-4.1.
|
478
|
-
django_restit-4.1.
|
479
|
-
django_restit-4.1.
|
477
|
+
django_restit-4.1.33.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
478
|
+
django_restit-4.1.33.dist-info/METADATA,sha256=bs9FHm49r70GuX4baI73i2RntoO0Sld5480ehAD4m2E,7573
|
479
|
+
django_restit-4.1.33.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
480
|
+
django_restit-4.1.33.dist-info/RECORD,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by Django 4.1.4 on 2023-08-22 19:29
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('incident', '0008_incident_action_sent_incident_hostname_and_more'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AddField(
|
14
|
+
model_name='incident',
|
15
|
+
name='reporter_ip',
|
16
|
+
field=models.CharField(blank=True, db_index=True, default=None, max_length=16, null=True),
|
17
|
+
),
|
18
|
+
]
|
incident/models/event.py
CHANGED
@@ -135,7 +135,10 @@ class Event(JSONMetaData, rm.RestModel):
|
|
135
135
|
|
136
136
|
# always create an incident
|
137
137
|
if incident is None:
|
138
|
-
incident = Incident(
|
138
|
+
incident = Incident(
|
139
|
+
rule=hit_rule, priority=priority,
|
140
|
+
reporter_ip=self.reporter_ip,
|
141
|
+
component=self.category, hostname=self.hostname)
|
139
142
|
if hit_rule is not None:
|
140
143
|
incident.group = hit_rule.group
|
141
144
|
# TODO possibly make this smarter?
|
incident/models/incident.py
CHANGED
@@ -50,6 +50,7 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
50
50
|
description = models.CharField(max_length=200)
|
51
51
|
component = models.CharField(max_length=200, null=True, default=None, db_index=True)
|
52
52
|
hostname = models.CharField(max_length=200, null=True, default=None, db_index=True)
|
53
|
+
reporter_ip = models.CharField(max_length=16, blank=True, null=True, default=None, db_index=True)
|
53
54
|
|
54
55
|
group = models.ForeignKey("account.Group", on_delete=models.SET_NULL, null=True, default=None)
|
55
56
|
assigned_to = models.ForeignKey("account.Member", on_delete=models.SET_NULL, null=True, default=None)
|
@@ -210,6 +211,11 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
210
211
|
elif rule.bundle_by == 3:
|
211
212
|
q.hostname = event.hostname
|
212
213
|
q.component = event.category
|
214
|
+
elif rule.bundle_by == 4:
|
215
|
+
q.reporter_ip = event.reporter_ip
|
216
|
+
elif rule.bundle_by == 5:
|
217
|
+
q.reporter_ip = event.reporter_ip
|
218
|
+
q.component = event.category
|
213
219
|
return Incident.objects.filter(**q).last()
|
214
220
|
|
215
221
|
@classmethod
|
rest/__init__.py
CHANGED
taskqueue/models.py
CHANGED
@@ -256,7 +256,7 @@ class Task(models.Model, RestModel):
|
|
256
256
|
tdata = nobjict()
|
257
257
|
tdata.url = url
|
258
258
|
tdata.data = data
|
259
|
-
task = cls(channel="tq_hook",model="tq_web_request", fname=fname, data=tdata)
|
259
|
+
task = cls(channel="tq_hook", model="tq_web_request", fname=fname, data=tdata)
|
260
260
|
if stale_after_seconds:
|
261
261
|
task.stale_after = datetime.now() + timedelta(seconds=stale_after_seconds)
|
262
262
|
task.save()
|
@@ -270,7 +270,7 @@ class Task(models.Model, RestModel):
|
|
270
270
|
tdata.filename = filename
|
271
271
|
tdata.subject = subject
|
272
272
|
tdata.data = data
|
273
|
-
task = cls(channel="tq_hook",model="tq_email_request", data=tdata)
|
273
|
+
task = cls(channel="tq_hook", model="tq_email_request", data=tdata)
|
274
274
|
task.save()
|
275
275
|
task.publish()
|
276
276
|
return task
|
@@ -280,7 +280,7 @@ class Task(models.Model, RestModel):
|
|
280
280
|
tdata = nobjict()
|
281
281
|
tdata.phone = phone
|
282
282
|
tdata.data = data
|
283
|
-
task = cls(channel="tq_hook",model="tq_sms_request", data=tdata)
|
283
|
+
task = cls(channel="tq_hook", model="tq_sms_request", data=tdata)
|
284
284
|
task.save()
|
285
285
|
task.publish()
|
286
286
|
return task
|
@@ -295,7 +295,7 @@ class Task(models.Model, RestModel):
|
|
295
295
|
tdata.username = username
|
296
296
|
tdata.password = password
|
297
297
|
tdata.data = data
|
298
|
-
task = cls(channel="tq_hook",model="tq_sftp_request", data=tdata)
|
298
|
+
task = cls(channel="tq_hook", model="tq_sftp_request", data=tdata)
|
299
299
|
task.save()
|
300
300
|
task.publish()
|
301
301
|
return task
|
@@ -310,7 +310,7 @@ class Task(models.Model, RestModel):
|
|
310
310
|
tdata.aws = aws
|
311
311
|
tdata.secret = secret
|
312
312
|
tdata.when = str(when)
|
313
|
-
task = cls(channel="tq_hook",model="tq_s3_request", data=tdata)
|
313
|
+
task = cls(channel="tq_hook", model="tq_s3_request", data=tdata)
|
314
314
|
task.save()
|
315
315
|
task.publish()
|
316
316
|
return task
|
taskqueue/transports/http.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import requests
|
2
2
|
import time
|
3
3
|
REQ_TIMEOUT = 15.0
|
4
|
-
from
|
4
|
+
from objict import objict
|
5
|
+
|
5
6
|
|
6
7
|
def POST(task, attempts=3, timeout=REQ_TIMEOUT, headers=None):
|
7
8
|
while attempts:
|
@@ -43,13 +44,14 @@ def httpGET(url, params=None, session=None, timeout=REQ_TIMEOUT):
|
|
43
44
|
res = requests.get(url, headers=headers, params=params, timeout=timeout)
|
44
45
|
return res
|
45
46
|
|
47
|
+
|
46
48
|
def httpPOST(url, data, post_json=False, session=None, timeout=REQ_TIMEOUT, headers=None):
|
47
49
|
if not headers or type(headers) is not dict:
|
48
50
|
headers = {'Accept': 'application/json'}
|
49
51
|
if 'Accept' not in headers:
|
50
52
|
headers['Accept'] = 'application/json'
|
51
53
|
if post_json:
|
52
|
-
data =
|
54
|
+
data = objict.fromdict(data).toJSON()
|
53
55
|
headers['Content-type'] = 'application/json'
|
54
56
|
if post_json:
|
55
57
|
if session:
|
taskqueue/worker.py
CHANGED
@@ -194,7 +194,7 @@ class WorkManager(object):
|
|
194
194
|
self.logger.warning("ignore job {}:{}".format(task.id, task.channel))
|
195
195
|
|
196
196
|
def _on_webrequest(self, task):
|
197
|
-
self.logger.debug("starting
|
197
|
+
# self.logger.debug("starting web request to: {}".format(task.data.url))
|
198
198
|
# we need to copy the data and remove the url
|
199
199
|
if task.fname.upper() == "GET":
|
200
200
|
resp = http.GET(task)
|
@@ -207,7 +207,6 @@ class WorkManager(object):
|
|
207
207
|
task.retry_later(from_now_secs=(task.attempts-1) * 120)
|
208
208
|
|
209
209
|
def _on_hookrequest(self, task):
|
210
|
-
self.logger.debug("starting webrequest to: {}".format(task.data.url))
|
211
210
|
# we need to copy the data and remove the url
|
212
211
|
if task.model == "tq_email_request":
|
213
212
|
resp = email.SEND(task)
|
File without changes
|
File without changes
|