-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Quoc Trung Hoang <[email protected]>
- Loading branch information
1 parent
ef44338
commit 15ac72e
Showing
14 changed files
with
753 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/ichbinfrog/excavator/pkg/scan" | ||
"github.com/rs/zerolog/log" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var fsScanCmd = &cobra.Command{ | ||
Use: "fsScan", | ||
Short: "scan a directory in the filesystem", | ||
Long: `Command to scan a local directory in the filesystem. | ||
Will loop through each file to verify for possible password, | ||
access tokens (JWT, aws, gcp, ...) leaks.`, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
log.Debug(). | ||
Str("repo", args[0]). | ||
Str("rules", rules). | ||
Str("format", format). | ||
Int("concurrent", concurrent). | ||
Msg("Scan initiated with configuration") | ||
|
||
s := &scan.FsScanner{} | ||
|
||
if format == "yaml" { | ||
s.New(args[0], rules, &scan.YamlReport{}, true) | ||
} else { | ||
s.New(args[0], rules, &scan.HTMLReport{}, true) | ||
} | ||
s.Scan(concurrent) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(fsScanCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/ichbinfrog/excavator/pkg/scan" | ||
"github.com/rs/zerolog/log" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var gitScanCmd = &cobra.Command{ | ||
Use: "gitScan", | ||
Short: "scan a git repository", | ||
Long: `Command to scan a local or remote git repository. | ||
Will loop through each commit to verify for possible password, | ||
access tokens (JWT, aws, gcp, ...) leaks.`, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
log.Debug(). | ||
Str("path", path). | ||
Str("repo", args[0]). | ||
Str("rules", rules). | ||
Str("format", format). | ||
Int("concurrent", concurrent). | ||
Msg("Scan initiated with configuration") | ||
|
||
s := &scan.GitScanner{} | ||
|
||
if format == "yaml" { | ||
s.New(args[0], path, rules, &scan.YamlReport{}, true) | ||
} else { | ||
s.New(args[0], path, rules, &scan.HTMLReport{}, true) | ||
} | ||
s.Scan(concurrent) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(gitScanCmd) | ||
gitScanCmd.PersistentFlags().StringVarP(&path, "path", "p", ".", "temporary local path to store the git repository (only applies to remote repository)") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.