mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
feat: support custom shell generator (#49)
This commit is contained in:
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -40,12 +39,14 @@ public class ConfigController {
|
|||||||
coreMap.put(value.name(), map);
|
coreMap.put(value.name(), map);
|
||||||
}
|
}
|
||||||
Config config = new Config();
|
Config config = new Config();
|
||||||
config.setServers(
|
Map<String, List<String>> servers = new LinkedHashMap<>();
|
||||||
Arrays.stream(Server.values())
|
for (Server server : Server.values()) {
|
||||||
.filter(s -> s.getShell() != null)
|
if (server.getShell() != null) {
|
||||||
.map(Server::name)
|
Set<String> supportedShellTypes = server.getShell().getShellInjectorMapping().getSupportedShellTypes();
|
||||||
.collect(Collectors.toList())
|
servers.put(server.name(), supportedShellTypes.stream().toList());
|
||||||
);
|
}
|
||||||
|
}
|
||||||
|
config.setServers(servers);
|
||||||
config.setCore(coreMap);
|
config.setCore(coreMap);
|
||||||
config.setPackers(
|
config.setPackers(
|
||||||
Arrays.stream(Packers.values())
|
Arrays.stream(Packers.values())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.reajason.javaweb.boot.dto;
|
package com.reajason.javaweb.boot.dto;
|
||||||
|
|
||||||
import com.reajason.javaweb.memshell.config.*;
|
|
||||||
import com.reajason.javaweb.memshell.Packers;
|
import com.reajason.javaweb.memshell.Packers;
|
||||||
|
import com.reajason.javaweb.memshell.config.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +25,7 @@ public class GenerateRequest {
|
|||||||
private String antSwordPass;
|
private String antSwordPass;
|
||||||
private String headerName;
|
private String headerName;
|
||||||
private String headerValue;
|
private String headerValue;
|
||||||
|
private String shellClassBase64;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShellToolConfig parseShellToolConfig() {
|
public ShellToolConfig parseShellToolConfig() {
|
||||||
@@ -51,7 +52,7 @@ public class GenerateRequest {
|
|||||||
.headerName(shellToolConfig.getHeaderName())
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
.headerValue(shellToolConfig.getHeaderValue())
|
||||||
.build();
|
.build();
|
||||||
case AntSword -> AntSwordConfig.builder()
|
case AntSword -> AntSwordConfig.builder()
|
||||||
.shellClassName(shellToolConfig.getShellClassName())
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
.pass(shellToolConfig.getAntSwordPass())
|
.pass(shellToolConfig.getAntSwordPass())
|
||||||
.headerName(shellToolConfig.getHeaderName())
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
@@ -62,6 +63,10 @@ public class GenerateRequest {
|
|||||||
.headerName(shellToolConfig.getHeaderName())
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
.headerValue(shellToolConfig.getHeaderValue())
|
||||||
.build();
|
.build();
|
||||||
|
case Custom -> CustomConfig.builder()
|
||||||
|
.shellClassBase64(shellToolConfig.getShellClassBase64())
|
||||||
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
|
.build();
|
||||||
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Config {
|
public class Config {
|
||||||
private List<String> servers;
|
private Map<String, List<String>> servers;
|
||||||
private Map<String, Map<?, ?>> core;
|
private Map<String, Map<?, ?>> core;
|
||||||
private List<String> packers;
|
private List<String> packers;
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ public class ClassBytesShrink {
|
|||||||
|
|
||||||
public static byte[] shrink(byte[] bytes, boolean full) {
|
public static byte[] shrink(byte[] bytes, boolean full) {
|
||||||
ClassReader cr = new ClassReader(bytes);
|
ClassReader cr = new ClassReader(bytes);
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||||
ClassVisitor cv = new ClassVisitor(Opcodes.ASM9, cw) {
|
ClassVisitor cv = new ClassVisitor(Opcodes.ASM9, cw) {
|
||||||
@Override
|
@Override
|
||||||
public void visitSource(String source, String debug) {
|
public void visitSource(String source, String debug) {
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ public class MemShellGenerator {
|
|||||||
Server server = shellConfig.getServer();
|
Server server = shellConfig.getServer();
|
||||||
AbstractShell shell = server.getShell();
|
AbstractShell shell = server.getShell();
|
||||||
if (shell == null) {
|
if (shell == null) {
|
||||||
throw new IllegalArgumentException("Unsupported server");
|
throw new IllegalArgumentException("Unsupported server: " + server);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(shellToolConfig.getShellClassName())) {
|
if (StringUtils.isBlank(shellToolConfig.getShellClassName())) {
|
||||||
shellToolConfig.setShellClassName(CommonUtil.generateShellClassName(server, shellConfig.getShellType()));
|
shellToolConfig.setShellClassName(CommonUtil.generateShellClassName(server, shellConfig.getShellType()));
|
||||||
}
|
}
|
||||||
@@ -27,22 +28,25 @@ public class MemShellGenerator {
|
|||||||
injectorConfig.setInjectorClassName(CommonUtil.generateInjectorClassName());
|
injectorConfig.setInjectorClassName(CommonUtil.generateInjectorClassName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Class<?>, Class<?>> shellInjectorPair = shellConfig.getServer().getShell().getShellInjectorPair(shellConfig.getShellTool(), shellConfig.getShellType());
|
Class<?> injectorClass = null;
|
||||||
if (shellInjectorPair == null) {
|
|
||||||
throw new UnsupportedOperationException("Unknown shell type: " + shellConfig.getShellType());
|
|
||||||
}
|
|
||||||
Class<?> shellClass = shellInjectorPair.getLeft();
|
|
||||||
Class<?> injectorClass = shellInjectorPair.getRight();
|
|
||||||
|
|
||||||
shellToolConfig.setShellClass(shellClass);
|
if (ShellTool.Custom.equals(shellConfig.getShellTool())) {
|
||||||
|
injectorClass = shellConfig.getServer().getShell().getShellInjectorMapping().getInjector(shellConfig.getShellType());
|
||||||
|
} else {
|
||||||
|
Pair<Class<?>, Class<?>> shellInjectorPair = shellConfig.getServer().getShell().getShellInjectorPair(shellConfig.getShellTool(), shellConfig.getShellType());
|
||||||
|
if (shellInjectorPair == null) {
|
||||||
|
throw new UnsupportedOperationException(server + " unsupported shell type: " + shellConfig.getShellType() + " for tool: " + shellConfig.getShellTool());
|
||||||
|
}
|
||||||
|
Class<?> shellClass = shellInjectorPair.getLeft();
|
||||||
|
injectorClass = shellInjectorPair.getRight();
|
||||||
|
shellToolConfig.setShellClass(shellClass);
|
||||||
|
}
|
||||||
|
|
||||||
byte[] shellBytes = generateShellBytes(shellConfig, shellToolConfig);
|
byte[] shellBytes = generateShellBytes(shellConfig, shellToolConfig);
|
||||||
|
|
||||||
injectorConfig = injectorConfig
|
injectorConfig.setInjectorClass(injectorClass);
|
||||||
.toBuilder()
|
injectorConfig.setShellClassName(shellToolConfig.getShellClassName());
|
||||||
.injectorClass(injectorClass)
|
injectorConfig.setShellClassBytes(shellBytes);
|
||||||
.shellClassName(shellToolConfig.getShellClassName())
|
|
||||||
.shellClassBytes(shellBytes).build();
|
|
||||||
|
|
||||||
byte[] injectorBytes = new InjectorGenerator(shellConfig, injectorConfig).generate();
|
byte[] injectorBytes = new InjectorGenerator(shellConfig, injectorConfig).generate();
|
||||||
|
|
||||||
@@ -71,6 +75,8 @@ public class MemShellGenerator {
|
|||||||
return new AntSwordGenerator(shellConfig, (AntSwordConfig) shellToolConfig).getBytes();
|
return new AntSwordGenerator(shellConfig, (AntSwordConfig) shellToolConfig).getBytes();
|
||||||
case NeoreGeorg:
|
case NeoreGeorg:
|
||||||
return new NeoreGeorgGenerator(shellConfig, (NeoreGeorgConfig) shellToolConfig).getBytes();
|
return new NeoreGeorgGenerator(shellConfig, (NeoreGeorgConfig) shellToolConfig).getBytes();
|
||||||
|
case Custom:
|
||||||
|
return new CustomShellGenerator(shellConfig, (CustomConfig) shellToolConfig).getBytes();
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unknown shell tool: " + shellConfig.getShellTool());
|
throw new UnsupportedOperationException("Unknown shell tool: " + shellConfig.getShellTool());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,10 @@ public enum ShellTool {
|
|||||||
*/
|
*/
|
||||||
NeoreGeorg,
|
NeoreGeorg,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义
|
||||||
|
*/
|
||||||
|
Custom,
|
||||||
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.reajason.javaweb.memshell.config;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/12
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class CustomConfig extends ShellToolConfig {
|
||||||
|
private String shellClassBase64;
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
package com.reajason.javaweb.memshell.generator;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.ClassBytesShrink;
|
||||||
|
import com.reajason.javaweb.memshell.config.CustomConfig;
|
||||||
|
import com.reajason.javaweb.memshell.config.ShellConfig;
|
||||||
|
import net.bytebuddy.jar.asm.ClassReader;
|
||||||
|
import net.bytebuddy.jar.asm.ClassWriter;
|
||||||
|
import net.bytebuddy.jar.asm.commons.ClassRemapper;
|
||||||
|
import net.bytebuddy.jar.asm.commons.SimpleRemapper;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/3/18
|
||||||
|
*/
|
||||||
|
public class CustomShellGenerator {
|
||||||
|
|
||||||
|
private final ShellConfig shellConfig;
|
||||||
|
private final CustomConfig customConfig;
|
||||||
|
|
||||||
|
public CustomShellGenerator(ShellConfig shellConfig, CustomConfig customConfig) {
|
||||||
|
this.shellConfig = shellConfig;
|
||||||
|
this.customConfig = customConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getBytes() {
|
||||||
|
String shellClassBase64 = customConfig.getShellClassBase64();
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(shellClassBase64)) {
|
||||||
|
throw new IllegalArgumentException("Custom shell class is empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] bytes = renameClass(Base64.decodeBase64(shellClassBase64), customConfig.getShellClassName());
|
||||||
|
|
||||||
|
return ClassBytesShrink.shrink(bytes, shellConfig.isShrink());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] renameClass(byte[] classBytes, String newName) {
|
||||||
|
ClassReader reader = null;
|
||||||
|
try {
|
||||||
|
reader = new ClassReader(classBytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("invalid class bytes");
|
||||||
|
}
|
||||||
|
String oldClassName = reader.getClassName();
|
||||||
|
String newClassName = newName.replace('.', '/');
|
||||||
|
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||||
|
ClassRemapper adapter = new ClassRemapper(writer, new SimpleRemapper(oldClassName, newClassName));
|
||||||
|
reader.accept(adapter, 0);
|
||||||
|
return writer.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.reajason.javaweb.memshell.generator;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.memshell.config.CustomConfig;
|
||||||
|
import com.reajason.javaweb.memshell.config.ShellConfig;
|
||||||
|
import com.reajason.javaweb.memshell.utils.CommonUtil;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import net.bytebuddy.ByteBuddy;
|
||||||
|
import net.bytebuddy.jar.asm.ClassReader;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/3/19
|
||||||
|
*/
|
||||||
|
class CustomShellGeneratorTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SneakyThrows
|
||||||
|
void test() {
|
||||||
|
byte[] bytes = new ByteBuddy()
|
||||||
|
.subclass(Object.class)
|
||||||
|
.name(CommonUtil.generateShellClassName()).make().getBytes();
|
||||||
|
String className = CommonUtil.generateShellClassName();
|
||||||
|
byte[] bytes1 = new CustomShellGenerator(ShellConfig.builder().build(), CustomConfig.builder().shellClassName(className).shellClassBase64(Base64.encodeBase64String(bytes)).build()).getBytes();
|
||||||
|
|
||||||
|
ClassReader classReader = new ClassReader(bytes1);
|
||||||
|
assertEquals(className, classReader.getClassName().replace("/", "."));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
|||||||
import { Switch } from "@/components/ui/switch.tsx";
|
import { Switch } from "@/components/ui/switch.tsx";
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { FormSchema } from "@/types/schema.ts";
|
import { FormSchema } from "@/types/schema.ts";
|
||||||
import { JDKVersion, MainConfig, ShellToolType } from "@/types/shell.ts";
|
import { JDKVersion, MainConfig, ServerConfig, ShellToolType } from "@/types/shell.ts";
|
||||||
|
|
||||||
import { JreTip } from "@/components/tips/jre-tip.tsx";
|
import { JreTip } from "@/components/tips/jre-tip.tsx";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
ShieldOffIcon,
|
ShieldOffIcon,
|
||||||
SwordIcon,
|
SwordIcon,
|
||||||
WaypointsIcon,
|
WaypointsIcon,
|
||||||
|
ZapIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { JSX, useState } from "react";
|
import { JSX, useState } from "react";
|
||||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||||
@@ -24,6 +25,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { AntSwordTabContent } from "./tools/antsword-tab";
|
import { AntSwordTabContent } from "./tools/antsword-tab";
|
||||||
import { BehinderTabContent } from "./tools/behinder-tab";
|
import { BehinderTabContent } from "./tools/behinder-tab";
|
||||||
import { CommandTabContent } from "./tools/command-tab";
|
import { CommandTabContent } from "./tools/command-tab";
|
||||||
|
import CustomTabContent from "./tools/custom-tab";
|
||||||
import { GodzillaTabContent } from "./tools/godzilla-tab";
|
import { GodzillaTabContent } from "./tools/godzilla-tab";
|
||||||
import { NeoRegTabContent } from "./tools/neoreg-tab";
|
import { NeoRegTabContent } from "./tools/neoreg-tab";
|
||||||
import { Suo5TabContent } from "./tools/suo5-tab";
|
import { Suo5TabContent } from "./tools/suo5-tab";
|
||||||
@@ -35,17 +37,18 @@ const shellToolIcons: Record<ShellToolType, JSX.Element> = {
|
|||||||
[ShellToolType.AntSword]: <SwordIcon className="h-4 w-4" />,
|
[ShellToolType.AntSword]: <SwordIcon className="h-4 w-4" />,
|
||||||
[ShellToolType.Suo5]: <WaypointsIcon className="h-4 w-4" />,
|
[ShellToolType.Suo5]: <WaypointsIcon className="h-4 w-4" />,
|
||||||
[ShellToolType.NeoreGeorg]: <NetworkIcon className="h-4 w-4" />,
|
[ShellToolType.NeoreGeorg]: <NetworkIcon className="h-4 w-4" />,
|
||||||
|
[ShellToolType.Custom]: <ZapIcon className="h-4 w-4" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function MainConfigCard({
|
export function MainConfigCard({
|
||||||
mainConfig,
|
mainConfig,
|
||||||
form,
|
form,
|
||||||
servers,
|
servers,
|
||||||
}: {
|
}: Readonly<{
|
||||||
mainConfig: MainConfig | undefined;
|
mainConfig: MainConfig | undefined;
|
||||||
form: UseFormReturn<FormSchema>;
|
form: UseFormReturn<FormSchema>;
|
||||||
servers?: string[];
|
servers?: ServerConfig;
|
||||||
}) {
|
}>) {
|
||||||
const [shellToolMap, setShellToolMap] = useState<{
|
const [shellToolMap, setShellToolMap] = useState<{
|
||||||
[toolName: string]: string[];
|
[toolName: string]: string[];
|
||||||
}>();
|
}>();
|
||||||
@@ -56,6 +59,7 @@ export function MainConfigCard({
|
|||||||
ShellToolType.Command,
|
ShellToolType.Command,
|
||||||
ShellToolType.Suo5,
|
ShellToolType.Suo5,
|
||||||
ShellToolType.NeoreGeorg,
|
ShellToolType.NeoreGeorg,
|
||||||
|
ShellToolType.Custom,
|
||||||
]);
|
]);
|
||||||
const [shellTypes, setShellTypes] = useState<string[]>([]);
|
const [shellTypes, setShellTypes] = useState<string[]>([]);
|
||||||
const shellTool = form.watch("shellTool");
|
const shellTool = form.watch("shellTool");
|
||||||
@@ -66,7 +70,7 @@ export function MainConfigCard({
|
|||||||
const newShellToolMap = mainConfig[value];
|
const newShellToolMap = mainConfig[value];
|
||||||
setShellToolMap(newShellToolMap);
|
setShellToolMap(newShellToolMap);
|
||||||
const newShellTools = Object.keys(newShellToolMap);
|
const newShellTools = Object.keys(newShellToolMap);
|
||||||
setShellTools(newShellTools.map((tool) => tool as ShellToolType));
|
setShellTools([...newShellTools.map((tool) => tool as ShellToolType), ShellToolType.Custom]);
|
||||||
if (newShellTools.length > 0) {
|
if (newShellTools.length > 0) {
|
||||||
const firstTool = newShellTools[0];
|
const firstTool = newShellTools[0];
|
||||||
setShellTypes(newShellToolMap[firstTool]);
|
setShellTypes(newShellToolMap[firstTool]);
|
||||||
@@ -124,8 +128,17 @@ export function MainConfigCard({
|
|||||||
form.resetField("headerValue");
|
form.resetField("headerValue");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resetCustom = () => {
|
||||||
|
form.resetField("shellClassBase64");
|
||||||
|
};
|
||||||
|
|
||||||
if (shellToolMap) {
|
if (shellToolMap) {
|
||||||
setShellTypes(shellToolMap[value]);
|
if (value === ShellToolType.Custom) {
|
||||||
|
setShellTypes(servers?.[form.getValues("server")] as string[]);
|
||||||
|
} else {
|
||||||
|
setShellTypes(shellToolMap[value]);
|
||||||
|
}
|
||||||
|
|
||||||
form.resetField("urlPattern");
|
form.resetField("urlPattern");
|
||||||
form.resetField("shellType");
|
form.resetField("shellType");
|
||||||
form.resetField("shellClassName");
|
form.resetField("shellClassName");
|
||||||
@@ -142,6 +155,8 @@ export function MainConfigCard({
|
|||||||
resetAntSword();
|
resetAntSword();
|
||||||
} else if (value === ShellToolType.NeoreGeorg) {
|
} else if (value === ShellToolType.NeoreGeorg) {
|
||||||
resetNeoreGeorg();
|
resetNeoreGeorg();
|
||||||
|
} else if (value === ShellToolType.Custom) {
|
||||||
|
resetCustom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
form.setValue("shellTool", value);
|
form.setValue("shellTool", value);
|
||||||
@@ -177,7 +192,7 @@ export function MainConfigCard({
|
|||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{servers?.map((server: string) => (
|
{Object.keys(servers ?? {}).map((server: string) => (
|
||||||
<SelectItem key={server} value={server}>
|
<SelectItem key={server} value={server}>
|
||||||
{server}
|
{server}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
@@ -291,7 +306,7 @@ export function MainConfigCard({
|
|||||||
className="flex-1 min-w-24 data-[state=active]:bg-background"
|
className="flex-1 min-w-24 data-[state=active]:bg-background"
|
||||||
>
|
>
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
{shellToolIcons[shellTool as ShellToolType]}
|
{shellToolIcons[shellTool]}
|
||||||
{shellTool}
|
{shellTool}
|
||||||
</span>
|
</span>
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
@@ -305,6 +320,7 @@ export function MainConfigCard({
|
|||||||
<AntSwordTabContent form={form} shellTypes={shellTypes} />
|
<AntSwordTabContent form={form} shellTypes={shellTypes} />
|
||||||
<Suo5TabContent form={form} shellTypes={shellTypes} />
|
<Suo5TabContent form={form} shellTypes={shellTypes} />
|
||||||
<NeoRegTabContent form={form} shellTypes={shellTypes} />
|
<NeoRegTabContent form={form} shellTypes={shellTypes} />
|
||||||
|
<CustomTabContent form={form} shellTypes={shellTypes} />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,13 +10,12 @@ import {
|
|||||||
} from "@/types/shell";
|
} from "@/types/shell";
|
||||||
import { FileTextIcon } from "lucide-react";
|
import { FileTextIcon } from "lucide-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Fragment } from "react/jsx-runtime";
|
|
||||||
import { CopyableField } from "../copyable-field";
|
import { CopyableField } from "../copyable-field";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";
|
||||||
import { Separator } from "../ui/separator";
|
import { Separator } from "../ui/separator";
|
||||||
import { FeedbackAlert } from "./feedback-alert";
|
import { FeedbackAlert } from "./feedback-alert";
|
||||||
|
|
||||||
export function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) {
|
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: GenerateResult }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
@@ -40,7 +39,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
|
|||||||
value={generateResult?.injectorConfig.urlPattern}
|
value={generateResult?.injectorConfig.urlPattern}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Separator className="my-2" />
|
{generateResult?.shellConfig.shellTool !== ShellToolType.Custom && <Separator className="my-2" />}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.Behinder && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.Behinder && (
|
||||||
<>
|
<>
|
||||||
@@ -62,7 +61,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.Godzilla && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.Godzilla && (
|
||||||
<Fragment>
|
<>
|
||||||
<CopyableField
|
<CopyableField
|
||||||
label={t("shellToolConfig.pass")}
|
label={t("shellToolConfig.pass")}
|
||||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||||
@@ -80,28 +79,24 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
|
|||||||
text={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
text={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||||
value={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
value={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</>
|
||||||
)}
|
)}
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.Command && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.Command && (
|
||||||
<Fragment>
|
<CopyableField
|
||||||
<CopyableField
|
label={t("shellToolConfig.paramName")}
|
||||||
label={t("shellToolConfig.paramName")}
|
text={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||||
text={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
value={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||||
value={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
/>
|
||||||
/>
|
|
||||||
</Fragment>
|
|
||||||
)}
|
)}
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.Suo5 && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.Suo5 && (
|
||||||
<Fragment>
|
<CopyableField
|
||||||
<CopyableField
|
label={t("shellToolConfig.suo5Header")}
|
||||||
label={t("shellToolConfig.suo5Header")}
|
text={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||||
text={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
value={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||||
value={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
/>
|
||||||
/>
|
|
||||||
</Fragment>
|
|
||||||
)}
|
)}
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.AntSword && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.AntSword && (
|
||||||
<Fragment>
|
<>
|
||||||
<CopyableField
|
<CopyableField
|
||||||
label={t("shellToolConfig.antSwordPass")}
|
label={t("shellToolConfig.antSwordPass")}
|
||||||
text={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
text={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
||||||
@@ -112,17 +107,17 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
|
|||||||
text={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
text={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||||
value={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
value={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</>
|
||||||
)}
|
)}
|
||||||
{generateResult?.shellConfig.shellTool === ShellToolType.NeoreGeorg && (
|
{generateResult?.shellConfig.shellTool === ShellToolType.NeoreGeorg && (
|
||||||
<Fragment>
|
<>
|
||||||
<CopyableField label={t("shellToolConfig.neoreGeorgKey")} text="key" value="key" />
|
<CopyableField label={t("shellToolConfig.neoreGeorgKey")} text="key" value="key" />
|
||||||
<CopyableField
|
<CopyableField
|
||||||
label={t("shellToolConfig.neoreGeorgHeader")}
|
label={t("shellToolConfig.neoreGeorgHeader")}
|
||||||
text={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
text={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||||
value={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
value={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Separator className="my-2" />
|
<Separator className="my-2" />
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
|
import { FormSchema } from "@/types/schema";
|
||||||
|
import { t } from "i18next";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||||
|
import { FormControl, FormField, FormItem, FormLabel } from "../ui/form";
|
||||||
|
import { Input } from "../ui/input";
|
||||||
|
import { Label } from "../ui/label";
|
||||||
|
import { RadioGroup, RadioGroupItem } from "../ui/radio-group";
|
||||||
|
import { Textarea } from "../ui/textarea";
|
||||||
|
import { OptionalClassFormField } from "./classname-field";
|
||||||
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
|
export default function CustomTabContent({
|
||||||
|
form,
|
||||||
|
shellTypes,
|
||||||
|
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
|
||||||
|
const [isFile, setIsFile] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormProvider {...form}>
|
||||||
|
<TabsContent value="Custom">
|
||||||
|
<Card>
|
||||||
|
<CardContent className="space-y-2 mt-4">
|
||||||
|
<div className="grid grid-cols-2 gap-2">
|
||||||
|
<ShellTypeFormField form={form} shellTypes={shellTypes} />
|
||||||
|
<UrlPatternFormField form={form} />
|
||||||
|
</div>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="shellClassBase64"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="space-y-1">
|
||||||
|
<FormLabel className="h-6 flex items-center gap-1">{t("shellToolConfig.base64String")}</FormLabel>
|
||||||
|
<RadioGroup
|
||||||
|
value={isFile ? "file" : "base64"}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
field.onChange("");
|
||||||
|
setIsFile(value === "file");
|
||||||
|
}}
|
||||||
|
className="flex items-center space-x-2"
|
||||||
|
>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<RadioGroupItem value="base64" id="option-one" />
|
||||||
|
<Label htmlFor="option-one">Base64</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<RadioGroupItem value="file" id="option-two" />
|
||||||
|
<Label htmlFor="option-two">File</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
<FormControl className="pt-2 mt-2">
|
||||||
|
{isFile ? (
|
||||||
|
<Input
|
||||||
|
onChange={(e) => {
|
||||||
|
const file = e.target.files?.[0];
|
||||||
|
if (file) {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (event) => {
|
||||||
|
const base64String = (event.target?.result as string)?.split(",")[1] || "";
|
||||||
|
field.onChange(base64String);
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
accept=".class"
|
||||||
|
placeholder={t("placeholders.input")}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Textarea {...field} placeholder={t("placeholders.input")} className="h-24" />
|
||||||
|
)}
|
||||||
|
</FormControl>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<OptionalClassFormField form={form} />
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</TabsContent>
|
||||||
|
</FormProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"shellNotWork": {
|
"shellNotWork": {
|
||||||
"step1": "1. Try to enable the debug mode, regenerate the memory shell and inject it, check the console or log",
|
"step1": "1. Try to enable the debug mode, regenerate the memory shell and inject it, check the console or log",
|
||||||
"step2": "2. If an exception stack trace is displayed, or no exception is seen, please take a screenshot of the current generation interface and the exception log, and describe the target environment as much as possible for feedback",
|
"step2": "2. If an exception stack trace is displayed, or no exception is seen, please take a screenshot of the current generation interface and the exception log, and describe the target environment as much as possible for feedback",
|
||||||
"title": "Shell Not Work ?"
|
"title": "Shell Not Work ?"
|
||||||
},
|
},
|
||||||
"shellToolConfig": {
|
"shellToolConfig": {
|
||||||
"antSwordPass": "Shell pwd",
|
"antSwordPass": "Shell pwd",
|
||||||
@@ -107,7 +107,8 @@
|
|||||||
"neoreGeorgKey": "Connection Key",
|
"neoreGeorgKey": "Connection Key",
|
||||||
"paramName": "Param Name",
|
"paramName": "Param Name",
|
||||||
"pass": "Pass",
|
"pass": "Pass",
|
||||||
"suo5Header": "AdvanceConfiguration -> Request Header"
|
"suo5Header": "AdvanceConfiguration -> Request Header",
|
||||||
|
"base64String": "Shell Class"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"generated": "Generation successful"
|
"generated": "Generation successful"
|
||||||
@@ -128,10 +129,13 @@
|
|||||||
"targetServerNotFound": "Target server not found?",
|
"targetServerNotFound": "Target server not found?",
|
||||||
"targetServerRequest": "Request",
|
"targetServerRequest": "Request",
|
||||||
"try-to-use-shell": "Try to use the memory shell",
|
"try-to-use-shell": "Try to use the memory shell",
|
||||||
"waitingForGeneration": "// Waiting for generation..."
|
"waitingForGeneration": "// Waiting for generation...",
|
||||||
|
"customShellClass": "Custom shell class is required, base64 or classfile"
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"updateAvailable": "Update Available",
|
"updateAvailable": "Update Available",
|
||||||
"updateAvailableTooltip": "Click to Open Github Release Page ( v{{currentVersion}} -> v{{latestVersion}})"
|
"updateAvailableTooltip": "Click to Open Github Release Page ( v{{currentVersion}} -> v{{latestVersion}})"
|
||||||
}
|
},
|
||||||
|
"generator": "Generator",
|
||||||
|
"about": "About"
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-7
@@ -84,7 +84,7 @@
|
|||||||
"shellNotWork": {
|
"shellNotWork": {
|
||||||
"step1": "1. 尝试开启调试模式,重新生成内存马并注入,查看控制台或日志",
|
"step1": "1. 尝试开启调试模式,重新生成内存马并注入,查看控制台或日志",
|
||||||
"step2": "2. 如果出现异常堆栈信息,或未见异常,请截图当前生成界面以及异常日志,并尽可能描述目标环境进行反馈",
|
"step2": "2. 如果出现异常堆栈信息,或未见异常,请截图当前生成界面以及异常日志,并尽可能描述目标环境进行反馈",
|
||||||
"title": "内存马利用失败 ?"
|
"title": "内存马利用失败?"
|
||||||
},
|
},
|
||||||
"shellToolConfig": {
|
"shellToolConfig": {
|
||||||
"antSwordPass": "连接密码",
|
"antSwordPass": "连接密码",
|
||||||
@@ -107,7 +107,8 @@
|
|||||||
"neoreGeorgKey": "连接密钥",
|
"neoreGeorgKey": "连接密钥",
|
||||||
"paramName": "请求参数",
|
"paramName": "请求参数",
|
||||||
"pass": "密码",
|
"pass": "密码",
|
||||||
"suo5Header": "高级配置 -> 请求头"
|
"suo5Header": "高级配置 -> 请求头",
|
||||||
|
"base64String": "内存马类"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"generated": "生成成功"
|
"generated": "生成成功"
|
||||||
@@ -117,21 +118,24 @@
|
|||||||
"decompileTip": "反编译还在开发中,因此当前仅能看到 base64 编码格式",
|
"decompileTip": "反编译还在开发中,因此当前仅能看到 base64 编码格式",
|
||||||
"download-jattach": "下载 Jattach 工具(后期考虑直接封装在 Jar 中)",
|
"download-jattach": "下载 Jattach 工具(后期考虑直接封装在 Jar 中)",
|
||||||
"execute-command": "执行命令进行注入:/path/to/jattach pid load instrument false /path/to/agent.jar",
|
"execute-command": "执行命令进行注入:/path/to/jattach pid load instrument false /path/to/agent.jar",
|
||||||
"get-pid": "获取目标 jvm 的进程 pid (使用 jps 或 ps)",
|
"get-pid": "获取目标 jvm 的进程 pid(使用 jps 或 ps)",
|
||||||
"handlerUrlPattern": "HandlerMethod/HandlerFunction 类型的需要填写具体的 URL Pattern,例如 /hello_handler",
|
"handlerUrlPattern": "HandlerMethod/HandlerFunction 类型的需要填写具体的 URL Pattern,例如 /hello_handler",
|
||||||
"jreTip": "目标 JRE 版本,一般而言为了最大的兼容性,默认 Java 6 即可,Java 高版本能加载低版本的字节码。",
|
"jreTip": "目标 JRE 版本,一般而言为了最大的兼容性,默认 Java 6 即可,Java 高版本能加载低版本的字节码。",
|
||||||
"jreTip2": "特定情况下,例如 JDK8 才能使用 lambda 表达式,JDK9 以上存在模块限制时才需要选择特定的版本。",
|
"jreTip2": "特定情况下,例如 JDK8 才能使用 lambda 表达式,JDK9 以上存在模块限制时才需要选择特定的版本。",
|
||||||
"move-to-container": "将 MemShellAgent.jar 和 jattach 移动到容器中(如果测试环境使用容器部署)",
|
"move-to-container": "将 MemShellAgent.jar 和 jattach 移动到容器中(如果测试环境使用容器部署)",
|
||||||
"servletUrlPattern": "Servlet 类型的需要填写具体的 URL Pattern,例如 /hello_servlet",
|
"servletUrlPattern": "Servlet 类型的需要填写具体的 URL Pattern,例如 /hello_servlet",
|
||||||
"shellBytesEmpty": "内存马字节码为空,无法下载, 请先生成内存马",
|
"shellBytesEmpty": "内存马字节码为空,无法下载,请先生成内存马",
|
||||||
"shellToolNotSelected": "请先选择内存马工具类型",
|
"shellToolNotSelected": "请先选择内存马工具类型",
|
||||||
"targetServerNotFound": "找不到目标服务 ?",
|
"targetServerNotFound": "找不到目标服务?",
|
||||||
"targetServerRequest": "请求适配",
|
"targetServerRequest": "请求适配",
|
||||||
"try-to-use-shell": "尝试利用内存马",
|
"try-to-use-shell": "尝试利用内存马",
|
||||||
"waitingForGeneration": "// 等待填写参数生成中..."
|
"waitingForGeneration": "// 等待填写参数生成中...",
|
||||||
|
"customShellClass": "请输入自定义内存马类,base64 或类文件"
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"updateAvailable": "有可用升级",
|
"updateAvailable": "有可用升级",
|
||||||
"updateAvailableTooltip": "点击前往 GitHub Release ( v{{currentVersion}} -> v{{latestVersion}})"
|
"updateAvailableTooltip": "点击前往 GitHub Release ( v{{currentVersion}} -> v{{latestVersion}})"
|
||||||
}
|
},
|
||||||
|
"about": "关于",
|
||||||
|
"generator": "生成器"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form } from "@/components/ui/form.tsx";
|
import { Form } from "@/components/ui/form.tsx";
|
||||||
import { env } from "@/config.ts";
|
import { env } from "@/config.ts";
|
||||||
import { FormSchema, formSchema } from "@/types/schema.ts";
|
import { FormSchema, formSchema } from "@/types/schema.ts";
|
||||||
import { APIErrorResponse, ConfigResponseType, GenerateResponse, GenerateResult } from "@/types/shell.ts";
|
import {
|
||||||
|
APIErrorResponse,
|
||||||
|
ConfigResponseType,
|
||||||
|
GenerateResponse,
|
||||||
|
GenerateResult,
|
||||||
|
ShellToolType,
|
||||||
|
} from "@/types/shell.ts";
|
||||||
import { transformToPostData } from "@/utils/transformer.ts";
|
import { transformToPostData } from "@/utils/transformer.ts";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -76,6 +82,11 @@ function IndexComponent() {
|
|||||||
toast.warning(t("tips.handlerUrlPattern"));
|
toast.warning(t("tips.handlerUrlPattern"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.shellTool === ShellToolType.Custom && !values.shellClassBase64) {
|
||||||
|
toast.warning(t("tips.customShellClass"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const formSchema = z.object({
|
|||||||
injectorClassName: z.optional(z.string()),
|
injectorClassName: z.optional(z.string()),
|
||||||
packingMethod: z.string().min(1),
|
packingMethod: z.string().min(1),
|
||||||
shrink: z.optional(z.boolean()),
|
shrink: z.optional(z.boolean()),
|
||||||
|
shellClassBase64: z.optional(z.string()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type FormSchema = z.infer<typeof formSchema>;
|
export type FormSchema = z.infer<typeof formSchema>;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export interface ShellToolConfig {
|
|||||||
antSwordPass?: string;
|
antSwordPass?: string;
|
||||||
headerName?: string;
|
headerName?: string;
|
||||||
headerValue?: string;
|
headerValue?: string;
|
||||||
|
shellClassBase64?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommandShellToolConfig {
|
export interface CommandShellToolConfig {
|
||||||
@@ -66,11 +67,15 @@ export interface InjectorConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ConfigResponseType {
|
export interface ConfigResponseType {
|
||||||
servers: string[];
|
servers: ServerConfig;
|
||||||
core: MainConfig;
|
core: MainConfig;
|
||||||
packers: PackerConfig;
|
packers: PackerConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ServerConfig {
|
||||||
|
[serverName: string]: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface MainConfig {
|
export interface MainConfig {
|
||||||
[serverName: string]: {
|
[serverName: string]: {
|
||||||
[toolName: string]: string[];
|
[toolName: string]: string[];
|
||||||
@@ -117,4 +122,5 @@ export enum ShellToolType {
|
|||||||
AntSword = "AntSword",
|
AntSword = "AntSword",
|
||||||
Suo5 = "Suo5",
|
Suo5 = "Suo5",
|
||||||
NeoreGeorg = "NeoreGeorg",
|
NeoreGeorg = "NeoreGeorg",
|
||||||
|
Custom = "Custom",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export function transformToPostData(formValue: FormSchema) {
|
|||||||
antSwordPass: formValue.antSwordPass,
|
antSwordPass: formValue.antSwordPass,
|
||||||
headerName: formValue.headerName,
|
headerName: formValue.headerName,
|
||||||
headerValue: formValue.headerValue,
|
headerValue: formValue.headerValue,
|
||||||
|
shellClassBase64: formValue.shellClassBase64,
|
||||||
};
|
};
|
||||||
|
|
||||||
const injectorConfig: InjectorConfig = {
|
const injectorConfig: InjectorConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user