mirror of
https://github.com/mandiant/capa.git
synced 2025-12-21 23:00:29 -08:00
remove BaseException usage
This commit is contained in:
@@ -309,9 +309,8 @@ class InvalidAttckOrMbcTechnique(Lint):
|
|||||||
with data_path.open("rb") as fd:
|
with data_path.open("rb") as fd:
|
||||||
self.data = json.load(fd)
|
self.data = json.load(fd)
|
||||||
self.enabled_frameworks = self.data.keys()
|
self.enabled_frameworks = self.data.keys()
|
||||||
except BaseException:
|
except (FileNotFoundError, json.decoder.JSONDecodeError):
|
||||||
# If linter-data.json is not present, or if an error happen
|
# linter-data.json missing, or JSON error: log an error and skip this lint
|
||||||
# we log an error and lint nothing.
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Could not load 'scripts/linter-data.json'. The att&ck and mbc information will not be linted."
|
"Could not load 'scripts/linter-data.json'. The att&ck and mbc information will not be linted."
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -178,11 +178,8 @@ def main(args: argparse.Namespace) -> None:
|
|||||||
data["mbc"] = MbcExtractor().run()
|
data["mbc"] = MbcExtractor().run()
|
||||||
|
|
||||||
logging.info("Writing results to %s", args.output)
|
logging.info("Writing results to %s", args.output)
|
||||||
try:
|
with Path(args.output).open("w", encoding="utf-8") as jf:
|
||||||
with Path(args.output).open("w", encoding="utf-8") as jf:
|
json.dump(data, jf, indent=2)
|
||||||
json.dump(data, jf, indent=2)
|
|
||||||
except BaseException as e:
|
|
||||||
logging.error("Exception encountered when writing results: %s", e)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user