main.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package main
  2. import (
  3. "os"
  4. "regexp"
  5. )
  6. var (
  7. appRoot string
  8. regexes map[string]*regexp.Regexp
  9. assignRegex *regexp.Regexp
  10. report []LeakElem
  11. )
  12. const AWS_KEY = "AKIALALEMEL33243OLIAE"
  13. const AWS_SECRET = "99432bfewaf823ec3294e231"
  14. func init() {
  15. appRoot, _ = os.Getwd()
  16. // TODO update regex to look for things like:
  17. // TODO ability to add/filter regex
  18. // client("AKAI32fJ334...",
  19. regexes = map[string]*regexp.Regexp{
  20. "github": regexp.MustCompile(`[g|G][i|I][t|T][h|H][u|U][b|B].*(=|:|:=|<-).*\w+.*`),
  21. "aws": regexp.MustCompile(`[a|A][w|W][s|S].*(=|:=|:|<-).*\w+.*`),
  22. "heroku": regexp.MustCompile(`[h|H][e|E][r|R][o|O][k|K][u|U].*(=|:=|:|<-).*\w+.*`),
  23. "facebook": regexp.MustCompile(`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*(=|:=|:|<-).*\w+.*`),
  24. "twitter": regexp.MustCompile(`[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*(=|:=|:|<-).*\w+.*`),
  25. "reddit": regexp.MustCompile(`[r|R][e|E][d|D][d|D][i|I][t|T].*(=|:=|:|<-).*\w+.*`),
  26. "twilio": regexp.MustCompile(`[t|T][w|W][i|I][l|L][i|I][o|O].*(=|:=|:|<-).*\w+.*`),
  27. }
  28. assignRegex = regexp.MustCompile(`(=|:|:=|<-)`)
  29. }
  30. func main() {
  31. args := os.Args[2:]
  32. repoUrl := os.Args[1]
  33. opts := parseOptions(args, repoUrl)
  34. start(opts, repoUrl)
  35. }