@@ -33,62 +33,88 @@ sensleaks-rs
3333Usage: sensleak.exe [OPTIONS] --repo < REPO>
3434
3535Options:
36- -r, --repo < REPO> Target repository
37- -c, --config < CONFIG> Config path.. [default: gitleaks.toml]
38- -o, --report < REPORT> Path to write json leaks file [default: ]
39- -v, --verbose Show verbose output from scan
40- -e, --pretty Pretty print json if leaks are present
41- -h, --help Print help (see more with ' --help' )
42- -V, --version Print version
36+ --repo < REPO> Target repository
37+ --config < CONFIG> Config path.. [default: gitleaks.toml]
38+ --report < REPORT> Path to write json leaks file [default: ]
39+ -v, --verbose Show verbose output from scan
40+ --pretty Pretty print json if leaks are present
41+ --commit < COMMIT> sha of commit to scan or " latest" to scan the last commit of the repository
42+ --commits < COMMITS> comma separated list of a commits to scan
43+ --commits-file < COMMITS_FILE> file of new line separated list of a commits to scan
44+ --commit-since < COMMIT_SINCE> Scan commits more recent than a specific date. Ex: ' 2006-01-02' or ' 2023-01-02T15:04:05-0700' format
45+ --commit-until < COMMIT_UNTIL> Scan commits older than a specific date. Ex: ' 2006-01-02' or ' 2006-10-02T15:04:05-0700' format
46+ --commit-from < COMMIT_FROM> Commit to start scan from
47+ --commit-to < COMMIT_TO> Commit to stop scan
48+ --branch < BRANCH> Branch to scan (comming soon)
49+ --uncommitted run gitleaks on uncommitted code (comming soon)
50+ --user < USER> user to scan (comming soon)
51+ -h, --help Print help (see more with ' --help' )
52+ -V, --version Print version
53+
54+
4355
4456Repository: https://github.com/open-rust-initiative/sensleak-rs
4557` ` `
4658
47- Examples: (test the file in src \t ests \f iles \t est )
59+ Examples: (Test repo: https://github.com/sonichen/TestGitOperation )
4860
4961` ` ` shell
50- sensleak -r= " tests\files\test " -v -e
62+ sensleak --repo= " D:/Workplace/Git/TestGitOperation " --commit= " 8bdca802af0514ce29947e20c6be1719974ad866 " - v --pretty
5163` ` `
5264
5365Output:
5466
5567` ` ` shell
68+ [INFO][2023-05-26 11:51:04] Open repo ...
5669[
57- OutputItem {
58- line: " token = sk_test_abcd1234567890efghijklmno " ,
59- line_number: 5 ,
60- secret: " sk_test_abcd1234567890efghijklmno " ,
61- entropy: " " ,
62- commit: " " ,
63- repo: " " ,
64- rule: " Stripe Access Token " ,
65- commit_message: " " ,
66- author: " " ,
67- email: " " ,
68- file: " tests \\ files \\ test \\ file2.txt " ,
69- date: " " ,
70+ Leak {
71+ line: " twilio_api_key = SK12345678901234567890123456789012 " ,
72+ line_number: 6 ,
73+ secret: " api_key = SK12345678901234567890123456789012 " ,
74+ entropy: " 3.5 " ,
75+ commit: " 8bdca802af0514ce29947e20c6be1719974ad866 " ,
76+ repo: " TestGitOperation " ,
77+ rule: " Generic API Key " ,
78+ commit_message: " test\n " ,
79+ author: " sonichen " ,
80+ 81+ file: " /src/key.java " ,
82+ date: " 2023-05-23 23:55:12 -08:00 " ,
7083 tags: " " ,
71- operation: " " ,
84+ operation: " addition " ,
7285 },
73- OutputItem {
86+ ...
87+ Leak {
7488 line: " twilio_api_key = SK12345678901234567890123456789012" ,
75- line_number: 6 ,
89+ line_number: 2 ,
7690 secret: " SK12345678901234567890123456789012" ,
7791 entropy: " " ,
78- commit: " " ,
79- repo: " " ,
92+ commit: " 8bdca802af0514ce29947e20c6be1719974ad866 " ,
93+ repo: " TestGitOperation " ,
8094 rule: " Twilio API Key" ,
81- commit_message: " " ,
82- author: " " ,
83- email: " " ,
84- file: " tests \\ files \\ test \\ file2.txt " ,
85- date: " " ,
95+ commit_message: " test\n " ,
96+ author: " sonichen " ,
97+ 98+ file: " /src/mykey.java " ,
99+ date: " 2023-05-23 23:55:12 -08:00 " ,
86100 tags: " " ,
87- operation: " " ,
101+ operation: " addition " ,
88102 },
89- ....
90103]
91- WARN:[2023-05-17 09:45:07]10 leaks detected. XXX commits scanned in 66.6222ms
104+ [WARN][2023-05-26 11:51:05]10 leaks detected. 1 commits scanned in 1.7318395s
105+
106+ ` ` `
107+
108+
109+
110+ More examples:
111+
112+ ` ` ` shell
113+ cargo run -- --repo=" D:/Workplace/Git/TestGitOperation" --commit=" 8bdca802af0514ce29947e20c6be1719974ad866" -v --pretty
114+ cargo run -- --repo=" D:/Workplace/Git/TestGitOperation" --commits=" 4362fc4df48df74a46b56368d7fff1b02d01be72,8bdca802af0514ce29947e20c6be1719974ad866" -v --pretty
115+ cargo run -- --repo=" D:/Workplace/Git/TestGitOperation" --commits-file=" tests/files/commits.txt" -v --pretty
116+ cargo run -- --repo=" D:/Workplace/Git/TestGitOperation" --commit-since=" 2023-05-20" --commit-until=" 2023-05-26" -v --pretty
117+ cargo run -- --repo=" D:/Workplace/Git/TestGitOperation" --commit-to=" 4362fc4df48df74a46b56368d7fff1b02d01be72" --commit-from=" 8bdca802af0514ce29947e20c6be1719974ad866" -v --pretty
92118` ` `
93119
94120
0 commit comments