assemblyline-v4-service 4.4.1.dev110__py3-none-any.whl → 4.4.1.dev112__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.

Potentially problematic release.


This version of assemblyline-v4-service might be problematic. Click here for more details.

@@ -1 +1 @@
1
- 4.4.1.dev110
1
+ 4.4.1.dev112
@@ -77,6 +77,7 @@ class ServiceBase:
77
77
  self.rules_directory: str = None
78
78
  self.rules_list: list = []
79
79
  self.update_time: int = None
80
+ self.update_hash: str = None
80
81
  self.update_check_time: float = 0.0
81
82
  self.rules_hash: str = None
82
83
 
@@ -257,7 +258,7 @@ class ServiceBase:
257
258
  resp = requests.get(url_base + 'status', verify=verify)
258
259
  resp.raise_for_status()
259
260
  status = resp.json()
260
- if self.update_time is not None and self.update_time >= status['local_update_time']:
261
+ if self.update_time is not None and self.update_time >= status['local_update_time'] and self.update_hash == status['local_update_hash']:
261
262
  self.log.info(f"There are no new signatures. ({self.update_time} >= {status['local_update_time']})")
262
263
  return
263
264
  if status['download_available']:
@@ -286,6 +287,7 @@ class ServiceBase:
286
287
  tar_handle = tarfile.open(buffer_name)
287
288
  tar_handle.extractall(temp_directory)
288
289
  self.update_time = status['local_update_time']
290
+ self.update_hash = status['local_update_hash']
289
291
  self.rules_directory, temp_directory = temp_directory, self.rules_directory
290
292
  # Try to load the rules into the service before declaring we're using these rules moving forward
291
293
  temp_hash = self._gen_rules_hash()
@@ -27,6 +27,7 @@ if os.path.exists(AL_ROOT_CA):
27
27
  status_last_read_time = 0
