feat: support command encryptor

This commit is contained in:
ReaJason
2025-05-14 00:34:32 +08:00
parent 7e27d71f52
commit ba9424c97e
26 changed files with 456 additions and 187 deletions
BIN
View File
Binary file not shown.
+45 -45
View File
@@ -15,73 +15,73 @@
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.14.0",
"@types/react": "^19.1.0",
"@types/node": "^22.15.2",
"@types/react": "^19.1.2",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/react-dom": "^19.1.1",
"@types/react-dom": "^19.1.2",
"@types/react-syntax-highlighter": "^15.5.13",
"@vitejs/plugin-react": "^4.3.4",
"@vitejs/plugin-react": "^4.4.1",
"rimraf": "^6.0.1",
"tailwindcss": "^4.1.3",
"tailwindcss": "^4.1.4",
"typescript": "^5.8.3",
"vite": "^6.2.5",
"vite": "^6.3.3",
"vite-bundle-visualizer": "^1.2.1"
},
"dependencies": {
"@hookform/resolvers": "^5.0.1",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-aspect-ratio": "^1.1.2",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-collapsible": "^1.1.3",
"@radix-ui/react-context-menu": "^2.2.6",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.6",
"@radix-ui/react-hover-card": "^1.1.6",
"@radix-ui/react-label": "^2.1.2",
"@radix-ui/react-menubar": "^1.1.6",
"@radix-ui/react-navigation-menu": "^1.2.5",
"@radix-ui/react-popover": "^1.1.6",
"@radix-ui/react-progress": "^1.1.2",
"@radix-ui/react-radio-group": "^1.2.3",
"@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-select": "^2.1.6",
"@radix-ui/react-separator": "^1.1.2",
"@radix-ui/react-slider": "^1.2.3",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.1.3",
"@radix-ui/react-tabs": "^1.1.3",
"@radix-ui/react-toggle": "^1.1.2",
"@radix-ui/react-toggle-group": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8",
"@tailwindcss/vite": "^4.1.3",
"@tanstack/react-query": "^5.71.10",
"@radix-ui/react-accordion": "^1.2.8",
"@radix-ui/react-alert-dialog": "^1.1.11",
"@radix-ui/react-aspect-ratio": "^1.1.4",
"@radix-ui/react-avatar": "^1.1.7",
"@radix-ui/react-checkbox": "^1.2.3",
"@radix-ui/react-collapsible": "^1.1.8",
"@radix-ui/react-context-menu": "^2.2.12",
"@radix-ui/react-dialog": "^1.1.11",
"@radix-ui/react-dropdown-menu": "^2.1.12",
"@radix-ui/react-hover-card": "^1.1.11",
"@radix-ui/react-label": "^2.1.4",
"@radix-ui/react-menubar": "^1.1.12",
"@radix-ui/react-navigation-menu": "^1.2.10",
"@radix-ui/react-popover": "^1.1.11",
"@radix-ui/react-progress": "^1.1.4",
"@radix-ui/react-radio-group": "^1.3.4",
"@radix-ui/react-scroll-area": "^1.2.6",
"@radix-ui/react-select": "^2.2.2",
"@radix-ui/react-separator": "^1.1.4",
"@radix-ui/react-slider": "^1.3.2",
"@radix-ui/react-slot": "^1.2.0",
"@radix-ui/react-switch": "^1.2.2",
"@radix-ui/react-tabs": "^1.1.9",
"@radix-ui/react-toggle": "^1.1.6",
"@radix-ui/react-toggle-group": "^1.1.7",
"@radix-ui/react-tooltip": "^1.2.4",
"@tailwindcss/vite": "^4.1.4",
"@tanstack/react-query": "^5.74.7",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^4.1.0",
"embla-carousel-react": "^8.6.0",
"i18next": "^24.2.3",
"i18next": "^25.0.1",
"input-otp": "^1.4.2",
"lucide-react": "^0.487.0",
"lucide-react": "^0.503.0",
"react": "^19.1.0",
"react-copy-to-clipboard": "^5.1.0",
"react-day-picker": "9.6.4",
"react-day-picker": "9.6.7",
"react-dom": "^19.1.0",
"react-hook-form": "^7.55.0",
"react-i18next": "^15.4.1",
"react-resizable-panels": "^2.1.7",
"react-router": "^7.5.0",
"react-router-dom": "^7.5.0",
"react-hook-form": "^7.56.1",
"react-i18next": "^15.5.1",
"react-resizable-panels": "^2.1.8",
"react-router": "^7.5.2",
"react-router-dom": "^7.5.2",
"react-syntax-highlighter": "^15.6.1",
"recharts": "^2.15.2",
"recharts": "^2.15.3",
"sonner": "^2.0.3",
"tailwind-merge": "^3.1.0",
"tailwind-merge": "^3.2.0",
"tailwind-scrollbar": "^4.0.2",
"tailwindcss-animate": "^1.0.7",
"vaul": "^1.1.2",
"zod": "^3.24.2"
"zod": "^3.24.3"
},
"trustedDependencies": ["@biomejs/biome"]
}
@@ -6,10 +6,11 @@ import {
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "../ui/alert-dialog";
import { AlertDialogFooter, AlertDialogHeader } from "../ui/alert-dialog";
import { Button } from "../ui/button";
export function FeedbackAlert() {
+63 -14
View File
@@ -1,9 +1,13 @@
import { env } from "@/config";
import { FormSchema } from "@/types/schema";
import { useQuery } from "@tanstack/react-query";
import { useEffect, useState } from "react";
import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card";
import { FormControl, FormField, FormItem, FormLabel } from "../ui/form";
import { Input } from "../ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select";
import { TabsContent } from "../ui/tabs";
import { OptionalClassFormField } from "./classname-field";
import { ShellTypeFormField } from "./shelltype-field";
@@ -14,6 +18,26 @@ export function CommandTabContent({
shellTypes,
}: Readonly<{ form: UseFormReturn<FormSchema>; shellTypes: Array<string> }>) {
const { t } = useTranslation();
const { data } = useQuery<Array<string>>({
queryKey: ["commandEncryptor"],
queryFn: async () => {
const response = await fetch(`${env.API_URL}/config/command/encryptors`);
return await response.json();
},
});
const rawEncryptors = data ?? [];
const [encryptors, setEncryptors] = useState<Array<string>>(rawEncryptors);
const shellType = form.watch("shellType");
useEffect(() => {
if (shellType.startsWith("Agent")) {
setEncryptors(["RAW"]);
} else {
setEncryptors(rawEncryptors);
}
}, [shellType, rawEncryptors]);
return (
<FormProvider {...form}>
<TabsContent value="Command">
@@ -23,20 +47,45 @@ export function CommandTabContent({
<ShellTypeFormField form={form} shellTypes={shellTypes} />
<UrlPatternFormField form={form} />
</div>
<FormField
control={form.control}
name="commandParamName"
render={({ field }) => (
<FormItem className="gap-1">
<FormLabel className="h-6 flex items-center gap-1">
{t("shellToolConfig.paramName")} {t("optional")}
</FormLabel>
<FormControl>
<Input {...field} placeholder={t("shellToolConfig.paramName")} className="h-8" />
</FormControl>
</FormItem>
)}
/>
<div className="grid grid-cols-2 gap-2">
<FormField
control={form.control}
name="commandParamName"
render={({ field }) => (
<FormItem className="gap-1">
<FormLabel className="h-6 flex items-center gap-1">
{t("shellToolConfig.paramName")} {t("optional")}
</FormLabel>
<FormControl>
<Input {...field} placeholder={t("shellToolConfig.paramName")} className="h-8" />
</FormControl>
</FormItem>
)}
/>
<FormField
control={form.control}
name="encryptor"
render={({ field }) => (
<FormItem className="gap-1">
<FormLabel className="h-6 flex items-center">{t("shellToolConfig.encryptor")}</FormLabel>
<Select onValueChange={field.onChange} value={field.value} defaultValue="RAW">
<FormControl>
<SelectTrigger className="h-8">
<SelectValue placeholder={t("placeholders.select")} />
</SelectTrigger>
</FormControl>
<SelectContent key={data?.join(",")}>
{encryptors?.map((v) => (
<SelectItem key={v} value={v}>
{v}
</SelectItem>
))}
</SelectContent>
</Select>
</FormItem>
)}
/>
</div>
<OptionalClassFormField form={form} />
</CardContent>
</Card>
+2 -1
View File
@@ -108,7 +108,8 @@
"paramName": "Param Name",
"pass": "Pass",
"suo5Header": "AdvanceConfiguration -> Request Header",
"base64String": "Shell Class"
"base64String": "Shell Class",
"encryptor": "Encryptor"
},
"success": {
"generated": "Generation successful"
+2 -1
View File
@@ -108,7 +108,8 @@
"paramName": "请求参数",
"pass": "密码",
"suo5Header": "高级配置 -> 请求头",
"base64String": "内存马类"
"base64String": "内存马类",
"encryptor": "加密器"
},
"success": {
"generated": "生成成功"
+1
View File
@@ -20,6 +20,7 @@ export const formSchema = z.object({
packingMethod: z.string().min(1),
shrink: z.optional(z.boolean()),
shellClassBase64: z.optional(z.string()),
encryptor: z.optional(z.string()),
});
export type FormSchema = z.infer<typeof formSchema>;
+1
View File
@@ -19,6 +19,7 @@ export interface ShellToolConfig {
headerName?: string;
headerValue?: string;
shellClassBase64?: string;
encryptor?: string;
}
export interface CommandShellToolConfig {
+1
View File
@@ -43,6 +43,7 @@ export function transformToPostData(formValue: FormSchema) {
headerName: formValue.headerName,
headerValue: formValue.headerValue,
shellClassBase64: formValue.shellClassBase64,
encryptor: formValue.encryptor,
};
const injectorConfig: InjectorConfig = {