mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
logging
This commit is contained in:
1 parent
a77b6e4f8b
commit
5d924ecc53
2 files changed
+6
-4
No files matched your search
@@ -21,12 +21,14 @@ type LeakElem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func start(opts *Options) {
|
func start(opts *Options) {
|
||||||
|
fmt.Printf("\nEvaluating \x1b[37;1m%s\x1b[0m...\n", opts.RepoURL)
|
||||||
c := make(chan os.Signal, 2)
|
c := make(chan os.Signal, 2)
|
||||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
err := exec.Command("git", "clone", opts.RepoURL).Run()
|
err := exec.Command("git", "clone", opts.RepoURL).Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to clone repo %v", err)
|
log.Printf("failed to clone repo %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
repoName := getLocalRepoName(opts.RepoURL)
|
repoName := getLocalRepoName(opts.RepoURL)
|
||||||
if err = os.Chdir(repoName); err != nil {
|
if err = os.Chdir(repoName); err != nil {
|
||||||
@@ -39,6 +41,9 @@ func start(opts *Options) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
report := getLeaks(repoName)
|
report := getLeaks(repoName)
|
||||||
|
if len(report) == 0 {
|
||||||
|
fmt.Printf("No Leaks detected for \x1b[35;2m%s\x1b[0m...\n\n", opts.RepoURL)
|
||||||
|
}
|
||||||
cleanup(repoName)
|
cleanup(repoName)
|
||||||
reportJSON, _ := json.MarshalIndent(report, "", "\t")
|
reportJSON, _ := json.MarshalIndent(report, "", "\t")
|
||||||
err = ioutil.WriteFile(fmt.Sprintf("%s_leaks.json", repoName), reportJSON, 0644)
|
err = ioutil.WriteFile(fmt.Sprintf("%s_leaks.json", repoName), reportJSON, 0644)
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ func main() {
|
|||||||
start(opts)
|
start(opts)
|
||||||
} else if opts.UserURL != "" || opts.OrgURL != "" {
|
} else if opts.UserURL != "" || opts.OrgURL != "" {
|
||||||
repoList := repoScan(opts)
|
repoList := repoScan(opts)
|
||||||
fmt.Println(repoList)
|
|
||||||
for _, repo := range repoList {
|
for _, repo := range repoList {
|
||||||
fmt.Println("yoo")
|
|
||||||
fmt.Println(opts.RepoURL)
|
|
||||||
opts.RepoURL = repo.RepoURL
|
opts.RepoURL = repo.RepoURL
|
||||||
start(opts)
|
start(opts)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user