-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hahwul/authz0/pkg/scan" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var cookie, scanRolename string | ||
var headers []string | ||
|
||
// scanCmd represents the scan command | ||
var scanCmd = &cobra.Command{ | ||
Use: "scan", | ||
Use: "scan <filename>", | ||
Short: "Scanning", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("scan called") | ||
scanArguments := scan.ScanArguments{ | ||
RoleName: scanRolename, | ||
Cookie: cookie, | ||
Headers: headers, | ||
} | ||
if len(args) >= 1 { | ||
scan.Run(args[0], scanArguments) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(scanCmd) | ||
scanCmd.PersistentFlags().StringVarP(&cookie, "cookie", "c", "", "Cookie value of this test case") | ||
scanCmd.PersistentFlags().StringVarP(&scanRolename, "rolename", "r", "", "Role name of this test case") | ||
scanCmd.PersistentFlags().StringSliceVarP(&headers, "header", "H", []string{}, "Headers of this test case") | ||
} |
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,13 @@ | ||
package scan | ||
|
||
type ScanArguments struct { | ||
RoleName string | ||
Cookie string | ||
Headers []string | ||
} | ||
|
||
func Run(filename string, arguments ScanArguments), { | ||
template := authz0.FileToTemplate(filename) | ||
_ = template | ||
// TODO: Add scanning logic | ||
} |