Skip to content

Commit

Permalink
use common exception in deep scan due many variation
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Oct 15, 2023
1 parent 63bca99 commit db1aaef
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion credsweeper/deep_scanner/docx_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def data_scan(
info=f"{data_provider.info}|DOCX")
pdf_candidates = self.scanner.scan(string_data_provider)
candidates.extend(pdf_candidates)
except (KeyError, zipfile.BadZipFile) as docx_exc:
except Exception as docx_exc:
logger.debug(f"{data_provider.file_path}:{docx_exc}")
return candidates
2 changes: 1 addition & 1 deletion credsweeper/deep_scanner/jks_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def data_scan(
data_provider.file_type,
f"{data_provider.info}:'{pw_probe}' - default password")
candidates.append(candidate)
except (jks.KeystoreSignatureException, jks.BadKeystoreFormatException) as jks_exc:
except Exception as jks_exc:
logger.debug(f"{data_provider.file_path}:{pw_probe}:{jks_exc}")
return candidates
2 changes: 1 addition & 1 deletion credsweeper/deep_scanner/pkcs12_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ def data_scan(
data_provider.file_type, #
f"{data_provider.info}:'{pw_probe.decode()}' - default password PKCS12")
candidates.append(candidate)
except ValueError as pkcs_exc:
except Exception as pkcs_exc:
logger.debug(f"{data_provider.file_path}:{pw_probe.decode()}:{pkcs_exc}")
return candidates
Binary file added tests/samples/sample_bad_empty.docx
Binary file not shown.

0 comments on commit db1aaef

Please sign in to comment.