mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 19:12:01 -08:00
main: provide encoding to open
fixes flake8 warning
This commit is contained in:
@@ -52,7 +52,7 @@ def assert_never(value) -> NoReturn:
|
||||
|
||||
|
||||
def get_format_from_report(sample: Path) -> str:
|
||||
report = json.load(sample.open())
|
||||
report = json.load(sample.open(encoding="utf-8"))
|
||||
if "CAPE" in report:
|
||||
return FORMAT_CAPE
|
||||
return FORMAT_UNKNOWN
|
||||
|
||||
@@ -751,7 +751,7 @@ def get_extractor(
|
||||
if format_ == FORMAT_CAPE:
|
||||
import capa.features.extractors.cape.extractor
|
||||
|
||||
report = json.load(Path(path).open())
|
||||
report = json.load(Path(path).open(encoding="utf-8"))
|
||||
return capa.features.extractors.cape.extractor.CapeExtractor.from_report(report)
|
||||
|
||||
elif format_ == FORMAT_DOTNET:
|
||||
@@ -827,7 +827,7 @@ def get_file_extractors(sample: Path, format_: str) -> List[FeatureExtractor]:
|
||||
file_extractors.append(capa.features.extractors.elffile.ElfFeatureExtractor(sample))
|
||||
|
||||
elif format_ == FORMAT_CAPE:
|
||||
report = json.load(Path(sample).open())
|
||||
report = json.load(Path(sample).open(encoding="utf-8"))
|
||||
file_extractors.append(capa.features.extractors.cape.extractor.CapeExtractor.from_report(report))
|
||||
|
||||
return file_extractors
|
||||
|
||||
Reference in New Issue
Block a user