Skip to content

Commit

Permalink
fix cdk-team#37 (eva): add eva args to docopt
Browse files Browse the repository at this point in the history
  • Loading branch information
neargle committed Feb 27, 2022
1 parent 25b66b1 commit b22f683
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/cdk/cdk.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
_ "github.com/cdk-team/CDK/pkg/exploit" // register all exploits
_ "github.com/cdk-team/CDK/pkg/task" // register all task
"github.com/cdk-team/CDK/pkg/cli"
_ "github.com/cdk-team/CDK/pkg/exploit" // register all exploits
_ "github.com/cdk-team/CDK/pkg/task" // register all task
)

func main() {
Expand Down
7 changes: 5 additions & 2 deletions pkg/cli/banner.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cli

import (
"github.com/docopt/docopt-go"
"log"
"os"

"github.com/docopt/docopt-go"
)

var BannerVersion = "cdk v0.1.10"
Expand All @@ -16,12 +17,14 @@ Find tutorial, configuration and use-case in https://github.com/cdk-team/CDK/wik
var BannerContainer = BannerHeader + `
Usage:
cdk evaluate [--full]
cdk eva [--full]
cdk run (--list | <exploit> [<args>...])
cdk auto-escape <cmd>
cdk <tool> [<args>...]
Evaluate:
cdk evaluate Gather information to find weakness inside container.
cdk eva Alias of "cdk evaluate".
cdk evaluate --full Enable file scan during information gathering.
Exploit:
Expand Down Expand Up @@ -66,7 +69,7 @@ var Args docopt.Opts
func parseDocopt() {
args, err := docopt.ParseArgs(BannerContainer, os.Args[1:], BannerVersion)
if err != nil {
log.Fatalln("docopt err: ",err)
log.Fatalln("docopt err: ", err)
}
Args = args
}
10 changes: 6 additions & 4 deletions pkg/cli/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ func ParseCDKMain() {
return
}

// support for cdk eval and cdk evaluate
_, fok := Args["evaluate"]
_, ok := Args["eval"]
// support for cdk eva(Evangelion) and cdk evaluate
fok := Args["evaluate"]
ok := Args["eva"]

if ok || fok {
// docopt let fok = true, so we need to check it
// fix #37 https://github.com/cdk-team/CDK/issues/37
if ok.(bool) || fok.(bool) {

fmt.Printf("\n[Information Gathering - System Info]\n")
evaluate.BasicSysInfo()
Expand Down

0 comments on commit b22f683

Please sign in to comment.