django-restit 4.2.166__py3-none-any.whl → 4.2.172__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {django_restit-4.2.166.dist-info → django_restit-4.2.172.dist-info}/METADATA +3 -2
- {django_restit-4.2.166.dist-info → django_restit-4.2.172.dist-info}/RECORD +8 -8
- {django_restit-4.2.166.dist-info → django_restit-4.2.172.dist-info}/WHEEL +1 -1
- incident/rpc.py +11 -2
- metrics/models.py +3 -0
- rest/__init__.py +1 -1
- taskqueue/worker.py +1 -1
- {django_restit-4.2.166.dist-info → django_restit-4.2.172.dist-info}/LICENSE.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: django-restit
|
3
|
-
Version: 4.2.
|
3
|
+
Version: 4.2.172
|
4
4
|
Summary: A Rest Framework for DJANGO
|
5
5
|
License: MIT
|
6
6
|
Author: Ian Starnes
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
16
17
|
Requires-Dist: boto3 (>=1.26.160,<2.0.0)
|
17
18
|
Requires-Dist: django
|
18
19
|
Requires-Dist: django-redis-cache (>=3.0.1,<4.0.0)
|
@@ -122,7 +122,7 @@ incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,230
|
|
122
122
|
incident/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
123
123
|
incident/parsers/ossec.py,sha256=fouUsSnrdkEuqDzJ-MxmCP7ny5pCGFS3Tyf6lQSMBc4,11609
|
124
124
|
incident/periodic.py,sha256=eX1rQK6v65A9ugofTvJPSmAWei6C-3EYgzCMuGZ03jM,381
|
125
|
-
incident/rpc.py,sha256=
|
125
|
+
incident/rpc.py,sha256=7sJCrUasXMSVm6RUkna3xG15oSD_9Vbnqp8ezdPiepo,9448
|
126
126
|
incident/templates/email/incident_change.html,sha256=tQYphypwLukkVdwH0TB2Szz2VEJ7GnsfRS3_ZJ-MYeE,13895
|
127
127
|
incident/templates/email/incident_msg.html,sha256=MZdKhTddUF2MpiH8Z3RTQEmW_ko1n3ajeZ11KLtiLlU,13780
|
128
128
|
incident/templates/email/incident_new.html,sha256=W6nwFQROnyDfMlXub8s02ws4hGnJp16pfgp9xTm_aEc,15185
|
@@ -356,7 +356,7 @@ metrics/migrations/0003_metrics_expires.py,sha256=_g4oRv4NHW-4iCQx2s1SiF38LLyFf8
|
|
356
356
|
metrics/migrations/0004_eodmetrics.py,sha256=Ky6ZVMZqa0F_SUp_QFWY7ZKBgVhy9CS4wZcsEhrkSgc,3271
|
357
357
|
metrics/migrations/0005_alter_metrics_v1_alter_metrics_v10_alter_metrics_v11_and_more.py,sha256=pmwJfpPJ1RUX_CqM66l6vvV-nrAUPo_GIan0Pc9mQHs,2358
|
358
358
|
metrics/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
359
|
-
metrics/models.py,sha256
|
359
|
+
metrics/models.py,sha256=O29Cud4VAwIAWnmQymFti0-ibOEoGmTWGxWsbtzcZHQ,14162
|
360
360
|
metrics/periodic.py,sha256=IayBLLat40D8FB-A3bYBW9lxm9-IzcugQunojThQ_OU,661
|
361
361
|
metrics/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
362
362
|
metrics/providers/aws.py,sha256=dIBGFE1Fvszy6rmVrn_Fm1zUDv345q4dBsg9Iit-XCc,8358
|
@@ -379,7 +379,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
379
379
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
380
380
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
381
381
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
382
|
-
rest/__init__.py,sha256=
|
382
|
+
rest/__init__.py,sha256=8TNkWn1IUaIq_YXkkpS9iccJHxoxu2RQlJ1uqRRibr0,122
|
383
383
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
384
384
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
385
385
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -471,7 +471,7 @@ taskqueue/transports/http.py,sha256=AzliUnw_LuyO2zZZOoUAJGFcTV-Gxt1iE3hCVnIiyGQ,
|
|
471
471
|
taskqueue/transports/s3.py,sha256=fMosL893u1iQdo6Y1djwb7KEoNo6TTsDPJl13OJdJP8,1913
|
472
472
|
taskqueue/transports/sftp.py,sha256=jT1_krjTHA7DCAukD85aGYRCg9m0cEH9EWzOC-wJGdk,1891
|
473
473
|
taskqueue/transports/sms.py,sha256=H1-LIGEMfbUNqJD9amRcsvKUSwtz9yBj1QNfB7EHjHE,142
|
474
|
-
taskqueue/worker.py,sha256=
|
474
|
+
taskqueue/worker.py,sha256=641Z6C9JTps0mx99JiqnnCrhkfmeqs4AE-zuJh6B6jA,15699
|
475
475
|
telephony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
476
476
|
telephony/admin.py,sha256=iOdsBfFFbBisdqKSZ36bIrh_z5sU0Wx_PkaFi8wd1iA,243
|
477
477
|
telephony/decorators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -515,7 +515,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
515
515
|
ws4redis/settings.py,sha256=KKq00EwoGnz1yLwCZr5Dfoq2izivmAdsNEEM4EhZwN4,1610
|
516
516
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
517
517
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
518
|
-
django_restit-4.2.
|
519
|
-
django_restit-4.2.
|
520
|
-
django_restit-4.2.
|
521
|
-
django_restit-4.2.
|
518
|
+
django_restit-4.2.172.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
519
|
+
django_restit-4.2.172.dist-info/METADATA,sha256=iGWUZqAmN7YQzXkMWtkuODNttINTNwwqseRaOrJpbfE,7714
|
520
|
+
django_restit-4.2.172.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
521
|
+
django_restit-4.2.172.dist-info/RECORD,,
|
incident/rpc.py
CHANGED
@@ -7,6 +7,7 @@ from .parsers import ossec
|
|
7
7
|
from taskqueue.models import Task
|
8
8
|
from location.providers.iplookup import abuse
|
9
9
|
import incident
|
10
|
+
from objict import objict
|
10
11
|
|
11
12
|
LOG_REST_PREFIX = settings.get("REST_PREFIX", "api/")
|
12
13
|
if not LOG_REST_PREFIX.startswith("/"):
|
@@ -59,8 +60,13 @@ if settings.REPORT_PERMISSION_DENIED:
|
|
59
60
|
@rd.urlPOST(r'^ossec/alert/batch$')
|
60
61
|
def batch_ossec_alert_creat_from_request(request):
|
61
62
|
batch = request.DATA.get("batch")
|
63
|
+
if isinstance(batch, str):
|
64
|
+
batch = objict.fromJSON(batch)
|
62
65
|
if not isinstance(batch, list):
|
63
|
-
|
66
|
+
rh.debug("ossec batch data", batch)
|
67
|
+
rh.debug("ossec data", request.DATA.asDict())
|
68
|
+
data_format = str(type(batch))
|
69
|
+
return rv.restStatus(request, False, error=f"invalid format {data_format}")
|
64
70
|
for alert in batch:
|
65
71
|
on_ossec_alert(request, alert)
|
66
72
|
return rv.restStatus(request, True)
|
@@ -110,7 +116,7 @@ def on_ossec_alert(request, alert):
|
|
110
116
|
metadata["province"] = od.geoip.state
|
111
117
|
metadata["isp"] = od.geoip.isp
|
112
118
|
|
113
|
-
am.Event.createFromDict(None, {
|
119
|
+
evt = am.Event.createFromDict(None, {
|
114
120
|
"hostname": od.hostname,
|
115
121
|
"description": od.title,
|
116
122
|
"details": od.text,
|
@@ -121,6 +127,9 @@ def on_ossec_alert(request, alert):
|
|
121
127
|
"reporter_ip": od.src_ip,
|
122
128
|
"metadata": metadata
|
123
129
|
})
|
130
|
+
# fix the created datetime to be from when it was actually happening
|
131
|
+
evt.created = od.when
|
132
|
+
evt.save()
|
124
133
|
return rv.restStatus(request, True)
|
125
134
|
except Exception as err:
|
126
135
|
rh.log_exception()
|
metrics/models.py
CHANGED
@@ -40,6 +40,8 @@ def metric(
|
|
40
40
|
expires = datetime.now() + timedelta(days=METRICS_EXPIRE_DAILY)
|
41
41
|
elif granularity == "weekly":
|
42
42
|
expires = datetime.now() + timedelta(days=METRICS_EXPIRE_WEEKLY)
|
43
|
+
elif granularity in ["minutes", "seconds"]:
|
44
|
+
expires = datetime.now() + timedelta(days=7)
|
43
45
|
m, created = Metrics.objects.get_or_create(
|
44
46
|
uuid=key,
|
45
47
|
defaults=dict(
|
@@ -88,6 +90,7 @@ def normalize_date(date=None, timezone=None, group=None):
|
|
88
90
|
date = date_util.convertToLocalTime(settings.METRICS_TIMEZONE, date)
|
89
91
|
return date
|
90
92
|
|
93
|
+
|
91
94
|
def get_qset(slug, granularity, start=None, end=None,
|
92
95
|
group=-1, starts_with=False, ends_with=None):
|
93
96
|
if start is None:
|
rest/__init__.py
CHANGED
taskqueue/worker.py
CHANGED
@@ -62,7 +62,7 @@ class WorkManager(object):
|
|
62
62
|
task.failed("stale")
|
63
63
|
return
|
64
64
|
if task.id in self._scheduled_tasks:
|
65
|
-
self.logger.error("task({}) is
|
65
|
+
self.logger.error("task({}) is already scheduled".format(task.id))
|
66
66
|
return
|
67
67
|
task.manager = self
|
68
68
|
with self.lock:
|
File without changes
|