maco 1.2.16__py3-none-any.whl → 1.2.17__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.
maco/utils.py CHANGED
@@ -259,15 +259,15 @@ def _install_required_packages(create_venv: bool, directories: List[str], python
259
259
  # This prevents issues during maco development and building extractors against local libraries.
260
260
  if create_venv:
261
261
  # when running in custom virtual environment, always upgrade packages.
262
- install_command.append("-U")
262
+ install_command.extend(["--upgrade", "--no-cache"])
263
263
 
264
264
  # Update the pip install command depending on where the dependencies are coming from
265
265
  if "requirements.txt" in req_files:
266
266
  # Perform a pip install using the requirements flag
267
- install_command.extend(["-r", "requirements.txt"])
267
+ install_command.extend(["--requirements", "requirements.txt"])
268
268
  elif "pyproject.toml" in req_files:
269
269
  # Assume we're dealing with a project directory
270
- pyproject_command = ["-e", "."]
270
+ pyproject_command = ["--editable", "."]
271
271
 
272
272
  # Check to see if there are optional dependencies required
273
273
  with open(os.path.join(dir, "pyproject.toml"), "rb") as f:
maco/yara.py CHANGED
@@ -3,7 +3,7 @@
3
3
  import re
4
4
  from collections import namedtuple
5
5
  from itertools import cycle
6
- from typing import Dict, List
6
+ from typing import Dict, List, Union
7
7
 
8
8
  import yara_x
9
9
 
@@ -104,7 +104,7 @@ class Rules:
104
104
  for rule in self._rules:
105
105
  yield rule
106
106
 
107
- def match(self, filepath: str = None, data: bytes = None) -> List[Match]:
107
+ def match(self, filepath: str = None, data: Union[bytes, bytearray] = None) -> List[Match]:
108
108
  """Performs a scan to check for YARA rules matches based on the file, either given by path or buffer.
109
109
 
110
110
  Returns:
@@ -114,6 +114,9 @@ class Rules:
114
114
  with open(filepath, "rb") as fp:
115
115
  data = fp.read()
116
116
 
117
+ if isinstance(data, bytearray):
118
+ data = bytes(data)
119
+
117
120
  return [Match(m, data) for m in self.scanner.scan(data).matching_rules]
118
121
 
119
122
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maco
3
- Version: 1.2.16
3
+ Version: 1.2.17
4
4
  Author: sl-govau
5
5
  Maintainer: cccs-rs
6
6
  License: MIT License
@@ -33,7 +33,7 @@ Requires-Dist: cart
33
33
  Requires-Dist: pydantic>=2.0.0
34
34
  Requires-Dist: tomli>=1.1.0; python_version < "3.11"
35
35
  Requires-Dist: uv
36
- Requires-Dist: yara-x==0.11.0
36
+ Requires-Dist: yara-x
37
37
  Requires-Dist: multiprocess>=0.70.17
38
38
  Dynamic: license-file
39
39
 
@@ -14,19 +14,19 @@ maco/cli.py,sha256=nrSukAJAthbstZT3-lQNPz4zOOMcBhvfYQqLh_B5Jdk,9457
14
14
  maco/collector.py,sha256=R3zw-fUJBlwmcSqvkQ-PnoJdHfRm2V0JAOl7N8MTAbY,8240
15
15
  maco/exceptions.py,sha256=XBHUrs1kr1ZayPI9B_W-WejKgVmC8sWL_o4RL0b4DQE,745
16
16
  maco/extractor.py,sha256=s36aGcsXSc-9iCik6iihVt5G1a1DZUA7TquvWYQNwdE,2912
17
- maco/utils.py,sha256=wzecqu1W_BbhDHSs07sweOKNeFrmC4CDYmAN_qyYJS4,23362
18
- maco/yara.py,sha256=gkHHxwZNxzZV7nHZM3HNUmhHXB7VW82voCHK5mHpt2Q,3970
17
+ maco/utils.py,sha256=7Xf-kWCDm1DdpBCGOvecEb_hqKoRgNJi0M_OYsJeSrM,23405
18
+ maco/yara.py,sha256=y141t8NqDDXHY23uE1d6BDPeNmSuUuohR6Yr_LKa7GI,4067
19
19
  maco/model/__init__.py,sha256=ULdyHx8R5D2ICHZo3VoCk1YTlewTok36TYIpwx__pNY,45
20
20
  maco/model/model.py,sha256=DBHTmZXMzjpVq0s2mzZv3VCzPhwPnv7sH6u_QZCTcA4,24484
21
- maco-1.2.16.dist-info/licenses/LICENSE.md,sha256=gMSjshPhXvV_F1qxmeNkKdBqGWkd__fEJf4glS504bM,1478
21
+ maco-1.2.17.dist-info/licenses/LICENSE.md,sha256=gMSjshPhXvV_F1qxmeNkKdBqGWkd__fEJf4glS504bM,1478
22
22
  model_setup/maco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  model_setup/maco/base_test.py,sha256=DrVE7vOazeLQpOQeIDwBYK1WtlmdJrRe50JOqP5t4Y0,3198
24
24
  model_setup/maco/cli.py,sha256=nrSukAJAthbstZT3-lQNPz4zOOMcBhvfYQqLh_B5Jdk,9457
25
25
  model_setup/maco/collector.py,sha256=R3zw-fUJBlwmcSqvkQ-PnoJdHfRm2V0JAOl7N8MTAbY,8240
26
26
  model_setup/maco/exceptions.py,sha256=XBHUrs1kr1ZayPI9B_W-WejKgVmC8sWL_o4RL0b4DQE,745
27
27
  model_setup/maco/extractor.py,sha256=s36aGcsXSc-9iCik6iihVt5G1a1DZUA7TquvWYQNwdE,2912
28
- model_setup/maco/utils.py,sha256=wzecqu1W_BbhDHSs07sweOKNeFrmC4CDYmAN_qyYJS4,23362
29
- model_setup/maco/yara.py,sha256=gkHHxwZNxzZV7nHZM3HNUmhHXB7VW82voCHK5mHpt2Q,3970
28
+ model_setup/maco/utils.py,sha256=7Xf-kWCDm1DdpBCGOvecEb_hqKoRgNJi0M_OYsJeSrM,23405
29
+ model_setup/maco/yara.py,sha256=y141t8NqDDXHY23uE1d6BDPeNmSuUuohR6Yr_LKa7GI,4067
30
30
  model_setup/maco/model/__init__.py,sha256=ULdyHx8R5D2ICHZo3VoCk1YTlewTok36TYIpwx__pNY,45
31
31
  model_setup/maco/model/model.py,sha256=DBHTmZXMzjpVq0s2mzZv3VCzPhwPnv7sH6u_QZCTcA4,24484
32
32
  pipelines/publish.yaml,sha256=xt3WNU-5kIICJgKIiiE94M3dWjS3uEiun-n4OmIssK8,1471
@@ -42,8 +42,8 @@ tests/extractors/bob/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
42
42
  tests/extractors/bob/bob.py,sha256=4fpqy_O6NDinJImghyW5OwYgnaB05aY4kgoIS_C3c_U,253
43
43
  tests/extractors/import_rewriting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  tests/extractors/import_rewriting/importer.py,sha256=wqF1AG2zXXuj9EMt9qlDorab-UD0GYuFggtrCuz4sf0,289735
45
- maco-1.2.16.dist-info/METADATA,sha256=v5ZV9RoifsSn6im1tO0wpUJeKPGW3Wf-_C_BjF7qNmM,15232
46
- maco-1.2.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
- maco-1.2.16.dist-info/entry_points.txt,sha256=TpcwG1gedIg8Y7a9ZOv8aQpuwEUftCefDrAjzeP-o6U,39
48
- maco-1.2.16.dist-info/top_level.txt,sha256=iMRwuzmrHA3zSwiSeMIl6FWhzRpn_st-I4fAv-kw5_o,49
49
- maco-1.2.16.dist-info/RECORD,,
45
+ maco-1.2.17.dist-info/METADATA,sha256=7NtcX0tJ94BxrswwvqTQO9Ou-UVURL5-j0nBOSGoWQY,15224
46
+ maco-1.2.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
+ maco-1.2.17.dist-info/entry_points.txt,sha256=TpcwG1gedIg8Y7a9ZOv8aQpuwEUftCefDrAjzeP-o6U,39
48
+ maco-1.2.17.dist-info/top_level.txt,sha256=iMRwuzmrHA3zSwiSeMIl6FWhzRpn_st-I4fAv-kw5_o,49
49
+ maco-1.2.17.dist-info/RECORD,,
model_setup/maco/utils.py CHANGED
@@ -259,15 +259,15 @@ def _install_required_packages(create_venv: bool, directories: List[str], python
259
259
  # This prevents issues during maco development and building extractors against local libraries.
260
260
  if create_venv:
261
261
  # when running in custom virtual environment, always upgrade packages.
262
- install_command.append("-U")
262
+ install_command.extend(["--upgrade", "--no-cache"])
263
263
 
264
264
  # Update the pip install command depending on where the dependencies are coming from
265
265
  if "requirements.txt" in req_files:
266
266
  # Perform a pip install using the requirements flag
267
- install_command.extend(["-r", "requirements.txt"])
267
+ install_command.extend(["--requirements", "requirements.txt"])
268
268
  elif "pyproject.toml" in req_files:
269
269
  # Assume we're dealing with a project directory
270
- pyproject_command = ["-e", "."]
270
+ pyproject_command = ["--editable", "."]
271
271
 
272
272
  # Check to see if there are optional dependencies required
273
273
  with open(os.path.join(dir, "pyproject.toml"), "rb") as f:
model_setup/maco/yara.py CHANGED
@@ -3,7 +3,7 @@
3
3
  import re
4
4
  from collections import namedtuple
5
5
  from itertools import cycle
6
- from typing import Dict, List
6
+ from typing import Dict, List, Union
7
7
 
8
8
  import yara_x
9
9
 
@@ -104,7 +104,7 @@ class Rules:
104
104
  for rule in self._rules:
105
105
  yield rule
106
106
 
107
- def match(self, filepath: str = None, data: bytes = None) -> List[Match]:
107
+ def match(self, filepath: str = None, data: Union[bytes, bytearray] = None) -> List[Match]:
108
108
  """Performs a scan to check for YARA rules matches based on the file, either given by path or buffer.
109
109
 
110
110
  Returns:
@@ -114,6 +114,9 @@ class Rules:
114
114
  with open(filepath, "rb") as fp:
115
115
  data = fp.read()
116
116
 
117
+ if isinstance(data, bytearray):
118
+ data = bytes(data)
119
+
117
120
  return [Match(m, data) for m in self.scanner.scan(data).matching_rules]
118
121
 
119
122
 
File without changes