@@ -11,6 +11,7 @@ import (
1111
1212var inputDir string
1313var outputDir string
14+ var Sendnotify string
1415
1516// vulnCmd represents the vuln command
1617var vulnCmd = & cobra.Command {
@@ -21,7 +22,7 @@ and saves the results in the specified output directory.
2122
2223Examples:
2324$ gitrepoenum vuln
24- $ gitrepoenum vuln -i ~/allgithubrepo/commits -o ~/allgithubrepo/commits` ,
25+ $ gitrepoenum vuln -i ~/allgithubrepo/commits -o ~/allgithubrepo/commits --id gitleaks ` ,
2526 Run : func (cmd * cobra.Command , args []string ) {
2627 // Validate input and output directories
2728 if inputDir == "" || outputDir == "" {
@@ -65,6 +66,15 @@ $ gitrepoenum vuln -i ~/allgithubrepo/commits -o ~/allgithubrepo/commits`,
6566 }
6667
6768 fmt .Printf ("[Scanned] %s and saved results to %s\n " , repoPath , trufflehogOutputFile )
69+
70+ // Send verified vulnerabilities to Discord
71+ notifyCmd := exec .Command (
72+ "bash" , "-c" ,
73+ fmt .Sprintf (`cat %s | jq -r 'select(.Verified==true) | "\(.DetectorName):\(.Raw)"' | notify -duc -silent -id %s &>/dev/null` , trufflehogOutputFile , Sendnotify ),
74+ )
75+ if err := notifyCmd .Run (); err != nil {
76+ fmt .Printf ("Failed to send Discord notification for %s: %v\n " , repoPath , err )
77+ }
6878 }
6979 return nil
7080 })
@@ -81,4 +91,5 @@ func init() {
8191 // Define flags for input and output directories
8292 vulnCmd .Flags ().StringVarP (& inputDir , "input" , "i" , filepath .Join (os .Getenv ("HOME" ), "allgithubrepo" , "commits" ), "Input directory containing repositories code" )
8393 vulnCmd .Flags ().StringVarP (& outputDir , "output" , "o" , filepath .Join (os .Getenv ("HOME" ), "allgithubrepo" , "commits" ), "Output directory for vulnerability reports" )
94+ vulnCmd .Flags ().StringVar (& Sendnotify , "id" , "" , "Send verified vulnerabilities to Discord (required)" )
8495}
0 commit comments