Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle when the AnalysisAbortedException is raised by a MACO extractor #37

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions configextractor/frameworks/maco.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from maco.model import ExtractorModel
from maco.utils import MACO_YARA_RULE, Base64Decoder, maco_extractor_validation
from maco.utils import VENV_SCRIPT as MACO_VENV_SCRIPT
from maco.exceptions import AnalysisAbortedException

from configextractor.frameworks.base import Extractor, Framework

Expand Down Expand Up @@ -33,6 +34,11 @@ def run(self, sample_path: str, parsers: Dict[Extractor, List[str]]) -> List[dic
if r:
result.update({"config": r.dict(exclude_defaults=True, exclude_none=True)})

except AnalysisAbortedException:
# Extractor voluntarily aborted extraction
# This is the equivalent of the sample being invalid for the extractor
continue

except Exception as e:
# Add exception to results
result["exception"] = str(e)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cart
click
maco >= 1.2.7
maco >= 1.2.12
mwcfg
mwcp
setuptools