django-restit 4.2.81__py3-none-any.whl → 4.2.82__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.
account/models/member.py CHANGED
@@ -224,11 +224,11 @@ class Member(User, RestModel, MetaDataModel):
224
224
 
225
225
  @property
226
226
  def force_single_session(self):
227
- return self.hasPermission("force_single_session")
227
+ return self.hasPermission("force_single_session", ignore_su=True)
228
228
 
229
229
  @property
230
230
  def email_disabled(self):
231
- return self.hasPermission("email_disabled")
231
+ return self.hasPermission("email_disabled", ignore_su=True)
232
232
 
233
233
  @property
234
234
  def has_totp(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.81
3
+ Version: 4.2.82
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -28,7 +28,7 @@ account/models/device.py,sha256=TloXvvrx3khF3BeGFuVYn6DhXjOW0AMZb4F9Fl5nBII,5491
28
28
  account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
29
29
  account/models/group.py,sha256=iDD_oSgswKV_t_gXZuVK80MvICrZZqdANm2jtGtOFy8,21985
30
30
  account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
31
- account/models/member.py,sha256=v2cM7g5XoOQi_ZAlGcOcKn24zZCfAFokxUFIqNshDxc,52960
31
+ account/models/member.py,sha256=fzSVVAdbUa1knp1O4JTnYZFYRas7-zDZaOPjZAMCC1Q,52992
32
32
  account/models/membership.py,sha256=90EpAhOsGaqphDAkONP6j_qQ0OWSRaQsI8H7E7fgMkE,9249
33
33
  account/models/notify.py,sha256=Qzi8gLsVi8nDx8gpL4dyr0MPExYYGIDxZvHFUdCs7H4,15072
34
34
  account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
@@ -114,10 +114,10 @@ incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,2
114
114
  incident/models/event.py,sha256=Dw6fUi2tbLeA_ZRDcvGQNFkCkMGMBdtNeaLikXdAyE8,7769
115
115
  incident/models/incident.py,sha256=HPbi6J9qm7_-FMjnDUPV9NcbmP_60WU-IO9HJSpoLTY,19360
116
116
  incident/models/ossec.py,sha256=eUDRGawzuLWobKEVGKfdZisDnyjS_Hlxi0T_GCSLCCI,2252
117
- incident/models/rules.py,sha256=tiPx2ytyRwPbRmbt3aYKTK-I-4osWTu55QINaA96t5g,6963
117
+ incident/models/rules.py,sha256=aRkJ0ZnTv87nAUC1sHVkPExfb3OJ8fgHQIhnCIpIbhQ,7001
118
118
  incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
119
119
  incident/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
- incident/parsers/ossec.py,sha256=ZUGycC6jn07ltQR6_wjr80BeVa2m12rpfTUgGktNsww,11093
120
+ incident/parsers/ossec.py,sha256=jyJmNBwnQS1tjZMwYhslnCpZviCHXnozv88BPT-ytCw,11592
121
121
  incident/periodic.py,sha256=eX1rQK6v65A9ugofTvJPSmAWei6C-3EYgzCMuGZ03jM,381
122
122
  incident/rpc.py,sha256=viJt873b8T8SiAq10EM57lF8g7ghyj3ymdkaXzh2Ass,8181
123
123
  incident/templates/email/incident_change.html,sha256=tQYphypwLukkVdwH0TB2Szz2VEJ7GnsfRS3_ZJ-MYeE,13895
@@ -135,12 +135,12 @@ location/migrations/0004_remove_address_modified_by_address_group_and_more.py,sh
135
135
  location/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
136
  location/models/__init__.py,sha256=rZhldkoKmoJQXjBAK1IIQn7K_OOJvFtIGOGVl_szqbE,230
137
137
  location/models/address.py,sha256=wl0bToZ6VrJP923IIfzWqZY9xyKgla6A-uzj8jQFGRI,3149
138
- location/models/ip.py,sha256=ZaBFdW1tL1Q3bnS5gIY9SseiQ5xeeP_oyP1hp3czFeA,5984
138
+ location/models/ip.py,sha256=Bl-OlwEXGvKYvYSDBSsnQkeAi4ZTKs1mDt3ddc5rq80,6039
139
139
  location/models/legacy.py,sha256=8ROsUSZrjGQkUyXeJvoxPdKAWaKfUH-AL9TIeJb7krg,1994
140
140
  location/models/location.py,sha256=01dJPJecbp5orExsIGWOsBC_KkwFRIW0rGDIwyx1r0w,2316
141
141
  location/models/track.py,sha256=OdhRL1KVXlPcZkp4S6QpKc7Ctoth8VjwHs_dlZ8XHI4,1474
142
142
  location/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
- location/providers/iplookup/__init__.py,sha256=t7yiXnEopAN_NZ77k2oHAhfVCmWNDkiCKA8S41jbJv0,727
143
+ location/providers/iplookup/__init__.py,sha256=I0K0HZrluCsBZ1TlGGKnyavEDZ3mT-xfE7Dtq2k-F9k,790
144
144
  location/providers/iplookup/abstractapi.py,sha256=gY8eqpjEasZtiBC6nNu960ZGL96FVwNS2JoZuP1GBO4,2419
145
145
  location/providers/iplookup/extremeip.py,sha256=QNRGhwXXsOuJL2M-xiI2pFN_6LP2HkqSUpFosu5Q04M,1345
146
146
  location/providers/iplookup/geoplugin.py,sha256=RK_6McxHYlVVMVdJ2rCafw-kqMfzMm3g_tJjBwcKXYg,2121
@@ -506,7 +506,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
506
506
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
507
507
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
508
508
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
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,,
509
+ django_restit-4.2.82.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
510
+ django_restit-4.2.82.dist-info/METADATA,sha256=3y5JxK8Y5LnGio73TTZEcoDQ6lJbCk89XrLxgELdK8Y,7645
511
+ django_restit-4.2.82.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
512
+ django_restit-4.2.82.dist-info/RECORD,,
incident/models/rules.py CHANGED
@@ -43,6 +43,7 @@ class Rule(models.Model, rm.RestModel):
43
43
  "created",
44
44
  "priority",
45
45
  "name",
46
+ "title_template",
46
47
  "category",
47
48
  "priority",
48
49
  "action",
incident/parsers/ossec.py CHANGED
@@ -33,12 +33,21 @@ def parse_nginx_line(line):
33
33
  return None
34
34
 
35
35
 
36
- def removeNonAscii(input_str):
37
- """Remove all non-ASCII characters and escaped byte sequences from the input string."""
38
- # Remove escaped byte sequences
39
- cleaned_str = re.sub(r'\\x[0-9a-fA-F]{2}', '', input_str)
40
- # Remove non-ASCII characters
41
- return ''.join(char for char in cleaned_str if 32 <= ord(char) < 128)
36
+ def removeNonAscii(input_str, replacement=''):
37
+ """
38
+ Replace all non-ASCII characters and escaped byte sequences in the input string with a specified string.
39
+
40
+ Args:
41
+ input_str (str): The string to process.
42
+ replacement (str): The string to use as a replacement for non-ASCII characters and escaped byte sequences.
43
+
44
+ Returns:
45
+ str: The processed string with non-ASCII characters and byte sequences replaced.
46
+ """
47
+ # Replace escaped byte sequences with the replacement string
48
+ cleaned_str = re.sub(r'\\x[0-9a-fA-F]{2}', replacement, input_str)
49
+ # Replace non-ASCII characters with the replacement string
50
+ return ''.join(char if (32 <= ord(char) < 128 or char in '\n\r\t') else f"<r{str(ord(char))}>" for char in cleaned_str)
42
51
 
43
52
 
44
53
  def extractURL(text):
@@ -168,6 +177,8 @@ def parse_alert_json(data):
168
177
  data = objict.fromJSON(removeNonAscii(data))
169
178
  for key in data:
170
179
  data[key] = data[key].strip()
180
+ if data.text:
181
+ data.text = removeNonAscii(data.text)
171
182
  return data
172
183
 
173
184
 
location/models/ip.py CHANGED
@@ -93,6 +93,8 @@ class GeoIP(models.Model, rm.RestModel):
93
93
  ip = ip.strip()
94
94
  if not geolocate.isIP(ip):
95
95
  ip = geolocate.dnsToIP(ip)
96
+ if ip is None:
97
+ return None
96
98
  subnet = ip[:ip.rfind(".")]
97
99
  gip = GeoIP.objects.filter(ip=ip).first()
98
100
  if gip is None:
@@ -32,4 +32,8 @@ def isIP(ip):
32
32
 
33
33
 
34
34
  def dnsToIP(name):
35
- return socket.gethostbyname(name)
35
+ try:
36
+ return socket.gethostbyname(name)
37
+ except Exception:
38
+ pass
39
+ return None