28
28
  NO_STATUS = {
29
29
  'local_update_time': 0,
30
+ 'local_update_hash': None,
30
31
  'download_available': False,
31
32
  '_directory': None,
32
33
  '_tar': None,
@@ -13,6 +13,7 @@ import tarfile
13
13
  import threading
14
14
  import subprocess
15
15
  from contextlib import contextmanager
16
+ from hashlib import sha256
16
17
  from passlib.hash import bcrypt
17
18
  from zipfile import ZipFile, BadZipFile
18
19
 
@@ -179,9 +180,13 @@ class ServiceUpdater(ThreadedCoreBase):
179
180
  return os.path.getctime(self._time_keeper)
180
181
  return 0
181
182
 
183
+ def get_local_update_hash(self) -> str:
184
+ return sha256(open(self._update_tar, "rb").read()).hexdigest()
185
+
182
186
  def status(self):
183
187
  return {
184
188
  'local_update_time': self.get_local_update_time(),
189
+ 'local_update_hash': self.get_local_update_hash(),
185
190
  'download_available': self._update_dir is not None,
186
191
  '_directory': self._update_dir,
187
192
  '_tar': self._update_tar,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: assemblyline-v4-service
3
- Version: 4.4.1.dev110
3
+ Version: 4.4.1.dev112
4
4
  Summary: Assemblyline 4 - Service base
5
5
  Home-page: https://github.com/CybercentreCanada/assemblyline-v4-service/
6
6
  Author: CCCS Assemblyline development team
@@ -1,11 +1,11 @@
1
- assemblyline_v4_service/VERSION,sha256=bLX5zY3FJUYEgITHchmPeRBbfWoC-OQ-hVlCjIF1J-8,13
1
+ assemblyline_v4_service/VERSION,sha256=_cQ3j-rgfTwPOKVf3K3pzwhUhpykYwpAk02o-lfSp3w,13
2
2
  assemblyline_v4_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  assemblyline_v4_service/healthz.py,sha256=sS1cFkDLw8hUPMpj7tbHXFv8ZmHcazrwZ0l6oQDwwkQ,1575
4
4
  assemblyline_v4_service/run_privileged_service.py,sha256=9uTfHetXR5G-EDKMDrgfWUOw34yr64-cj6Cm9eZaCbQ,14547
5
5
  assemblyline_v4_service/run_service.py,sha256=RCqxdm-OAwJhl15BnKFkuavpQ5k6eTX3ZGeSna5JJBw,5557
6
6
  assemblyline_v4_service/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  assemblyline_v4_service/common/api.py,sha256=QWh6qZcbtNRtSHQaWA5Q7oVFS0Kg7PIe6R9MKcoPr6M,4454
8
- assemblyline_v4_service/common/base.py,sha256=YIjKnp8ErMLt6l9j5cW-6S6HSa1_rckNdoiVKxON34w,13038
8
+ assemblyline_v4_service/common/base.py,sha256=Q2VdhuklXEWJgcAPl7CWGYcbtufatrVXqupti8WAtP4,13186
9
9
  assemblyline_v4_service/common/decode_wrapper.py,sha256=eZSM2zBSzbGotuM04tKtV-R7oY5xuUTZ-rTfL6ktmns,3617
10
10
  assemblyline_v4_service/common/helper.py,sha256=xs9quuf-M1JOdKieBqOmWaOece0CtzXFhhe85xQYmuY,3289
11
11
  assemblyline_v4_service/common/ocr.py,sha256=gFPVAGVsmVk4SKL7hCMCT7NEyG-lFLniEFQup6WtCsc,4384
@@ -18,12 +18,12 @@ assemblyline_v4_service/dev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
18
18
  assemblyline_v4_service/dev/run_service_once.py,sha256=D-QpwRox1dy9H6EPoR6nY1o3XiD3JRjC7xrEkPn952I,10593
19
19
  assemblyline_v4_service/updater/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  assemblyline_v4_service/updater/__main__.py,sha256=9Os-u8Tf7MD73JSrUSPmOaErTgfvesNLiEeszU4ujXA,133
21
- assemblyline_v4_service/updater/app.py,sha256=Ass5DZtOCr0tdoRbLo7Qn8Ujlw8T8mUDroAaHxx2oMo,3198
21
+ assemblyline_v4_service/updater/app.py,sha256=OF-G7J8IYwTjdGw_BI9numBicZBN5lspm8Eqb3qbIl8,3229
22
22
  assemblyline_v4_service/updater/gunicorn_config.py,sha256=p3j2KPBeD5jvMw9O5i7vAtlRgPSVVxIG9AO0DfN82J8,1247
23
23
  assemblyline_v4_service/updater/helper.py,sha256=JD0gX3KHY-wvsFjTbWkT83F0d5Up3OfubMPinuNzbTQ,9069
24
- assemblyline_v4_service/updater/updater.py,sha256=AQ3aTm5nhb-RXWjm5w1RIZM3j3UQJ4Vr4bVJ6Z2rX8A,29322
25
- assemblyline_v4_service-4.4.1.dev110.dist-info/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
26
- assemblyline_v4_service-4.4.1.dev110.dist-info/METADATA,sha256=qZaSW1cO7BmHYJTSYKkpzsj5NMvmy4zOib4l-f57aRQ,9360
27
- assemblyline_v4_service-4.4.1.dev110.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
28
- assemblyline_v4_service-4.4.1.dev110.dist-info/top_level.txt,sha256=Ut5IqePObcxlJ8rv2--dOAzYbxzqlllfiV_51cbqjbA,24
29
- assemblyline_v4_service-4.4.1.dev110.dist-info/RECORD,,
24
+ assemblyline_v4_service/updater/updater.py,sha256=gTFNN8Xow1HnlUcftWG30-ULXK5_FfJynZBnf7i4aIQ,29528
25
+ assemblyline_v4_service-4.4.1.dev112.dist-info/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
26
+ assemblyline_v4_service-4.4.1.dev112.dist-info/METADATA,sha256=zn0HfbthBoBY5DK8YJ25LIsRPtWvd9NCLqC7QfAGHvc,9360
27
+ assemblyline_v4_service-4.4.1.dev112.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
28
+ assemblyline_v4_service-4.4.1.dev112.dist-info/top_level.txt,sha256=Ut5IqePObcxlJ8rv2--dOAzYbxzqlllfiV_51cbqjbA,24
29
+ assemblyline_v4_service-4.4.1.dev112.dist-info/RECORD,,