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/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Type definitions mirroring the MemShellParty backend DTOs.
|
|
5
|
-
* Source of truth:
|
|
5
|
+
* Source of truth: memshell-party-{api,boot} (v3), with legacy v2 transport support.
|
|
6
6
|
*/
|
|
7
7
|
interface ShellConfig {
|
|
8
8
|
server: string;
|
|
@@ -15,15 +15,31 @@ interface ShellConfig {
|
|
|
15
15
|
byPassJavaModule?: boolean;
|
|
16
16
|
shrink?: boolean;
|
|
17
17
|
lambdaSuffix?: boolean;
|
|
18
|
-
|
|
18
|
+
/** v3 uses a ProbeConfig object; v2 used a boolean switch. */
|
|
19
|
+
probe?: boolean | ProbeConfig;
|
|
20
|
+
obfuscation?: ObfuscationConfig;
|
|
21
|
+
obfuscationScope?: "ALL" | "MEMSHELL_INJECTOR" | "INJECTOR" | "MEMSHELL";
|
|
19
22
|
}
|
|
23
|
+
type ShellToolConfigObject = Record<string, unknown>;
|
|
24
|
+
type ShellToolConfigValue = string | ShellToolConfigObject;
|
|
20
25
|
interface ShellToolConfig {
|
|
26
|
+
[key: string]: ShellToolConfigValue | undefined;
|
|
21
27
|
shellClassName?: string;
|
|
28
|
+
pass?: string;
|
|
29
|
+
key?: string;
|
|
30
|
+
paramName?: string;
|
|
31
|
+
template?: string;
|
|
32
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
22
33
|
godzillaPass?: string;
|
|
34
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
23
35
|
godzillaKey?: string;
|
|
36
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
24
37
|
commandParamName?: string;
|
|
38
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
25
39
|
commandTemplate?: string;
|
|
40
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
26
41
|
behinderPass?: string;
|
|
42
|
+
/** @deprecated MemShellParty v2 request field. */
|
|
27
43
|
antSwordPass?: string;
|
|
28
44
|
headerName?: string;
|
|
29
45
|
headerValue?: string;
|
|
@@ -36,6 +52,10 @@ interface InjectorConfig {
|
|
|
36
52
|
urlPattern?: string;
|
|
37
53
|
staticInitialize?: boolean;
|
|
38
54
|
}
|
|
55
|
+
interface ObfuscationConfig {
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
options?: Record<string, unknown>;
|
|
58
|
+
}
|
|
39
59
|
interface MemShellGenerateRequest {
|
|
40
60
|
shellConfig: ShellConfig;
|
|
41
61
|
shellToolConfig: ShellToolConfig;
|
|
@@ -59,18 +79,20 @@ interface MemShellGenerateResponse {
|
|
|
59
79
|
packResult?: string;
|
|
60
80
|
allPackResults?: Record<string, string>;
|
|
61
81
|
}
|
|
62
|
-
type ProbeMethod = "ResponseBody" | "DNSLog" | "Sleep";
|
|
63
|
-
type ProbeContent = "BasicInfo" | "Server" | "OS" | "JDK" | "Bytecode" | "Command";
|
|
82
|
+
type ProbeMethod = "ResponseBody" | "ResponseHeader" | "DNSLog" | "Sleep";
|
|
83
|
+
type ProbeContent = "BasicInfo" | "Server" | "OS" | "JDK" | "Bytecode" | "Command" | "ScriptEngine" | "Filter";
|
|
64
84
|
interface ProbeConfig {
|
|
65
85
|
probeMethod: string;
|
|
66
86
|
probeContent: string;
|
|
67
87
|
shellClassName?: string;
|
|
88
|
+
respHeaderName?: string;
|
|
68
89
|
targetJreVersion?: number;
|
|
69
90
|
debug?: boolean;
|
|
70
91
|
byPassJavaModule?: boolean;
|
|
71
92
|
shrink?: boolean;
|
|
72
93
|
staticInitialize?: boolean;
|
|
73
94
|
lambdaSuffix?: boolean;
|
|
95
|
+
obfuscation?: ObfuscationConfig;
|
|
74
96
|
}
|
|
75
97
|
interface ProbeContentConfig {
|
|
76
98
|
host?: string;
|
|
@@ -79,6 +101,7 @@ interface ProbeContentConfig {
|
|
|
79
101
|
server?: string;
|
|
80
102
|
reqParamName?: string;
|
|
81
103
|
commandTemplate?: string;
|
|
104
|
+
respHeaderName?: string;
|
|
82
105
|
}
|
|
83
106
|
interface ProbeShellGenerateRequest {
|
|
84
107
|
probeConfig: ProbeConfig;
|
|
@@ -97,6 +120,30 @@ interface ProbeShellGenerateResponse {
|
|
|
97
120
|
packResult?: string;
|
|
98
121
|
allPackResults?: Record<string, string>;
|
|
99
122
|
}
|
|
123
|
+
interface BytecodeResult {
|
|
124
|
+
className: string;
|
|
125
|
+
size: number;
|
|
126
|
+
classBytesBase64Str: string;
|
|
127
|
+
}
|
|
128
|
+
interface BytecodeTransformRequest {
|
|
129
|
+
classBytesBase64: string;
|
|
130
|
+
packer?: string;
|
|
131
|
+
byPassJavaModule?: boolean;
|
|
132
|
+
staticInitialize?: boolean;
|
|
133
|
+
shrink?: boolean;
|
|
134
|
+
renamePackage?: boolean;
|
|
135
|
+
relocateFrom?: string;
|
|
136
|
+
relocateTo?: string;
|
|
137
|
+
entryMethod?: string;
|
|
138
|
+
newClassName?: string;
|
|
139
|
+
randomName?: boolean;
|
|
140
|
+
obfuscation?: ObfuscationConfig;
|
|
141
|
+
server?: string;
|
|
142
|
+
probe?: ProbeConfig | null;
|
|
143
|
+
}
|
|
144
|
+
interface BytecodeTransformResponse extends BytecodeResult {
|
|
145
|
+
packResult?: string;
|
|
146
|
+
}
|
|
100
147
|
/** server name -> supported shell types */
|
|
101
148
|
type ServerConfig = Record<string, string[]>;
|
|
102
149
|
/** server name -> { shell tool -> supported shell types } */
|
|
@@ -110,6 +157,41 @@ interface CommandConfigVO {
|
|
|
110
157
|
encryptors: string[];
|
|
111
158
|
implementationClasses: string[];
|
|
112
159
|
}
|
|
160
|
+
interface ToolConfigParam {
|
|
161
|
+
name: string;
|
|
162
|
+
type: "string" | "enum" | "object";
|
|
163
|
+
options: string[];
|
|
164
|
+
group?: string;
|
|
165
|
+
label?: string;
|
|
166
|
+
placeholder?: string;
|
|
167
|
+
ui?: RemoteSelectUiHint;
|
|
168
|
+
}
|
|
169
|
+
interface ToolConfigDescriptor {
|
|
170
|
+
tool: string;
|
|
171
|
+
params: ToolConfigParam[];
|
|
172
|
+
}
|
|
173
|
+
type ObfuscationOption = Record<string, unknown>;
|
|
174
|
+
interface RemoteSelectUiHint {
|
|
175
|
+
kind: "remote-select";
|
|
176
|
+
urlQueryParam: string;
|
|
177
|
+
itemsPath: string;
|
|
178
|
+
labelPath: string;
|
|
179
|
+
valuePath?: string;
|
|
180
|
+
required: boolean;
|
|
181
|
+
}
|
|
182
|
+
interface PluginDescriptor {
|
|
183
|
+
jarFileName: string;
|
|
184
|
+
name: string;
|
|
185
|
+
version?: string | null;
|
|
186
|
+
author?: string | null;
|
|
187
|
+
description?: string | null;
|
|
188
|
+
homepage?: string | null;
|
|
189
|
+
license?: string | null;
|
|
190
|
+
source?: string | null;
|
|
191
|
+
spiServices: string[];
|
|
192
|
+
loaded: boolean;
|
|
193
|
+
loadError?: string | null;
|
|
194
|
+
}
|
|
113
195
|
interface VersionInfo {
|
|
114
196
|
currentVersion: string;
|
|
115
197
|
latestVersion: string;
|
|
@@ -143,23 +225,25 @@ declare class MemPartyClient {
|
|
|
143
225
|
private readonly baseUrl;
|
|
144
226
|
private readonly fetchImpl;
|
|
145
227
|
private readonly timeoutMs;
|
|
228
|
+
private generationApiVersion?;
|
|
146
229
|
constructor(options: MemPartyClientOptions);
|
|
147
230
|
getServers(): Promise<ServerConfig>;
|
|
148
231
|
getConfig(): Promise<MainConfig>;
|
|
149
232
|
getPackerTree(): Promise<PackerTree>;
|
|
150
233
|
getPackers(): Promise<string[]>;
|
|
151
234
|
getCommandConfigs(): Promise<CommandConfigVO>;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
* server list when this endpoint 404s.
|
|
156
|
-
*/
|
|
157
|
-
getProbeResponseBodyServers(): Promise<string[]>;
|
|
235
|
+
getShellToolConfigs(): Promise<ToolConfigDescriptor[]>;
|
|
236
|
+
getObfuscationOptions(): Promise<ObfuscationOption[]>;
|
|
237
|
+
getProbeResponseServers(): Promise<string[]>;
|
|
158
238
|
getVersion(): Promise<VersionInfo>;
|
|
239
|
+
getPlugins(): Promise<PluginDescriptor[]>;
|
|
159
240
|
generateMemShell(req: MemShellGenerateRequest): Promise<MemShellGenerateResponse>;
|
|
241
|
+
private getGenerationApiVersion;
|
|
160
242
|
generateProbe(req: ProbeShellGenerateRequest): Promise<ProbeShellGenerateResponse>;
|
|
161
243
|
/** Parse a fully-qualified class name from a base64-encoded .class file. */
|
|
162
244
|
parseClassName(classBase64: string): Promise<string>;
|
|
245
|
+
decodeBytecode(classBase64: string): Promise<BytecodeResult>;
|
|
246
|
+
transformBytecode(req: BytecodeTransformRequest): Promise<BytecodeTransformResponse>;
|
|
163
247
|
private request;
|
|
164
248
|
}
|
|
165
249
|
|
|
@@ -176,7 +260,12 @@ interface MemShellOptions {
|
|
|
176
260
|
shrink?: boolean;
|
|
177
261
|
lambdaSuffix?: boolean;
|
|
178
262
|
probe?: boolean;
|
|
263
|
+
obfuscate?: boolean;
|
|
264
|
+
obfuscationOptions?: Record<string, unknown>;
|
|
265
|
+
obfuscationScope?: "ALL" | "MEMSHELL_INJECTOR" | "INJECTOR" | "MEMSHELL";
|
|
179
266
|
shellClassName?: string;
|
|
267
|
+
shellToolConfig?: Record<string, ShellToolConfigValue>;
|
|
268
|
+
shellToolParams?: ToolConfigParam[];
|
|
180
269
|
godzillaPass?: string;
|
|
181
270
|
godzillaKey?: string;
|
|
182
271
|
commandParamName?: string;
|
|
@@ -205,12 +294,15 @@ interface ProbeOptions {
|
|
|
205
294
|
shrink?: boolean;
|
|
206
295
|
staticInitialize?: boolean;
|
|
207
296
|
lambdaSuffix?: boolean;
|
|
297
|
+
obfuscate?: boolean;
|
|
298
|
+
obfuscationOptions?: Record<string, unknown>;
|
|
208
299
|
host?: string;
|
|
209
300
|
seconds?: number;
|
|
210
301
|
sleepServer?: string;
|
|
211
302
|
server?: string;
|
|
212
303
|
reqParamName?: string;
|
|
213
304
|
commandTemplate?: string;
|
|
305
|
+
respHeaderName?: string;
|
|
214
306
|
}
|
|
215
307
|
declare function buildProbeRequest(opts: ProbeOptions): ProbeShellGenerateRequest;
|
|
216
308
|
|
|
@@ -269,6 +361,19 @@ declare const JDK_VERSIONS: Record<string, number>;
|
|
|
269
361
|
*/
|
|
270
362
|
declare function resolveJreVersion(input: string | number | undefined): number | undefined;
|
|
271
363
|
|
|
364
|
+
declare function toolConfigForTool(configs: ToolConfigDescriptor[], tool: string): ToolConfigDescriptor | undefined;
|
|
365
|
+
declare function parseShellToolConfig(assignments: string[] | undefined, params: ToolConfigParam[] | undefined): Record<string, ShellToolConfigValue>;
|
|
366
|
+
declare function parseToolConfigFile(source: string, params: ToolConfigParam[] | undefined): Record<string, ShellToolConfigValue>;
|
|
367
|
+
declare function validateRequiredRemoteOptions(config: Record<string, ShellToolConfigValue>, params: ToolConfigParam[] | undefined): void;
|
|
368
|
+
interface RemoteOption {
|
|
369
|
+
label: string;
|
|
370
|
+
value: ShellToolConfigValue;
|
|
371
|
+
}
|
|
372
|
+
declare function readRemotePath(value: unknown, path: string): unknown;
|
|
373
|
+
declare function normalizeRemoteOptions(payload: unknown, hint: RemoteSelectUiHint, objectMode: boolean): RemoteOption[];
|
|
374
|
+
declare function validateRemoteOptionsUrl(value: string): string;
|
|
375
|
+
declare function fetchRemoteOptions(sourceUrl: string, hint: RemoteSelectUiHint, objectMode: boolean, fetchImpl?: typeof fetch, signal?: AbortSignal): Promise<RemoteOption[]>;
|
|
376
|
+
|
|
272
377
|
type OpCategory = "gen" | "probe" | "connect" | "exec" | "download" | "upload" | "save" | "note" | "remove";
|
|
273
378
|
interface OpLogEntry {
|
|
274
379
|
/** ISO timestamp. */
|
|
@@ -363,6 +468,8 @@ interface CommonConnectOptions {
|
|
|
363
468
|
extraHeaders?: Record<string, string>;
|
|
364
469
|
timeoutMs?: number;
|
|
365
470
|
insecure?: boolean;
|
|
471
|
+
/** Tomcat Upgrade shell protocol: the generated shell's fully-qualified class name. */
|
|
472
|
+
upgradeProtocol?: string;
|
|
366
473
|
}
|
|
367
474
|
|
|
368
475
|
/** A saved shell connection profile, stored inside a project. */
|
|
@@ -377,6 +484,8 @@ interface StoredShell {
|
|
|
377
484
|
insecure?: boolean;
|
|
378
485
|
/** mimic protocol: site profile name (see 'memparty profile'). */
|
|
379
486
|
profile?: string;
|
|
487
|
+
/** Godzilla Upgrade shell protocol (generated shell class name). */
|
|
488
|
+
upgradeProtocol?: string;
|
|
380
489
|
/** Free-form note for this shell (e.g. "DMZ 跳板机"). */
|
|
381
490
|
remark?: string;
|
|
382
491
|
createdAt: string;
|
|
@@ -420,6 +529,7 @@ interface ConnectionFlags {
|
|
|
420
529
|
extraHeaders?: Record<string, string>;
|
|
421
530
|
insecure?: boolean;
|
|
422
531
|
profile?: string;
|
|
532
|
+
upgradeProtocol?: string;
|
|
423
533
|
}
|
|
424
534
|
interface ResolvedConnection {
|
|
425
535
|
url: string;
|
|
@@ -432,6 +542,7 @@ interface ResolvedConnection {
|
|
|
432
542
|
insecure?: boolean;
|
|
433
543
|
/** mimic protocol: site profile name. */
|
|
434
544
|
profile?: string;
|
|
545
|
+
upgradeProtocol?: string;
|
|
435
546
|
/** Canonical `project/shell` reference, when resolved from the store. */
|
|
436
547
|
targetName?: string;
|
|
437
548
|
}
|
|
@@ -758,4 +869,4 @@ declare function testSuo5(url: string, options?: Suo5ConnectOptions): Promise<Co
|
|
|
758
869
|
|
|
759
870
|
declare const CLI_VERSION: string;
|
|
760
871
|
|
|
761
|
-
export { ApiError, type ApiErrorResponse, type BehinderConnectOptions, type BuildDeps, CLI_VERSION, type CommandConfigVO, type CommonConnectOptions, type ConnectTestResult, type ConnectTool, type ConnectionFlags, type CustomBuildInput, type CustomBuildResult, DEFAULT_API_URL, ENV_VAR, type ExecResult, type FetchLike, type FilterTemplateOptions, type GenerateClient, type GodzillaExecOptions, type InjectorConfig, type InstallSkillOptions, JDK_VERSIONS, LEGACY_CIPHER, type MainConfig, MemPartyClient, type MemPartyClientOptions, type MemShellGenerateRequest, type MemShellGenerateResponse, type MemShellOptions, type MemShellResult, type MimicCipher, OUTPUT_LIMIT, type OpCategory, type OpFilter, type OpLogEntry, type OutputOptions, type OutputResult, type PackerOption, type PackerTree, type ProbeConfig, type ProbeContent, type ProbeContentConfig, type ProbeMethod, type ProbeOptions, type ProbeShellGenerateRequest, type ProbeShellGenerateResponse, type ProbeShellResult, type ResolvedConnection, SKILL_NAME, type ServerConfig, type ShellConfig, type ShellInput, type ShellToolConfig, type SkillInstallResult, type SkillScope, type StoredProject, type StoredShell, type Suo5ConnectOptions, type Suo5Mode, type VersionInfo, autoSaveShell, buildCustomMemshell, buildMemShellRequest, buildProbeRequest, createMcpServer, defaultClassName, deriveMarkers, emitPayload, execBehinder, execGodzilla, formatOp, getProject, hasJavac, installSkill, listProjects, logOp, marshalFrameBase64, marshalSuo5Map, opLogPath, profileSecretFields, readOps, removeProject, removeShell, renderCryptoProbe, renderFilterJava, resolveApiUrl, resolveCipher, resolveConnection, resolveJreVersion, saveProjectMeta, saveShell, saveShellMeta, shouldDecode, skillSourceDir, skillTargetDir, startMcpStdio, targetStorePath, testBehinder, testGodzilla, testSuo5, truncateOutput, unmarshalFrameBase64, unmarshalSuo5Map };
|
|
872
|
+
export { ApiError, type ApiErrorResponse, type BehinderConnectOptions, type BuildDeps, type BytecodeResult, type BytecodeTransformRequest, type BytecodeTransformResponse, CLI_VERSION, type CommandConfigVO, type CommonConnectOptions, type ConnectTestResult, type ConnectTool, type ConnectionFlags, type CustomBuildInput, type CustomBuildResult, DEFAULT_API_URL, ENV_VAR, type ExecResult, type FetchLike, type FilterTemplateOptions, type GenerateClient, type GodzillaExecOptions, type InjectorConfig, type InstallSkillOptions, JDK_VERSIONS, LEGACY_CIPHER, type MainConfig, MemPartyClient, type MemPartyClientOptions, type MemShellGenerateRequest, type MemShellGenerateResponse, type MemShellOptions, type MemShellResult, type MimicCipher, OUTPUT_LIMIT, type ObfuscationConfig, type ObfuscationOption, type OpCategory, type OpFilter, type OpLogEntry, type OutputOptions, type OutputResult, type PackerOption, type PackerTree, type PluginDescriptor, type ProbeConfig, type ProbeContent, type ProbeContentConfig, type ProbeMethod, type ProbeOptions, type ProbeShellGenerateRequest, type ProbeShellGenerateResponse, type ProbeShellResult, type RemoteOption, type RemoteSelectUiHint, type ResolvedConnection, SKILL_NAME, type ServerConfig, type ShellConfig, type ShellInput, type ShellToolConfig, type ShellToolConfigObject, type ShellToolConfigValue, type SkillInstallResult, type SkillScope, type StoredProject, type StoredShell, type Suo5ConnectOptions, type Suo5Mode, type ToolConfigDescriptor, type ToolConfigParam, type VersionInfo, autoSaveShell, buildCustomMemshell, buildMemShellRequest, buildProbeRequest, createMcpServer, defaultClassName, deriveMarkers, emitPayload, execBehinder, execGodzilla, fetchRemoteOptions, formatOp, getProject, hasJavac, installSkill, listProjects, logOp, marshalFrameBase64, marshalSuo5Map, normalizeRemoteOptions, opLogPath, parseShellToolConfig, parseToolConfigFile, profileSecretFields, readOps, readRemotePath, removeProject, removeShell, renderCryptoProbe, renderFilterJava, resolveApiUrl, resolveCipher, resolveConnection, resolveJreVersion, saveProjectMeta, saveShell, saveShellMeta, shouldDecode, skillSourceDir, skillTargetDir, startMcpStdio, targetStorePath, testBehinder, testGodzilla, testSuo5, toolConfigForTool, truncateOutput, unmarshalFrameBase64, unmarshalSuo5Map, validateRemoteOptionsUrl, validateRequiredRemoteOptions };
|