-
Notifications
You must be signed in to change notification settings - Fork 596
refactor(eva): registry and expose profile selection + chore(cli): drop deprecated profile flag #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(eva): registry and expose profile selection + chore(cli): drop deprecated profile flag #122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,4 @@ __debug_bin | |
| /pkg/tool/kubectl/assets/ | ||
|
|
||
| /cdk | ||
| .cache/ | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,10 +59,12 @@ func ParseCDKMain() bool { | |||||||||
| // docopt argparse start | ||||||||||
| parseDocopt() | ||||||||||
|
|
||||||||||
| if Args["auto-escape"].(bool) { | ||||||||||
| plugin.RunSingleTask("auto-escape") | ||||||||||
| return true | ||||||||||
| } | ||||||||||
| // delete auto-escape | ||||||||||
|
|
||||||||||
| // if Args["auto-escape"].(bool) { | ||||||||||
| // plugin.RunSingleTask("auto-escape") | ||||||||||
| // return true | ||||||||||
| // } | ||||||||||
|
|
||||||||||
|
Comment on lines
+64
to
68
|
||||||||||
| // if Args["auto-escape"].(bool) { | |
| // plugin.RunSingleTask("auto-escape") | |
| // return true | |
| // } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ type testArgsCase struct { | |
| successStr string | ||
| } | ||
|
|
||
| const parseTimeout = 5 * time.Second | ||
|
|
||
| func doParseCDKMainWithTimeout() { | ||
|
|
||
| result := make(chan bool, 1) | ||
|
|
@@ -43,8 +45,8 @@ func doParseCDKMainWithTimeout() { | |
| }() | ||
|
|
||
| select { | ||
| case <-time.After(time.Second * 2): | ||
| log.Println("check run ok, timeout in 2s, and return.") | ||
| case <-time.After(parseTimeout): | ||
| log.Printf("check run ok, timeout reached in %s, and return.", parseTimeout) | ||
| return | ||
| case <-result: | ||
| return | ||
|
|
@@ -64,6 +66,11 @@ func TestParseCDKMain(t *testing.T) { | |
| args: []string{"./cdk_cli_path", "eva"}, | ||
| successStr: "current user", | ||
| }, | ||
| // { | ||
| // name: "./cdk eva --profile=additional", | ||
| // args: []string{"./cdk_cli_path", "eva", "--profile=additional"}, | ||
| // successStr: "randomize_va_space", | ||
| // }, | ||
|
Comment on lines
+69
to
+73
|
||
| { | ||
| name: "./cdk run test-poc", | ||
| args: []string{"./cdk_cli_path", "run", "test-poc"}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| package evaluate | ||
|
|
||
| var ( | ||
| CategorySystemInfo = CategorySpec{ | ||
| ID: "information.system", | ||
| Title: "Information Gathering - System Info", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 100, | ||
| } | ||
| CategoryServices = CategorySpec{ | ||
| ID: "information.services", | ||
| Title: "Information Gathering - Services", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 200, | ||
| } | ||
| CategoryCommands = CategorySpec{ | ||
| ID: "information.commands", | ||
| Title: "Information Gathering - Commands and Capabilities", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 300, | ||
| } | ||
| CategoryMounts = CategorySpec{ | ||
| ID: "information.mounts", | ||
| Title: "Information Gathering - Mounts", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 400, | ||
| } | ||
| CategoryNetNamespace = CategorySpec{ | ||
| ID: "information.netns", | ||
| Title: "Information Gathering - Net Namespace", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 500, | ||
| } | ||
| CategorySysctl = CategorySpec{ | ||
| ID: "information.sysctl", | ||
| Title: "Information Gathering - Sysctl Variables", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 600, | ||
| } | ||
| CategoryDNS = CategorySpec{ | ||
| ID: "information.dns", | ||
| Title: "Information Gathering - DNS-Based Service Discovery", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 700, | ||
| } | ||
| CategoryK8sAPIServer = CategorySpec{ | ||
| ID: "discovery.k8s_api", | ||
| Title: "Discovery - K8s API Server", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 800, | ||
| } | ||
| CategoryK8sServiceAccount = CategorySpec{ | ||
| ID: "discovery.k8s_sa", | ||
| Title: "Discovery - K8s Service Account", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 900, | ||
| } | ||
| CategoryCloudMetadata = CategorySpec{ | ||
| ID: "discovery.cloud_metadata", | ||
| Title: "Discovery - Cloud Provider Metadata API", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 1000, | ||
| } | ||
| CategoryKernel = CategorySpec{ | ||
| ID: "exploit.kernel", | ||
| Title: "Exploit Pre - Kernel Exploits", | ||
| DefaultProfiles: []string{ProfileBasic, ProfileExtended}, | ||
| Order: 1100, | ||
| } | ||
| CategorySensitiveFiles = CategorySpec{ | ||
| ID: "information.sensitive_files", | ||
| Title: "Information Gathering - Sensitive Files", | ||
| DefaultProfiles: []string{ProfileExtended, ProfileAdditional}, | ||
| Order: 1200, | ||
| } | ||
| CategoryASLR = CategorySpec{ | ||
| ID: "information.aslr", | ||
| Title: "Information Gathering - ASLR", | ||
| DefaultProfiles: []string{ProfileExtended, ProfileAdditional}, | ||
| Order: 1300, | ||
| } | ||
| CategoryCgroups = CategorySpec{ | ||
| ID: "information.cgroups", | ||
| Title: "Information Gathering - Cgroups", | ||
| DefaultProfiles: []string{ProfileExtended, ProfileAdditional}, | ||
| Order: 1400, | ||
| } | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The usage examples show 'cdk eva' and 'cdk eva --full' before 'cdk evaluate [--full]', but the new --profile flag is only documented in the Options section. Consider adding a usage example like 'cdk eva --profile=extended' to demonstrate the new feature.