maco 1.2.10__py3-none-any.whl → 1.2.11__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/cli.py +10 -1
- maco/collector.py +2 -0
- maco/utils.py +13 -3
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/METADATA +1 -1
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/RECORD +12 -12
- model_setup/maco/cli.py +10 -1
- model_setup/maco/collector.py +2 -0
- model_setup/maco/utils.py +13 -3
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/LICENSE.md +0 -0
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/WHEEL +0 -0
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/entry_points.txt +0 -0
- {maco-1.2.10.dist-info → maco-1.2.11.dist-info}/top_level.txt +0 -0
maco/cli.py
CHANGED
|
@@ -92,6 +92,7 @@ def process_filesystem(
|
|
|
92
92
|
force: bool,
|
|
93
93
|
include_base64: bool,
|
|
94
94
|
create_venv: bool = False,
|
|
95
|
+
skip_install: bool = False,
|
|
95
96
|
) -> Tuple[int, int, int]:
|
|
96
97
|
"""Process filesystem with extractors and print results of extraction.
|
|
97
98
|
|
|
@@ -99,7 +100,9 @@ def process_filesystem(
|
|
|
99
100
|
"""
|
|
100
101
|
if force:
|
|
101
102
|
logger.warning("force execute will cause errors if an extractor requires a yara rule hit during execution")
|
|
102
|
-
collected = collector.Collector(
|
|
103
|
+
collected = collector.Collector(
|
|
104
|
+
path_extractors, include=include, exclude=exclude, create_venv=create_venv, skip_install=skip_install
|
|
105
|
+
)
|
|
103
106
|
|
|
104
107
|
logger.info(f"extractors loaded: {[x for x in collected.extractors.keys()]}\n")
|
|
105
108
|
for _, extractor in collected.extractors.items():
|
|
@@ -191,6 +194,11 @@ def main():
|
|
|
191
194
|
"This runs much slower than the alternative but may be necessary "
|
|
192
195
|
"when there are many extractors with conflicting dependencies.",
|
|
193
196
|
)
|
|
197
|
+
parser.add_argument(
|
|
198
|
+
"--force_install",
|
|
199
|
+
action="store_true",
|
|
200
|
+
help="Force installation of Python dependencies for extractors (in both host and virtual environments).",
|
|
201
|
+
)
|
|
194
202
|
args = parser.parse_args()
|
|
195
203
|
inc = args.include.split(",") if args.include else []
|
|
196
204
|
exc = args.exclude.split(",") if args.exclude else []
|
|
@@ -236,6 +244,7 @@ def main():
|
|
|
236
244
|
force=args.force,
|
|
237
245
|
include_base64=args.base64,
|
|
238
246
|
create_venv=args.create_venv,
|
|
247
|
+
skip_install=not args.force_install,
|
|
239
248
|
)
|
|
240
249
|
|
|
241
250
|
|
maco/collector.py
CHANGED
|
@@ -67,6 +67,7 @@ class Collector:
|
|
|
67
67
|
include: List[str] = None,
|
|
68
68
|
exclude: List[str] = None,
|
|
69
69
|
create_venv: bool = False,
|
|
70
|
+
skip_install: bool = False,
|
|
70
71
|
):
|
|
71
72
|
"""Discover and load extractors from file system."""
|
|
72
73
|
# maco requires the extractor to be imported directly, so ensure they are available on the path
|
|
@@ -135,6 +136,7 @@ class Collector:
|
|
|
135
136
|
root_directory=path_extractors,
|
|
136
137
|
scanner=yara.compile(source=utils.MACO_YARA_RULE),
|
|
137
138
|
create_venv=create_venv and os.path.isdir(path_extractors),
|
|
139
|
+
skip_install=skip_install,
|
|
138
140
|
),
|
|
139
141
|
)
|
|
140
142
|
p.start()
|
maco/utils.py
CHANGED
|
@@ -450,9 +450,19 @@ def run_extractor(
|
|
|
450
450
|
key = f"{module_name}_{extractor_class}"
|
|
451
451
|
if key not in _loaded_extractors:
|
|
452
452
|
# dynamic import of extractor
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
try:
|
|
454
|
+
# Add the correct directory to the PATH before attempting to load the extractor
|
|
455
|
+
import_path = module_path[: -4 - len(module_name)]
|
|
456
|
+
sys.path.insert(1, import_path)
|
|
457
|
+
mod = importlib.import_module(module_name)
|
|
458
|
+
extractor_cls = mod.__getattribute__(extractor_class)
|
|
459
|
+
extractor = extractor_cls()
|
|
460
|
+
|
|
461
|
+
# Add to cache
|
|
462
|
+
_loaded_extractors[key] = extractor
|
|
463
|
+
finally:
|
|
464
|
+
sys.path.pop(1)
|
|
465
|
+
|
|
456
466
|
else:
|
|
457
467
|
# retrieve cached extractor
|
|
458
468
|
extractor = _loaded_extractors[key]
|
|
@@ -9,19 +9,19 @@ demo_extractors/complex/complex.py,sha256=tXrzj_zWIXbTOwj7Lezapk-qkrM-lfwcyjd5m-
|
|
|
9
9
|
demo_extractors/complex/complex_utils.py,sha256=aec8kJsYUrMPo-waihkVLt-0QpiOPkw7dDqfT9MNuHk,123
|
|
10
10
|
maco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
maco/base_test.py,sha256=cjGLEy2c69wl9sjn74QFz7X-VxWOfdin4W8MvYsXc4Q,2718
|
|
12
|
-
maco/cli.py,sha256=
|
|
13
|
-
maco/collector.py,sha256=
|
|
12
|
+
maco/cli.py,sha256=iXAfSSL8Td8DyOrMtMqZaXO4uGC5NPYrMDR9GklON24,8734
|
|
13
|
+
maco/collector.py,sha256=w4NQ1BcLOICXJxrEyOcXlkWGi_p31D9eK3IghKxq5y0,7576
|
|
14
14
|
maco/extractor.py,sha256=uGSGiCQ4jd8jFmfw2T99BGcY5iQJzXHcG_RoTIxClTE,2802
|
|
15
|
-
maco/utils.py,sha256=
|
|
15
|
+
maco/utils.py,sha256=LvrpAa4xfYFMUywtp-5INGdHlWqK8n9fsd31dtMPa1c,21273
|
|
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
|
|
19
19
|
model_setup/maco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
model_setup/maco/base_test.py,sha256=cjGLEy2c69wl9sjn74QFz7X-VxWOfdin4W8MvYsXc4Q,2718
|
|
21
|
-
model_setup/maco/cli.py,sha256=
|
|
22
|
-
model_setup/maco/collector.py,sha256=
|
|
21
|
+
model_setup/maco/cli.py,sha256=iXAfSSL8Td8DyOrMtMqZaXO4uGC5NPYrMDR9GklON24,8734
|
|
22
|
+
model_setup/maco/collector.py,sha256=w4NQ1BcLOICXJxrEyOcXlkWGi_p31D9eK3IghKxq5y0,7576
|
|
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=LvrpAa4xfYFMUywtp-5INGdHlWqK8n9fsd31dtMPa1c,21273
|
|
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.11.dist-info/LICENSE.md,sha256=gMSjshPhXvV_F1qxmeNkKdBqGWkd__fEJf4glS504bM,1478
|
|
40
|
+
maco-1.2.11.dist-info/METADATA,sha256=Tq5p2qkCIvlvzc48rskdrBhl6-FUEq0FhE-Xdm6JcL0,15893
|
|
41
|
+
maco-1.2.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
42
|
+
maco-1.2.11.dist-info/entry_points.txt,sha256=TpcwG1gedIg8Y7a9ZOv8aQpuwEUftCefDrAjzeP-o6U,39
|
|
43
|
+
maco-1.2.11.dist-info/top_level.txt,sha256=iMRwuzmrHA3zSwiSeMIl6FWhzRpn_st-I4fAv-kw5_o,49
|
|
44
|
+
maco-1.2.11.dist-info/RECORD,,
|
model_setup/maco/cli.py
CHANGED
|
@@ -92,6 +92,7 @@ def process_filesystem(
|
|
|
92
92
|
force: bool,
|
|
93
93
|
include_base64: bool,
|
|
94
94
|
create_venv: bool = False,
|
|
95
|
+
skip_install: bool = False,
|
|
95
96
|
) -> Tuple[int, int, int]:
|
|
96
97
|
"""Process filesystem with extractors and print results of extraction.
|
|
97
98
|
|
|
@@ -99,7 +100,9 @@ def process_filesystem(
|
|
|
99
100
|
"""
|
|
100
101
|
if force:
|
|
101
102
|
logger.warning("force execute will cause errors if an extractor requires a yara rule hit during execution")
|
|
102
|
-
collected = collector.Collector(
|
|
103
|
+
collected = collector.Collector(
|
|
104
|
+
path_extractors, include=include, exclude=exclude, create_venv=create_venv, skip_install=skip_install
|
|
105
|
+
)
|
|
103
106
|
|
|
104
107
|
logger.info(f"extractors loaded: {[x for x in collected.extractors.keys()]}\n")
|
|
105
108
|
for _, extractor in collected.extractors.items():
|
|
@@ -191,6 +194,11 @@ def main():
|
|
|
191
194
|
"This runs much slower than the alternative but may be necessary "
|
|
192
195
|
"when there are many extractors with conflicting dependencies.",
|
|
193
196
|
)
|
|
197
|
+
parser.add_argument(
|
|
198
|
+
"--force_install",
|
|
199
|
+
action="store_true",
|
|
200
|
+
help="Force installation of Python dependencies for extractors (in both host and virtual environments).",
|
|
201
|
+
)
|
|
194
202
|
args = parser.parse_args()
|
|
195
203
|
inc = args.include.split(",") if args.include else []
|
|
196
204
|
exc = args.exclude.split(",") if args.exclude else []
|
|
@@ -236,6 +244,7 @@ def main():
|
|
|
236
244
|
force=args.force,
|
|
237
245
|
include_base64=args.base64,
|
|
238
246
|
create_venv=args.create_venv,
|
|
247
|
+
skip_install=not args.force_install,
|
|
239
248
|
)
|
|
240
249
|
|
|
241
250
|
|
model_setup/maco/collector.py
CHANGED
|
@@ -67,6 +67,7 @@ class Collector:
|
|
|
67
67
|
include: List[str] = None,
|
|
68
68
|
exclude: List[str] = None,
|
|
69
69
|
create_venv: bool = False,
|
|
70
|
+
skip_install: bool = False,
|
|
70
71
|
):
|
|
71
72
|
"""Discover and load extractors from file system."""
|
|
72
73
|
# maco requires the extractor to be imported directly, so ensure they are available on the path
|
|
@@ -135,6 +136,7 @@ class Collector:
|
|
|
135
136
|
root_directory=path_extractors,
|
|
136
137
|
scanner=yara.compile(source=utils.MACO_YARA_RULE),
|
|
137
138
|
create_venv=create_venv and os.path.isdir(path_extractors),
|
|
139
|
+
skip_install=skip_install,
|
|
138
140
|
),
|
|
139
141
|
)
|
|
140
142
|
p.start()
|
model_setup/maco/utils.py
CHANGED
|
@@ -450,9 +450,19 @@ def run_extractor(
|
|
|
450
450
|
key = f"{module_name}_{extractor_class}"
|
|
451
451
|
if key not in _loaded_extractors:
|
|
452
452
|
# dynamic import of extractor
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
try:
|
|
454
|
+
# Add the correct directory to the PATH before attempting to load the extractor
|
|
455
|
+
import_path = module_path[: -4 - len(module_name)]
|
|
456
|
+
sys.path.insert(1, import_path)
|
|
457
|
+
mod = importlib.import_module(module_name)
|
|
458
|
+
extractor_cls = mod.__getattribute__(extractor_class)
|
|
459
|
+
extractor = extractor_cls()
|
|
460
|
+
|
|
461
|
+
# Add to cache
|
|
462
|
+
_loaded_extractors[key] = extractor
|
|
463
|
+
finally:
|
|
464
|
+
sys.path.pop(1)
|
|
465
|
+
|
|
456
466
|
else:
|
|
457
467
|
# retrieve cached extractor
|
|
458
468
|
extractor = _loaded_extractors[key]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|