[update] seems to be working with concurrency upgrades... do some timing

This commit is contained in:
zricethezav committed 2018-01-30 18:12:31 -06:00
1 parent 06b3a9b4e7
commit 61c4987cd2
2 files changed
+109 -53

No files matched your search

+30 -21
View File
@@ -3,38 +3,47 @@ package main
import (
"fmt"
"github.com/nbutton23/zxcvbn-go"
"log"
"os"
"os/exec"
"strings"
)
// checkDiff operates on a single diff between to chronological commits
func checkDiff(commit1 string, commit2 string) []string {
var leakPrs bool
var leaks []string
_, seen := cache[commit1+commit2]
if seen {
fmt.Println("WE HAVE SEEN THIS")
return []string{}
func checkDiff(commit1 string, commit2 string, repoName string) []string {
// var leakPrs bool
// var leaks []string
// _, seen := cache[commit1+commit2]
// if seen {
// fmt.Println("WE HAVE SEEN THIS")
// return []string{}
// }
if err := os.Chdir(fmt.Sprintf("%s/%s", appRoot, repoName)); err != nil {
log.Fatal(err)
}
out, err := exec.Command("git", "diff", commit1, commit2).Output()
cmd := exec.Command("git", "diff", commit1, commit2)
_, err := cmd.Output()
// fmt.Println(string(out))
if err != nil {
return []string{}
}
return []string{}
cache[commit1+commit2] = true
lines := checkRegex(string(out))
if len(lines) == 0 {
return []string{}
}
for _, line := range lines {
leakPrs = checkEntropy(line)
if leakPrs {
leaks = append(leaks, line)
}
}
return leaks
// cache[commit1+commit2] = true
// lines := checkRegex(string(out))
// if len(lines) == 0 {
// return []string{}
// }
//
// for _, line := range lines {
// leakPrs = checkEntropy(line)
// if leakPrs {
// leaks = append(leaks, line)
// }
// }
// return leaks
}
// check each line of a diff and see if there are any potential secrets