From bc49fe485fb6e99b4291e3dda2759478db8e8044 Mon Sep 17 00:00:00 2001 From: Rohit1123 Date: Sat, 17 Feb 2024 14:21:49 +0530 Subject: [PATCH] Load .json.gz files directly --- capa/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/capa/helpers.py b/capa/helpers.py index ad27f3903..a15d98503 100644 --- a/capa/helpers.py +++ b/capa/helpers.py @@ -71,7 +71,11 @@ def assert_never(value) -> NoReturn: def get_format_from_report(sample: Path) -> str: - report = json.load(sample.open(encoding="utf-8")) + import gzip + + with gzip.open(sample, "r") as compressed_report: + report_json = compressed_report.read() + report = json.loads(report_json) if "CAPE" in report: return FORMAT_CAPE