Skip to main content

Secret Scanner

A simple tool to scan directories for secrets using regular expressions.

Install

Install using either pip, pipx or your Python installer of choice

pipx install secretscanner

Usage

To scan a directory and print the files with secrets

secretscanner DIRECTORY

To also display info on the tokens that have been found pass the -v/--verbose flag.

To hide the output pass the -q/--quiet flag.

To output the tokens found as json pass the -j/--json flag.

If secrets are found the tool exits with exit code 1

Output

By default files which contain secrets are either yellow when they contain secrets and dim yellow if they contain secrets but the file is ignored by git i.e. the only reason they're not there is because a .gitignore file is provided.

Default output

Files with embedded secrets:
  /secretscanner/tests/dir/github/github.txt
  /secretscanner/tests/dir/pypi/pypi.txt
  /secretscanner/tests/dir/digitalocean/digitalocean.txt

Verbose Output

Files with embedded secrets:
  /secretscanner/tests/dir/github/github.txt
    - Issuer: github
      Type: pat
      Secret: ghp_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghj
    - Issuer: github
      Type: oauth
      Secret: gho_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghj
    - Issuer: github
      Type: user-to-server
      Secret: ghu_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghj
    - Issuer: github
      Type: server-to-server
      Secret: ghs_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghj
    - Issuer: github
      Type: refresh
      Secret: ghr_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghj
  /secretscanner/tests/dir/pypi/pypi.txt
    - Issuer: pypi
      Type: pat
      Secret:
        pypi-AgEIcHlwaS5vcmcCJGzcex4tRk1EkM_jg2KTYkrCissgG2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX
        0AAAYgjeEtcvL8TyDUVri6iM0LTc2YzUtNDgwYy05NTA3LTlkMjBmZjY2MWY0
  /secretscanner/tests/dir/digitalocean/digitalocean.txt
    - Issuer: digitalocean
      Type: pat
      Secret:
        dop_v1_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghjJHGHJJGJGHJGHJG76y78
        bhjksdbahjkghj
    - Issuer: digitalocean
      Type: oauth
      Secret:
        doo_v1_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghjJHGHJJGJGHJGHJG76y78
        bhjksdbahjkghj
    - Issuer: digitalocean
      Type: refresh
      Secret:
        dor_v1_GHJSGSJHGgjhgshjagjgasjgjhJHGHJJGJGHJGHJG76y78bhjksdbahjkghjJHGHJJGJGHJGHJG76y78
        bhjksdbahjkghj

Recognized Secrets

The tool currently recognizes the following secret types

  • Github access tokens
  • PyPI access tokens
  • Digital Ocean access tokens

Package Status

GitHub Workflow Status PyPI - Downloads

Metadata

Release files for secretscanner 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secretscanner 0.2.1
File Size Uploaded Provenance
secretscanner-0.2.1.tar.gz 9.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for secretscanner 0.2.1
File Interpreter ABI Platform
secretscanner-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / secretscanner-0.2.1.tar.gz

Download URL secretscanner-0.2.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a67e06d09d47d845d625657b7d961aa97c44000e87c4c1f5cdf791cc8b44dc0c
BLAKE2b-256 checksum
How to use checksums
30f49c5ef43c3439f07776305a0cce5e0cc67dc1c107ff72d7cc508a10c221e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.6 Linux/5.10.102.1-microsoft-standard-WSL2

Release files / secretscanner-0.2.1-py3-none-any.whl

Download URL secretscanner-0.2.1-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2362fce61ce74e112fe3e6f81e86489cad91fc6b5a376f86f66454e583d96b17
BLAKE2b-256 checksum
How to use checksums
3a666e71cb3a42445818a848199a6312005b717e29ceaef2b2594e14d2e239f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.6 Linux/5.10.102.1-microsoft-standard-WSL2

Security for secretscanner 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page