GithubHelp home page GithubHelp logo

xushiwei / gitleaks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gitleaks/gitleaks

0.0 2.0 0.0 2.49 MB

Searches full repo history for secrets and keys ๐Ÿ”‘

License: GNU General Public License v3.0

Shell 1.69% Go 98.31%

gitleaks's Introduction

gitleaks

Travis

Audit git repos for secrets and keys

Installing

go get -u github.com/zricethezav/gitleaks

Or download from release binaries here

Usage and Explanation

Alt Text

./gitleaks [options] <url/path>

Gitleaks audits local and remote repos by running regex checks against all commits.

Options

usage: gitleaks [options] <URL>/<path_to_repo>

Options:
 -u --user              Git user mode
 -r --repo              Git repo mode
 -o --org               Git organization mode
 -l --local             Local mode, gitleaks will look for local repo in <path>
 -t --temp              Clone to temporary directory
 -v --verbose           Verbose mode, will output leaks as gitleaks finds them
 --report-path=<STR>    Save report to path, gitleaks default behavior is to save report to pwd
 --clone-path=<STR>     Gitleaks will clone repos here, default pwd
 --concurrency=<INT>    Upper bound on concurrent diffs
 --regex-file=<STR>     Path to regex file for external regex matching
 --since=<STR>          Commit to stop at
 --b64Entropy=<INT>     Base64 entropy cutoff (default is 70)
 --hexEntropy=<INT>     Hex entropy cutoff (default is 40)
 -e --entropy           Enable entropy
 -h --help              Display this message
 --token=<STR>          Github API token
 --stopwords            Enables stopwords

Exit Codes

code explanation
0 Gitleaks succeeded with no leaks
1 Gitleaks failed or wasn't attempted due to execution failure
2 Gitleaks succeeded and leaks were present during the audit

Use these codes to hook gitleaks into whatever pipeline you're running

Examples

gitleaks

Run audit on current working directory if .git is present

gitleaks --local $HOME/audits/some/repo

Run audit on repo located in HOME/audits/some/repo if .git is present

gitleaks https://github.com/some/repo

Run audit on github.com/some/repo.git and clone repo to

gitleaks --clone-path=$HOME/Desktop/audits https://github.com/some/repo

Run audit on github.com/some/repo.git and clone repo to $HOME/Desktop/audits

gitleaks --temp https://github.com/some/repo

Run audit on github.com/some/repo.git and clone repo to $TMPDIR (this will remove repos after audit is complete)

gitleaks --temp -u https://github.com/some-user

Run audit on all of some-user's repos. Again, --temp flag will clone all repos into $TMPDIR after be removed after audit

gitleaks --regex-file=myregex.txt

Run audit on current working directory if .git is present and check for additional external regexes defined in myregex.txt. myregex.txt is just a text file containing a regular experession per line. Sample external regex-file:

[a-z0-9_-]{3,16}
[a-z]{3,16}

If you find a valid leak in a repo

Please read the Github article on removing sensitive data from a repository to remove the sensitive information from your history.

Run me with docker

Simply run docker run --rm --name=gitleaks zricethezav/gitleaks https://github.com/zricethezav/gitleaks

Or build the image yourself to get the latest version :

docker build -t gitleaks .
docker run --rm --name=gitleaks gitleaks https://github.com/zricethezav/gitleaks
Support

BTC: 397zNMQnSUzGaqYw8XVa9YjNPiRpSZWkhX

ETH: 0x07eFa8c73235e18C9D7E7A1679751Aa9363CD99B

gitleaks's People

Contributors

zricethezav avatar devnixs avatar helixspiral avatar realzcong avatar plutov avatar apostov avatar equinox avatar keirans avatar loicbourgois avatar bestform avatar pbnj avatar ryan-copperleaf avatar arjunyel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.