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/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: boot/src/main/java/com/reajason/javaweb/boot/{dto,vo,controller}
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,28 @@ interface ShellConfig {
15
15
  byPassJavaModule?: boolean;
16
16
  shrink?: boolean;
17
17
  lambdaSuffix?: boolean;
18
- probe?: boolean;
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
  }
20
23
  interface ShellToolConfig {
21
24
  shellClassName?: string;
25
+ pass?: string;
26
+ key?: string;
27
+ paramName?: string;
28
+ template?: string;
29
+ /** @deprecated MemShellParty v2 request field. */
22
30
  godzillaPass?: string;
31
+ /** @deprecated MemShellParty v2 request field. */
23
32
  godzillaKey?: string;
33
+ /** @deprecated MemShellParty v2 request field. */
24
34
  commandParamName?: string;
35
+ /** @deprecated MemShellParty v2 request field. */
25
36
  commandTemplate?: string;
37
+ /** @deprecated MemShellParty v2 request field. */
26
38
  behinderPass?: string;
39
+ /** @deprecated MemShellParty v2 request field. */
27
40
  antSwordPass?: string;
28
41
  headerName?: string;
29
42
  headerValue?: string;
@@ -36,6 +49,10 @@ interface InjectorConfig {
36
49
  urlPattern?: string;
37
50
  staticInitialize?: boolean;
38
51
  }
52
+ interface ObfuscationConfig {
53
+ enabled?: boolean;
54
+ options?: Record<string, unknown>;
55
+ }
39
56
  interface MemShellGenerateRequest {
40
57
  shellConfig: ShellConfig;
41
58
  shellToolConfig: ShellToolConfig;
@@ -59,18 +76,20 @@ interface MemShellGenerateResponse {
59
76
  packResult?: string;
60
77
  allPackResults?: Record<string, string>;
61
78
  }
62
- type ProbeMethod = "ResponseBody" | "DNSLog" | "Sleep";
63
- type ProbeContent = "BasicInfo" | "Server" | "OS" | "JDK" | "Bytecode" | "Command";
79
+ type ProbeMethod = "ResponseBody" | "ResponseHeader" | "DNSLog" | "Sleep";
80
+ type ProbeContent = "BasicInfo" | "Server" | "OS" | "JDK" | "Bytecode" | "Command" | "ScriptEngine" | "Filter";
64
81
  interface ProbeConfig {
65
82
  probeMethod: string;
66
83
  probeContent: string;
67
84
  shellClassName?: string;
85
+ respHeaderName?: string;
68
86
  targetJreVersion?: number;
69
87
  debug?: boolean;
70
88
  byPassJavaModule?: boolean;
71
89
  shrink?: boolean;
72
90
  staticInitialize?: boolean;
73
91
  lambdaSuffix?: boolean;
92
+ obfuscation?: ObfuscationConfig;
74
93
  }
75
94
  interface ProbeContentConfig {
76
95
  host?: string;
@@ -79,6 +98,7 @@ interface ProbeContentConfig {
79
98
  server?: string;
80
99
  reqParamName?: string;
81
100
  commandTemplate?: string;
101
+ respHeaderName?: string;
82
102
  }
83
103
  interface ProbeShellGenerateRequest {
84
104
  probeConfig: ProbeConfig;
@@ -97,6 +117,30 @@ interface ProbeShellGenerateResponse {
97
117
  packResult?: string;
98
118
  allPackResults?: Record<string, string>;
99
119
  }
120
+ interface BytecodeResult {
121
+ className: string;
122
+ size: number;
123
+ classBytesBase64Str: string;
124
+ }
125
+ interface BytecodeTransformRequest {
126
+ classBytesBase64: string;
127
+ packer?: string;
128
+ byPassJavaModule?: boolean;
129
+ staticInitialize?: boolean;
130
+ shrink?: boolean;
131
+ renamePackage?: boolean;
132
+ relocateFrom?: string;
133
+ relocateTo?: string;
134
+ entryMethod?: string;
135
+ newClassName?: string;
136
+ randomName?: boolean;
137
+ obfuscation?: ObfuscationConfig;
138
+ server?: string;
139
+ probe?: ProbeConfig | null;
140
+ }
141
+ interface BytecodeTransformResponse extends BytecodeResult {
142
+ packResult?: string;
143
+ }
100
144
  /** server name -> supported shell types */
101
145
  type ServerConfig = Record<string, string[]>;
102
146
  /** server name -> { shell tool -> supported shell types } */
@@ -110,6 +154,19 @@ interface CommandConfigVO {
110
154
  encryptors: string[];
111
155
  implementationClasses: string[];
112
156
  }
157
+ interface ToolConfigParam {
158
+ name: string;
159
+ type: "string" | "enum";
160
+ options: string[];
161
+ group?: string;
162
+ label?: string;
163
+ placeholder?: string;
164
+ }
165
+ interface ToolConfigDescriptor {
166
+ tool: string;
167
+ params: ToolConfigParam[];
168
+ }
169
+ type ObfuscationOption = Record<string, unknown>;
113
170
  interface VersionInfo {
114
171
  currentVersion: string;
115
172
  latestVersion: string;
@@ -143,23 +200,24 @@ declare class MemPartyClient {
143
200
  private readonly baseUrl;
144
201
  private readonly fetchImpl;
145
202
  private readonly timeoutMs;
203
+ private generationApiVersion?;
146
204
  constructor(options: MemPartyClientOptions);
147
205
  getServers(): Promise<ServerConfig>;
148
206
  getConfig(): Promise<MainConfig>;
149
207
  getPackerTree(): Promise<PackerTree>;
150
208
  getPackers(): Promise<string[]>;
151
209
  getCommandConfigs(): Promise<CommandConfigVO>;
152
- /**
153
- * Servers the ResponseBody probe can write a response on.
154
- * Only exists on backend >= 2.9.0 — callers should fall back to the full
155
- * server list when this endpoint 404s.
156
- */
157
- getProbeResponseBodyServers(): Promise<string[]>;
210
+ getShellToolConfigs(): Promise<ToolConfigDescriptor[]>;
211
+ getObfuscationOptions(): Promise<ObfuscationOption[]>;
212
+ getProbeResponseServers(): Promise<string[]>;
158
213
  getVersion(): Promise<VersionInfo>;
159
214
  generateMemShell(req: MemShellGenerateRequest): Promise<MemShellGenerateResponse>;
215
+ private getGenerationApiVersion;
160
216
  generateProbe(req: ProbeShellGenerateRequest): Promise<ProbeShellGenerateResponse>;
161
217
  /** Parse a fully-qualified class name from a base64-encoded .class file. */
162
218
  parseClassName(classBase64: string): Promise<string>;
219
+ decodeBytecode(classBase64: string): Promise<BytecodeResult>;
220
+ transformBytecode(req: BytecodeTransformRequest): Promise<BytecodeTransformResponse>;
163
221
  private request;
164
222
  }
165
223
 
@@ -176,6 +234,9 @@ interface MemShellOptions {
176
234
  shrink?: boolean;
177
235
  lambdaSuffix?: boolean;
178
236
  probe?: boolean;
237
+ obfuscate?: boolean;
238
+ obfuscationOptions?: Record<string, unknown>;
239
+ obfuscationScope?: "ALL" | "MEMSHELL_INJECTOR" | "INJECTOR" | "MEMSHELL";
179
240
  shellClassName?: string;
180
241
  godzillaPass?: string;
181
242
  godzillaKey?: string;
@@ -205,12 +266,15 @@ interface ProbeOptions {
205
266
  shrink?: boolean;
206
267
  staticInitialize?: boolean;
207
268
  lambdaSuffix?: boolean;
269
+ obfuscate?: boolean;
270
+ obfuscationOptions?: Record<string, unknown>;
208
271
  host?: string;
209
272
  seconds?: number;
210
273
  sleepServer?: string;
211
274
  server?: string;
212
275
  reqParamName?: string;
213
276
  commandTemplate?: string;
277
+ respHeaderName?: string;
214
278
  }
215
279
  declare function buildProbeRequest(opts: ProbeOptions): ProbeShellGenerateRequest;
216
280
 
@@ -363,6 +427,8 @@ interface CommonConnectOptions {
363
427
  extraHeaders?: Record<string, string>;
364
428
  timeoutMs?: number;
365
429
  insecure?: boolean;
430
+ /** Tomcat Upgrade shell protocol: the generated shell's fully-qualified class name. */
431
+ upgradeProtocol?: string;
366
432
  }
367
433
 
368
434
  /** A saved shell connection profile, stored inside a project. */
@@ -377,6 +443,8 @@ interface StoredShell {
377
443
  insecure?: boolean;
378
444
  /** mimic protocol: site profile name (see 'memparty profile'). */
379
445
  profile?: string;
446
+ /** Godzilla Upgrade shell protocol (generated shell class name). */
447
+ upgradeProtocol?: string;
380
448
  /** Free-form note for this shell (e.g. "DMZ 跳板机"). */
381
449
  remark?: string;
382
450
  createdAt: string;
@@ -420,6 +488,7 @@ interface ConnectionFlags {
420
488
  extraHeaders?: Record<string, string>;
421
489
  insecure?: boolean;
422
490
  profile?: string;
491
+ upgradeProtocol?: string;
423
492
  }
424
493
  interface ResolvedConnection {
425
494
  url: string;
@@ -432,6 +501,7 @@ interface ResolvedConnection {
432
501
  insecure?: boolean;
433
502
  /** mimic protocol: site profile name. */
434
503
  profile?: string;
504
+ upgradeProtocol?: string;
435
505
  /** Canonical `project/shell` reference, when resolved from the store. */
436
506
  targetName?: string;
437
507
  }
@@ -758,4 +828,4 @@ declare function testSuo5(url: string, options?: Suo5ConnectOptions): Promise<Co
758
828
 
759
829
  declare const CLI_VERSION: string;
760
830
 
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 };
831
+ 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 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 ToolConfigDescriptor, type ToolConfigParam, 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 };