django-restit 4.2.166__py3-none-any.whl → 4.2.167__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.166
3
+ Version: 4.2.167
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -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=y1u_op8PiWI4kUVD_DsKXmygdxRDBDxudCFGp829s3E,9056
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
@@ -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=0TxtckfR2izNmII4ddcJuIksqIVi3UW_LKZ9O-p_E4E,122
382
+ rest/__init__.py,sha256=eBXKeTBaSN_87SpMKDrp3hqPYpVdDv_zx8hKsvRrrbI,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
@@ -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.166.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
519
- django_restit-4.2.166.dist-info/METADATA,sha256=UFrfXKJj92wJ-lgCMNHKLGE8dsK9hP9MKncpiq9O-jE,7663
520
- django_restit-4.2.166.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
521
- django_restit-4.2.166.dist-info/RECORD,,
518
+ django_restit-4.2.167.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
519
+ django_restit-4.2.167.dist-info/METADATA,sha256=6AEOSN6ApDMK6jAJsPqm3T4I3EJLbO894J6lhA5p_4E,7663
520
+ django_restit-4.2.167.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
521
+ django_restit-4.2.167.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
- return rv.restStatus(request, False, error="invalid format")
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()
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.2.166"
4
+ __version__ = "4.2.167"