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/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,17 +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>;
210
+ getShellToolConfigs(): Promise<ToolConfigDescriptor[]>;
211
+ getObfuscationOptions(): Promise<ObfuscationOption[]>;
212
+ getProbeResponseServers(): Promise<string[]>;
152
213
  getVersion(): Promise<VersionInfo>;
153
214
  generateMemShell(req: MemShellGenerateRequest): Promise<MemShellGenerateResponse>;
215
+ private getGenerationApiVersion;
154
216
  generateProbe(req: ProbeShellGenerateRequest): Promise<ProbeShellGenerateResponse>;
155
217
  /** Parse a fully-qualified class name from a base64-encoded .class file. */
156
218
  parseClassName(classBase64: string): Promise<string>;
219
+ decodeBytecode(classBase64: string): Promise<BytecodeResult>;
220
+ transformBytecode(req: BytecodeTransformRequest): Promise<BytecodeTransformResponse>;
157
221
  private request;
158
222
  }
159
223
 
@@ -170,6 +234,9 @@ interface MemShellOptions {
170
234
  shrink?: boolean;
171
235
  lambdaSuffix?: boolean;
172
236
  probe?: boolean;
237
+ obfuscate?: boolean;
238
+ obfuscationOptions?: Record<string, unknown>;
239
+ obfuscationScope?: "ALL" | "MEMSHELL_INJECTOR" | "INJECTOR" | "MEMSHELL";
173
240
  shellClassName?: string;
174
241
  godzillaPass?: string;
175
242
  godzillaKey?: string;
@@ -199,12 +266,15 @@ interface ProbeOptions {
199
266
  shrink?: boolean;
200
267
  staticInitialize?: boolean;
201
268
  lambdaSuffix?: boolean;
269
+ obfuscate?: boolean;
270
+ obfuscationOptions?: Record<string, unknown>;
202
271
  host?: string;
203
272
  seconds?: number;
204
273
  sleepServer?: string;
205
274
  server?: string;
206
275
  reqParamName?: string;
207
276
  commandTemplate?: string;
277
+ respHeaderName?: string;
208
278
  }
209
279
  declare function buildProbeRequest(opts: ProbeOptions): ProbeShellGenerateRequest;
210
280
 
@@ -357,6 +427,8 @@ interface CommonConnectOptions {
357
427
  extraHeaders?: Record<string, string>;
358
428
  timeoutMs?: number;
359
429
  insecure?: boolean;
430
+ /** Tomcat Upgrade shell protocol: the generated shell's fully-qualified class name. */
431
+ upgradeProtocol?: string;
360
432
  }
361
433
 
362
434
  /** A saved shell connection profile, stored inside a project. */
@@ -371,6 +443,8 @@ interface StoredShell {
371
443
  insecure?: boolean;
372
444
  /** mimic protocol: site profile name (see 'memparty profile'). */
373
445
  profile?: string;
446
+ /** Godzilla Upgrade shell protocol (generated shell class name). */
447
+ upgradeProtocol?: string;
374
448
  /** Free-form note for this shell (e.g. "DMZ 跳板机"). */
375
449
  remark?: string;
376
450
  createdAt: string;
@@ -414,6 +488,7 @@ interface ConnectionFlags {
414
488
  extraHeaders?: Record<string, string>;
415
489
  insecure?: boolean;
416
490
  profile?: string;
491
+ upgradeProtocol?: string;
417
492
  }
418
493
  interface ResolvedConnection {
419
494
  url: string;
@@ -426,6 +501,7 @@ interface ResolvedConnection {
426
501
  insecure?: boolean;
427
502
  /** mimic protocol: site profile name. */
428
503
  profile?: string;
504
+ upgradeProtocol?: string;
429
505
  /** Canonical `project/shell` reference, when resolved from the store. */
430
506
  targetName?: string;
431
507
  }
@@ -476,9 +552,15 @@ declare function execGodzilla(url: string, pass: string, key: string, command: s
476
552
  interface ProfileTemplate {
477
553
  /** <title> of this page (metadata — the template is used verbatim). */
478
554
  title: string;
479
- /** Full HTML of a real page on the site (a response skin). */
555
+ /**
556
+ * Full body of a real response on the site (a response skin). Any text
557
+ * format is allowed — HTML, JSON, XML, JS… When it contains the literal
558
+ * placeholder `{{payload}}`, the ciphertext is substituted exactly there
559
+ * (works for every format); without a placeholder the template must be an
560
+ * HTML page and the cipher's marker fragment is injected before </body>.
561
+ */
480
562
  template: string;
481
- /** Content-Type this page is served with. */
563
+ /** Content-Type this page is served with (the shell answers with it). */
482
564
  contentType: string;
483
565
  /** Relative rotation weight (default 1). */
484
566
  weight?: number;
@@ -502,8 +584,25 @@ interface ProfileRequest {
502
584
  secretField: string;
503
585
  /** Where the ciphertext goes: form body (default), URL query, or a header. */
504
586
  secretIn?: "body" | "query" | "header";
587
+ /**
588
+ * Body serialization when secretIn=body: "form" (default, url-encoded) or
589
+ * "json" (a JSON object with Content-Type application/json — for API sites
590
+ * whose dominant traffic is JSON XHR). Ignored when bodyTemplate is set.
591
+ */
592
+ bodyStyle?: "form" | "json";
593
+ /**
594
+ * Full request body with the literal placeholder `{{payload}}` where the
595
+ * ciphertext goes (takes precedence over bodyStyle; secretIn must be body).
596
+ * Any text format — an OpenAI-style chat JSON, a GraphQL envelope, an XML
597
+ * SOAP message, a multipart/form-data body (pair it with a Content-Type
598
+ * header carrying the same boundary). Decoy macros {{hex:N}}, {{b64:N}},
599
+ * {{uuid}}, {{ts}}, {{int:A:B}} are rendered per request.
600
+ */
601
+ bodyTemplate?: string;
505
602
  /** Decoy fields sent alongside (e.g. csrftoken/j_username/agreement). */
506
603
  fields?: ProfileFormField[];
604
+ /** Extra/override request headers for this shape (e.g. Accept). */
605
+ headers?: Record<string, string>;
507
606
  /** Relative rotation weight (default 1) when `request` is an array. */
508
607
  weight?: number;
509
608
  }
@@ -659,9 +758,29 @@ interface FilterTemplateOptions {
659
758
  secret: string;
660
759
  /** Carrier field names (form fields / headers) that may hold the ciphertext. */
661
760
  fields: string[];
662
- /** Cover pages from the site profile (raw HTML, rotated per response). */
663
- templates: string[];
761
+ /**
762
+ * Lowercase Content-Type needles (contains-match): the body is read only
763
+ * when its Content-Type matches one — derived from the profile's body
764
+ * shapes. Empty = never touch the body stream: reading a body the shell
765
+ * doesn't own consumes it and breaks the app behind us.
766
+ */
767
+ bodyContentTypes: string[];
768
+ /** Cover bodies from the site profile (rotated per response, each with its contentType). */
769
+ templates: Array<{
770
+ template: string;
771
+ contentType: string;
772
+ }>;
664
773
  cipher: MimicCipher;
774
+ /**
775
+ * Base64 bytes of the body-wrapper classes (renderWrapperJava, compiled by
776
+ * the build's first phase). The filter self-defines them at runtime so the
777
+ * uploaded shell stays a single self-contained class — MemShellParty's
778
+ * Custom generator can only resolve one class.
779
+ */
780
+ wrapper: {
781
+ bodyB64: string;
782
+ streamB64: string;
783
+ };
665
784
  }
666
785
  declare function renderFilterJava(opts: FilterTemplateOptions): string;
667
786
  declare function renderCryptoProbe(cipher: MimicCipher): string;
@@ -709,4 +828,4 @@ declare function testSuo5(url: string, options?: Suo5ConnectOptions): Promise<Co
709
828
 
710
829
  declare const CLI_VERSION: string;
711
830
 
712
- 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 };