@@ -25,96 +25,97 @@ Here are a few examples of how to use the tool in different scenarios:
2525
2626- Running the tool in the command-line interface (CLI) to perform sensitive data checks.
2727
28- ** Note: This project is currently under development. The following features describe sensitive information search within a local folder. **
28+ ** Note: This project is currently under development. **
2929
3030``` shell
31- sensleaks-rs
32-
3331Usage: sensleak.exe [OPTIONS] --repo < REPO>
3432
3533Options:
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-
34+ --repo < REPO> Target repository
35+ --config < CONFIG> Config path [default: gitleaks.toml]
36+ --report < REPORT> Path to write json leaks file [default: ]
37+ --report-format < REPORT_FORMAT> json, csv, sarif [default: json]
38+ -v, --verbose Show verbose output from scan
39+ --pretty Pretty print json if leaks are present
40+ --commit < COMMIT> sha of commit to scan or " latest" to scan the last commit of the repository
41+ --commits < COMMITS> comma separated list of a commits to scan
42+ --commits-file < COMMITS_FILE> file of new line separated list of a commits to scan
43+ --commit-since < COMMIT_SINCE> Scan commits more recent than a specific date. Ex: ' 2006-01-02' or ' 2023-01-02T15:04:05-0700' format
44+ --commit-until < COMMIT_UNTIL> Scan commits older than a specific date. Ex: ' 2006-01-02' or ' 2006-10-02T15:04:05-0700' format
45+ --commit-from < COMMIT_FROM> Commit to start scan from
46+ --commit-to < COMMIT_TO> Commit to stop scan
47+ --branch < BRANCH> Branch to scan
48+ --uncommitted < UNCOMMITTED> Run sensleak on uncommitted code [possible values: true, false]
49+ --user < USER> Set user to scan [default: ]
50+ --repo-config Load config from target repo. Config file must be " .gitleaks.toml" or " gitleaks.toml"
51+ --debug log debug messages
52+ --disk < DISK> Clones repo(s) to disk
53+ -h, --help Print help (see more with ' --help' )
54+ -V, --version Print version
5555
5656Repository: https://github.com/open-rust-initiative/sensleak-rs
5757` ` `
5858
59- Examples: (Test repo: https://github.com/sonichen/TestGitOperation)
59+ Examples:
6060
6161` ` ` shell
62- sensleak --repo=" D:/Workplace/Git/ TestGitOperation" --commit= " 8bdca802af0514ce29947e20c6be1719974ad866 " - v --pretty
62+ sensleak --repo=" https://github.com/sonichen/ TestGitOperation.git " -v --pretty --commit= " 140cef166cd8ba98201d9cad80289a75cd590cec "
6363` ` `
6464
6565Output:
6666
6767` ` ` shell
68- [INFO][2023-05-26 11:51:04] Open repo ...
68+ [INFO][2023-06-01 09:16:02] Clone repo ...
6969[
7070 Leak {
7171 line: " twilio_api_key = SK12345678901234567890123456789012" ,
7272 line_number: 6,
73- secret: " api_key = SK12345678901234567890123456789012" ,
74- entropy: " 3.5" ,
75- commit: " 8bdca802af0514ce29947e20c6be1719974ad866" ,
73+ offender: " api_key = SK12345678901234567890123456789012" ,
74+ commit: " 140cef166cd8ba98201d9cad80289a75cd590cec" ,
7675 repo: " TestGitOperation" ,
7776 rule: " Generic API Key" ,
78- commit_message: " test\n " ,
77+ commit_message: " Merge pull request #1 from sonichen/secret\n\nSecret " ,
7978 author: " sonichen" ,
80- email: " 1606673007@qq .com" ,
79+ 8180 file: " /src/key.java" ,
82- date: " 2023-05-23 23:55:12 -08:00" ,
81+ date: " 2023-05-27 04:28:55 -08:00" ,
8382 tags: " " ,
8483 operation: " addition" ,
8584 },
86- ...
8785 Leak {
88- line: " twilio_api_key = SK12345678901234567890123456789012" ,
89- line_number: 2,
90- secret: " SK12345678901234567890123456789012" ,
91- entropy: " " ,
92- commit: " 8bdca802af0514ce29947e20c6be1719974ad866" ,
86+ line: " Vault Service Token = hvs.abcdefghijklmn1234567890opqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ" ,
87+ line_number: 8,
88+ offender: " Token = hvs.abcdefghijklmn1234567890opqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ" ,
89+ commit: " 140cef166cd8ba98201d9cad80289a75cd590cec" ,
9390 repo: " TestGitOperation" ,
94- rule: " Twilio API Key" ,
95- commit_message: " test\n " ,
91+ rule: " Generic API Key" ,
92+ commit_message: " Merge pull request #1 from sonichen/secret\n\nSecret " ,
9693 author: " sonichen" ,
97- email: " 1606673007@qq .com" ,
98- file: " /src/mykey .java" ,
99- date: " 2023-05-23 23:55:12 -08:00" ,
94+ 95+ file: " /src/key .java" ,
96+ date: " 2023-05-27 04:28:55 -08:00" ,
10097 tags: " " ,
10198 operation: " addition" ,
10299 },
100+ Leak {
101+ line: " 网址 = https://hooks.slack.com/workflows/B01234567/T01234567/abcdefghijklmnopqrstuvwx" ,
102+ line_number: 7,
103+ offender: " https://hooks.slack.com/workflows/B01234567/T01234567/abcdefghijklmnopqrstuvwx" ,
104+ commit: " 140cef166cd8ba98201d9cad80289a75cd590cec" ,
105+ repo: " TestGitOperation" ,
106+ rule: " Slack Webhook" ,
107+ commit_message: " Merge pull request #1 from sonichen/secret\n\nSecret" ,
108+ author: " sonichen" ,
109+ 110+ file: " /src/key.java" ,
111+ date: " 2023-05-27 04:28:55 -08:00" ,
112+ tags: " " ,
113+ operation: " addition" ,
114+ },
115+ ...
103116]
104- [WARN][2023-05-26 11:51:05]10 leaks detected. 1 commits scanned in 1.7318395s
105-
106- ` ` `
107-
108-
117+ [WARN][2023-06-01 09:16:03]10 leaks detected. 1 commits scanned in 1.6758691s
109118
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
118119` ` `
119120
120121
0 commit comments