maco 1.2.9__py3-none-any.whl → 1.2.10__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 +6 -6
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/METADATA +2 -2
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/RECORD +8 -8
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/WHEEL +1 -1
- model_setup/maco/utils.py +6 -6
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/LICENSE.md +0 -0
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/entry_points.txt +0 -0
- {maco-1.2.9.dist-info → maco-1.2.10.dist-info}/top_level.txt +0 -0
maco/utils.py
CHANGED
|
@@ -39,8 +39,8 @@ logger = logging.getLogger("maco.lib.utils")
|
|
|
39
39
|
|
|
40
40
|
VENV_DIRECTORY_NAME = ".venv"
|
|
41
41
|
|
|
42
|
-
RELATIVE_FROM_RE = re.compile(
|
|
43
|
-
RELATIVE_FROM_IMPORT_RE = re.compile(
|
|
42
|
+
RELATIVE_FROM_RE = re.compile(rb"from (\.+)")
|
|
43
|
+
RELATIVE_FROM_IMPORT_RE = re.compile(rb"from (\.+) import")
|
|
44
44
|
|
|
45
45
|
UV_BIN = find_uv_bin()
|
|
46
46
|
|
|
@@ -171,19 +171,19 @@ def scan_for_extractors(root_directory: str, scanner: yara.Rules, logger: Logger
|
|
|
171
171
|
# Scan Python file for potential extractors
|
|
172
172
|
if package:
|
|
173
173
|
# Inspect the contents and look for any relative import issues
|
|
174
|
-
with open(path, "
|
|
174
|
+
with open(path, "rb") as f:
|
|
175
175
|
data = f.read()
|
|
176
176
|
|
|
177
|
-
with open(path, "
|
|
177
|
+
with open(path, "wb") as f:
|
|
178
178
|
# Replace any relative importing with absolute
|
|
179
179
|
curr_dir = os.path.dirname(path)
|
|
180
180
|
split = curr_dir.split("/")[::-1]
|
|
181
181
|
for pattern in [RELATIVE_FROM_IMPORT_RE, RELATIVE_FROM_RE]:
|
|
182
182
|
for match in pattern.findall(data):
|
|
183
|
-
depth = match.count(".")
|
|
183
|
+
depth = match.count(b".")
|
|
184
184
|
abspath = ".".join(split[depth - 1 : split.index(package) + 1][::-1])
|
|
185
185
|
abspath += "." if pattern == RELATIVE_FROM_RE else ""
|
|
186
|
-
data = data.replace(f"from {match}", f"from {abspath}", 1)
|
|
186
|
+
data = data.replace(f"from {match.decode()}".encode(), f"from {abspath}".encode(), 1)
|
|
187
187
|
f.write(data)
|
|
188
188
|
|
|
189
189
|
if scanner.match(path):
|
|
@@ -12,7 +12,7 @@ maco/base_test.py,sha256=cjGLEy2c69wl9sjn74QFz7X-VxWOfdin4W8MvYsXc4Q,2718
|
|
|
12
12
|
maco/cli.py,sha256=pPS8euWaLV-6csBCCzT1Mtc7GwP7a_RikDjfUYxoxU8,8415
|
|
13
13
|
maco/collector.py,sha256=cBZEHx5qjFwf-EfAgEmXlu4kT4rWZkcDE926gBrOoN8,7493
|
|
14
14
|
maco/extractor.py,sha256=uGSGiCQ4jd8jFmfw2T99BGcY5iQJzXHcG_RoTIxClTE,2802
|
|
15
|
-
maco/utils.py,sha256
|
|
15
|
+
maco/utils.py,sha256=Tjop6lfnb5LtkS0QruUzIO1NVnNkYi0i1I94CyjHL1Q,20895
|
|
16
16
|
maco/yara.py,sha256=8RVaGyeUWY5f8_wfQ25lDX1bcXsb_VoSja85ZC2SqGw,2913
|
|
17
17
|
maco/model/__init__.py,sha256=ULdyHx8R5D2ICHZo3VoCk1YTlewTok36TYIpwx__pNY,45
|
|
18
18
|
maco/model/model.py,sha256=4uY88WphbP3iu-L2WjuYwtgZCS_wNul_hr0bAVuTpvc,23740
|
|
@@ -21,7 +21,7 @@ model_setup/maco/base_test.py,sha256=cjGLEy2c69wl9sjn74QFz7X-VxWOfdin4W8MvYsXc4Q
|
|
|
21
21
|
model_setup/maco/cli.py,sha256=pPS8euWaLV-6csBCCzT1Mtc7GwP7a_RikDjfUYxoxU8,8415
|
|
22
22
|
model_setup/maco/collector.py,sha256=cBZEHx5qjFwf-EfAgEmXlu4kT4rWZkcDE926gBrOoN8,7493
|
|
23
23
|
model_setup/maco/extractor.py,sha256=uGSGiCQ4jd8jFmfw2T99BGcY5iQJzXHcG_RoTIxClTE,2802
|
|
24
|
-
model_setup/maco/utils.py,sha256
|
|
24
|
+
model_setup/maco/utils.py,sha256=Tjop6lfnb5LtkS0QruUzIO1NVnNkYi0i1I94CyjHL1Q,20895
|
|
25
25
|
model_setup/maco/yara.py,sha256=8RVaGyeUWY5f8_wfQ25lDX1bcXsb_VoSja85ZC2SqGw,2913
|
|
26
26
|
model_setup/maco/model/__init__.py,sha256=ULdyHx8R5D2ICHZo3VoCk1YTlewTok36TYIpwx__pNY,45
|
|
27
27
|
model_setup/maco/model/model.py,sha256=4uY88WphbP3iu-L2WjuYwtgZCS_wNul_hr0bAVuTpvc,23740
|
|
@@ -36,9 +36,9 @@ tests/extractors/basic_longer.py,sha256=1ClU2QD-Y0TOl_loNFvEqIEpTR5TSVJ6zg9ZmC-E
|
|
|
36
36
|
tests/extractors/test_basic.py,sha256=FLKekfSGM69HaiF7Vu_7D7KDXHZko-9hZkMO8_DoyYA,697
|
|
37
37
|
tests/extractors/bob/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
tests/extractors/bob/bob.py,sha256=G5aOoz58J0ZQK2_lA7HRxAzeLzBxssWxBTZcv1pSbi8,176
|
|
39
|
-
maco-1.2.
|
|
40
|
-
maco-1.2.
|
|
41
|
-
maco-1.2.
|
|
42
|
-
maco-1.2.
|
|
43
|
-
maco-1.2.
|
|
44
|
-
maco-1.2.
|
|
39
|
+
maco-1.2.10.dist-info/LICENSE.md,sha256=gMSjshPhXvV_F1qxmeNkKdBqGWkd__fEJf4glS504bM,1478
|
|
40
|
+
maco-1.2.10.dist-info/METADATA,sha256=FtHe8aMGg8ij5Z9RQ1alHpGYUA2hkCnPetwhKnVh8cE,15893
|
|
41
|
+
maco-1.2.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
42
|
+
maco-1.2.10.dist-info/entry_points.txt,sha256=TpcwG1gedIg8Y7a9ZOv8aQpuwEUftCefDrAjzeP-o6U,39
|
|
43
|
+
maco-1.2.10.dist-info/top_level.txt,sha256=iMRwuzmrHA3zSwiSeMIl6FWhzRpn_st-I4fAv-kw5_o,49
|
|
44
|
+
maco-1.2.10.dist-info/RECORD,,
|
model_setup/maco/utils.py
CHANGED
|
@@ -39,8 +39,8 @@ logger = logging.getLogger("maco.lib.utils")
|
|
|
39
39
|
|
|
40
40
|
VENV_DIRECTORY_NAME = ".venv"
|
|
41
41
|
|
|
42
|
-
RELATIVE_FROM_RE = re.compile(
|
|
43
|
-
RELATIVE_FROM_IMPORT_RE = re.compile(
|
|
42
|
+
RELATIVE_FROM_RE = re.compile(rb"from (\.+)")
|
|
43
|
+
RELATIVE_FROM_IMPORT_RE = re.compile(rb"from (\.+) import")
|
|
44
44
|
|
|
45
45
|
UV_BIN = find_uv_bin()
|
|
46
46
|
|
|
@@ -171,19 +171,19 @@ def scan_for_extractors(root_directory: str, scanner: yara.Rules, logger: Logger
|
|
|
171
171
|
# Scan Python file for potential extractors
|
|
172
172
|
if package:
|
|
173
173
|
# Inspect the contents and look for any relative import issues
|
|
174
|
-
with open(path, "
|
|
174
|
+
with open(path, "rb") as f:
|
|
175
175
|
data = f.read()
|
|
176
176
|
|
|
177
|
-
with open(path, "
|
|
177
|
+
with open(path, "wb") as f:
|
|
178
178
|
# Replace any relative importing with absolute
|
|
179
179
|
curr_dir = os.path.dirname(path)
|
|
180
180
|
split = curr_dir.split("/")[::-1]
|
|
181
181
|
for pattern in [RELATIVE_FROM_IMPORT_RE, RELATIVE_FROM_RE]:
|
|
182
182
|
for match in pattern.findall(data):
|
|
183
|
-
depth = match.count(".")
|
|
183
|
+
depth = match.count(b".")
|
|
184
184
|
abspath = ".".join(split[depth - 1 : split.index(package) + 1][::-1])
|
|
185
185
|
abspath += "." if pattern == RELATIVE_FROM_RE else ""
|
|
186
|
-
data = data.replace(f"from {match}", f"from {abspath}", 1)
|
|
186
|
+
data = data.replace(f"from {match.decode()}".encode(), f"from {abspath}".encode(), 1)
|
|
187
187
|
f.write(data)
|
|
188
188
|
|
|
189
189
|
if scanner.match(path):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|