mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 23:11:52 +08:00
feat: support i18n [skip ci]
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { LanguagesIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "./ui/button";
|
||||
|
||||
export function LanguageSwitcher() {
|
||||
const { i18n } = useTranslation();
|
||||
|
||||
const toggleLanguage = () => {
|
||||
const newLang = i18n.language === "en" ? "zh" : "en";
|
||||
i18n.changeLanguage(newLang);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={toggleLanguage}
|
||||
title={i18n.language === "en" ? "Switch to Chinese" : "切换到英文"}
|
||||
>
|
||||
<LanguagesIcon className="h-5 w-5" />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { cn } from "@/lib/utils.ts";
|
||||
import { ArrowUpRightIcon, ServerIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const JDKVersion = [
|
||||
{ name: "Java6", value: "50" },
|
||||
@@ -34,9 +35,17 @@ export function MainConfigCard({
|
||||
servers?: string[];
|
||||
}) {
|
||||
const [shellToolMap, setShellToolMap] = useState<{ [toolName: string]: string[] }>();
|
||||
const [shellTools, setShellTools] = useState<string[]>(["Behinder", "Godzilla", "Command"]);
|
||||
const [shellTools, setShellTools] = useState<string[]>([
|
||||
"Behinder",
|
||||
"Godzilla",
|
||||
"Command",
|
||||
"AntSword",
|
||||
"Suo5",
|
||||
"Neo-reGeorg",
|
||||
]);
|
||||
const [shellTypes, setShellTypes] = useState<string[]>([]);
|
||||
const shellTool = form.watch("shellTool");
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleServerChange = (value: string) => {
|
||||
if (mainConfig) {
|
||||
@@ -97,7 +106,7 @@ export function MainConfigCard({
|
||||
<CardHeader className="pb-1">
|
||||
<CardTitle className="text-md flex items-center gap-2">
|
||||
<ServerIcon className="h-5" />
|
||||
<span>生成配置</span>
|
||||
<span>{t("configs.main-config")}</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -107,7 +116,7 @@ export function MainConfigCard({
|
||||
name="server"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>目标服务</FormLabel>
|
||||
<FormLabel>{t("mainConfig.server")}</FormLabel>
|
||||
<Select
|
||||
onValueChange={(v) => {
|
||||
field.onChange(v);
|
||||
@@ -117,7 +126,7 @@ export function MainConfigCard({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="h-8">
|
||||
<SelectValue placeholder="请选择" />
|
||||
<SelectValue placeholder={t("placeholders.select")} />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -129,14 +138,14 @@ export function MainConfigCard({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormDescription className="flex items-center">
|
||||
下拉列表找不到目标服务 ?
|
||||
{t("tips.targetServerNotFound")}
|
||||
<a
|
||||
href="https://github.com/ReaJason/MemShellParty/issues/new?template=%E8%AF%B7%E6%B1%82%E9%80%82%E9%85%8D.md"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex items-center underline"
|
||||
>
|
||||
请求适配
|
||||
{t("tips.targetServerRequest")}
|
||||
<ArrowUpRightIcon className="h-4" />
|
||||
</a>
|
||||
</FormDescription>
|
||||
@@ -149,7 +158,7 @@ export function MainConfigCard({
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col mt-1">
|
||||
<Label className="flex items-center">
|
||||
目标 JRE 版本(可选) <JreTip />
|
||||
{t("mainConfig.jre")} {t("optional")} <JreTip />
|
||||
</Label>
|
||||
<Select
|
||||
onValueChange={(v) => {
|
||||
@@ -164,7 +173,7 @@ export function MainConfigCard({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="h-8">
|
||||
<SelectValue placeholder="请选择" />
|
||||
<SelectValue placeholder={t("placeholders.select")} />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -188,7 +197,7 @@ export function MainConfigCard({
|
||||
<FormControl>
|
||||
<Switch id="debug" checked={field.value} onCheckedChange={field.onChange} />
|
||||
</FormControl>
|
||||
<FormLabel htmlFor="debug">开启调试</FormLabel>
|
||||
<FormLabel htmlFor="debug">{t("mainConfig.debug")}</FormLabel>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -200,7 +209,7 @@ export function MainConfigCard({
|
||||
<FormControl>
|
||||
<Switch id="bypassJavaModule" checked={field.value} onCheckedChange={field.onChange} />
|
||||
</FormControl>
|
||||
<Label htmlFor="bypassJavaModule">绕过 Java 模块系统限制</Label>
|
||||
<Label htmlFor="bypassJavaModule">{t("mainConfig.bypassJavaModule")}</Label>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -214,7 +223,9 @@ export function MainConfigCard({
|
||||
}}
|
||||
className="w-full"
|
||||
>
|
||||
<TabsList className={cn("grid w-full", `grid-cols-${shellTools.length}`)}>
|
||||
<TabsList
|
||||
className={cn("grid w-full", shellTools.length > 3 ? "grid-flow-col" : `grid-cols-${shellTools.length}`)}
|
||||
>
|
||||
{shellTools.map((shellTool) => (
|
||||
<TabsTrigger key={shellTool} value={shellTool}>
|
||||
{shellTool}
|
||||
@@ -224,12 +235,16 @@ export function MainConfigCard({
|
||||
<BehinderTabContent form={form} shellTypes={shellTypes} />
|
||||
<GodzillaTabContent form={form} shellTypes={shellTypes} />
|
||||
<CommandTabContent form={form} shellTypes={shellTypes} />
|
||||
<AntSwordTabContent />
|
||||
<Suo5TabContent />
|
||||
<NeoreGeorgTabContent />
|
||||
</Tabs>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function ShellTypeFormField({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<FormField
|
||||
@@ -237,11 +252,11 @@ function ShellTypeFormField({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="shellType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>内存马挂载类型</FormLabel>
|
||||
<FormLabel>{t("mainConfig.shellMountType")}</FormLabel>
|
||||
<Select onValueChange={field.onChange} value={field.value}>
|
||||
<FormControl>
|
||||
<SelectTrigger className="h-8">
|
||||
<SelectValue placeholder="请选择" />
|
||||
<SelectValue placeholder={t("placeholders.select")} />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent key={shellTypes.join(",")}>
|
||||
@@ -252,7 +267,7 @@ function ShellTypeFormField({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
</SelectItem>
|
||||
))
|
||||
) : (
|
||||
<SelectItem value=" ">请先选择内存马工具类型</SelectItem>
|
||||
<SelectItem value=" ">{t("tips.shellToolNotSelected")}</SelectItem>
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
@@ -264,6 +279,7 @@ function ShellTypeFormField({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
}
|
||||
|
||||
function UrlPatternFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<FormField
|
||||
@@ -272,9 +288,9 @@ function UrlPatternFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col mt-1">
|
||||
<Label className="flex items-center">
|
||||
请求路径 <UrlPatternTip />
|
||||
{t("mainConfig.urlPattern")} <UrlPatternTip />
|
||||
</Label>
|
||||
<Input {...field} placeholder="请输入" className="h-8" />
|
||||
<Input {...field} placeholder={t("placeholders.input")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -283,6 +299,7 @@ function UrlPatternFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
}
|
||||
|
||||
function OptionalClassFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<FormField
|
||||
@@ -290,8 +307,10 @@ function OptionalClassFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
name="shellClassName"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>内存马类名(可选)</FormLabel>
|
||||
<Input id="shellClassName" {...field} placeholder="请输入" className="h-8" />
|
||||
<FormLabel>
|
||||
{t("mainConfig.shellClassName")} {t("optional")}
|
||||
</FormLabel>
|
||||
<Input id="shellClassName" {...field} placeholder={t("placeholders.input")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -300,8 +319,10 @@ function OptionalClassFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
name="injectorClassName"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>注入器类名(可选)</FormLabel>
|
||||
<Input id="injectorClassName" {...field} placeholder="请输入" className="h-8" />
|
||||
<FormLabel>
|
||||
{t("mainConfig.injectorClassName")} {t("optional")}
|
||||
</FormLabel>
|
||||
<Input id="injectorClassName" {...field} placeholder={t("placeholders.input")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -310,6 +331,7 @@ function OptionalClassFormField({ form }: { form: UseFormReturn<FormSchema> }) {
|
||||
}
|
||||
|
||||
function BehinderTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<TabsContent value="Behinder">
|
||||
@@ -324,8 +346,8 @@ function BehinderTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="behinderPass"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>连接密码</FormLabel>
|
||||
<Input {...field} placeholder="Pass" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.behinderPass")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.pass")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -335,8 +357,8 @@ function BehinderTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="behinderHeaderName"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>请求头键</FormLabel>
|
||||
<Input {...field} placeholder="Header Name" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.headerName")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.headerName")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -345,8 +367,8 @@ function BehinderTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="behinderHeaderValue"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>请求头值</FormLabel>
|
||||
<Input {...field} placeholder="Header Value" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.headerValue")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.headerValue")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -360,6 +382,7 @@ function BehinderTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
}
|
||||
|
||||
function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<TabsContent value="Godzilla">
|
||||
@@ -375,8 +398,8 @@ function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="godzillaPass"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>密码</FormLabel>
|
||||
<Input {...field} placeholder="Pass" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.pass")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.pass")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -385,8 +408,8 @@ function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="godzillaKey"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>密钥</FormLabel>
|
||||
<Input {...field} placeholder="Key" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.key")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.key")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -395,8 +418,8 @@ function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="godzillaHeaderName"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>请求头键</FormLabel>
|
||||
<Input {...field} placeholder="Header Name" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.headerName")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.headerName")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -405,8 +428,8 @@ function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
name="godzillaHeaderValue"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>请求头值</FormLabel>
|
||||
<Input {...field} placeholder="Header Value" className="h-8" />
|
||||
<FormLabel>{t("shellToolConfig.headerValue")}</FormLabel>
|
||||
<Input {...field} placeholder={t("shellToolConfig.headerValue")} className="h-8" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -420,6 +443,7 @@ function GodzillaTabContent({ form, shellTypes }: { form: UseFormReturn<FormSche
|
||||
}
|
||||
|
||||
function CommandTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchema>; shellTypes: Array<string> }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<TabsContent value="Command">
|
||||
@@ -434,11 +458,10 @@ function CommandTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchem
|
||||
name="commandParamName"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-1">
|
||||
<FormLabel>请求参数</FormLabel>
|
||||
<FormLabel>{t("shellToolConfig.paramName")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="请输入" className="h-8" />
|
||||
<Input {...field} placeholder={t("shellToolConfig.paramName")} className="h-8" />
|
||||
</FormControl>
|
||||
<FormDescription>填写接收命令的请求参数,例如填 cmd 即 `?cmd=whoami` 来执行命令</FormDescription>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
@@ -449,3 +472,45 @@ function CommandTabContent({ form, shellTypes }: { form: UseFormReturn<FormSchem
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function AntSwordTabContent() {
|
||||
return (
|
||||
<TabsContent value="AntSword">
|
||||
<Card>
|
||||
<CardContent className="space-y-2 mt-4">
|
||||
<div className="flex items-center justify-center">
|
||||
<span className="text-gray-500">WIP</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
);
|
||||
}
|
||||
|
||||
function Suo5TabContent() {
|
||||
return (
|
||||
<TabsContent value="Suo5">
|
||||
<Card>
|
||||
<CardContent className="space-y-2 mt-4">
|
||||
<div className="flex items-center justify-center">
|
||||
<span className="text-gray-500">WIP</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
);
|
||||
}
|
||||
|
||||
function NeoreGeorgTabContent() {
|
||||
return (
|
||||
<TabsContent value="Neo-reGeorg">
|
||||
<Card>
|
||||
<CardContent className="space-y-2 mt-4">
|
||||
<div className="flex items-center justify-center">
|
||||
<span className="text-gray-500">WIP</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ import { PackerConfig } from "@/types/shell.ts";
|
||||
import { PackageIcon } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
type Option = {
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export function PackageConfigCard({
|
||||
packerConfig,
|
||||
@@ -14,12 +20,13 @@ export function PackageConfigCard({
|
||||
packerConfig: PackerConfig | undefined;
|
||||
form: UseFormReturn<FormSchema>;
|
||||
}) {
|
||||
const [options, setOptions] = useState<Array<Array<string>>>([]);
|
||||
const [options, setOptions] = useState<Array<Option>>([]);
|
||||
|
||||
const shellType = form.watch("shellType");
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
const filteredOptions = Object.entries(packerConfig ?? {}).filter(([name, _]) => {
|
||||
const filteredOptions = (packerConfig ?? []).filter((name) => {
|
||||
if (!shellType || shellType === " ") {
|
||||
return true;
|
||||
}
|
||||
@@ -28,18 +35,25 @@ export function PackageConfigCard({
|
||||
}
|
||||
return !name.startsWith("Agent");
|
||||
});
|
||||
setOptions(filteredOptions);
|
||||
setOptions(
|
||||
filteredOptions.map((name) => {
|
||||
return {
|
||||
name: t(`packageConfig.packer.${name}`),
|
||||
value: name,
|
||||
};
|
||||
}),
|
||||
);
|
||||
if (filteredOptions.length > 0) {
|
||||
form.setValue("packingMethod", filteredOptions[0][0]);
|
||||
form.setValue("packingMethod", filteredOptions[0]);
|
||||
}
|
||||
}, [form, packerConfig, shellType]); // Add shellType to the dependency array
|
||||
}, [form, packerConfig, shellType, t]);
|
||||
|
||||
return (
|
||||
<Card className="w-full">
|
||||
<CardHeader className="pb-1">
|
||||
<CardTitle className="text-md flex items-center gap-2">
|
||||
<PackageIcon className="h-5" />
|
||||
<span>打包配置</span>
|
||||
<span>{t("configs.package-config")}</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -49,10 +63,10 @@ export function PackageConfigCard({
|
||||
name="packingMethod"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-3">
|
||||
<FormLabel>打包方式</FormLabel>
|
||||
<FormLabel>{t("packageConfig.title")}</FormLabel>
|
||||
<FormControl>
|
||||
<RadioGroup onValueChange={field.onChange} value={field.value} className="grid grid-cols-3">
|
||||
{options.map(([name, value]) => (
|
||||
{options.map(({ name, value }) => (
|
||||
<FormItem key={value} className="flex items-center space-x-3 space-y-0">
|
||||
<FormControl>
|
||||
<RadioGroupItem value={value} id={value} />
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function QuickUsage() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>快速使用</CardTitle>
|
||||
<CardTitle>{t("quickUsage.title")}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ol className="list-decimal list-inside space-y-4 text-sm">
|
||||
<li>选择目标服务</li>
|
||||
<li>选择内存马功能,Godzilla、Behinder 或者其他</li>
|
||||
<li>选择内存马挂载类型,Filter、Listener 或者其他</li>
|
||||
<li>选择打包方式</li>
|
||||
<li>点击生成内存马</li>
|
||||
<li>{t("quickUsage.step1")}</li>
|
||||
<li>{t("quickUsage.step2")}</li>
|
||||
<li>{t("quickUsage.step3")}</li>
|
||||
<li>{t("quickUsage.step4")}</li>
|
||||
<li>{t("quickUsage.step5")}</li>
|
||||
</ol>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
} from "@/types/shell.ts";
|
||||
import { CircleHelpIcon, TriangleAlertIcon } from "lucide-react";
|
||||
import { Fragment } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
function AgentResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) {
|
||||
return (
|
||||
@@ -77,25 +79,26 @@ function AgentResult({ packResult, generateResult }: { packResult: string; gener
|
||||
}
|
||||
|
||||
function FeedbackAlert() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button variant="outline" type="button">
|
||||
<CircleHelpIcon /> 内存马利用失败 ?
|
||||
<CircleHelpIcon /> {t("shellNotWork.title")}
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>内存马利用失败 ?</AlertDialogTitle>
|
||||
<AlertDialogTitle>{t("shellNotWork.title")}</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
<ol>
|
||||
<li>1. 尝试开启调试模式,重新生成内存马并注入,查看控制台或日志</li>
|
||||
<li>2. 如果出现异常堆栈信息,或未见异常,请截图当前生成界面以及异常日志,并尽可能描述目标环境进行反馈</li>
|
||||
<li>{t("shellNotWork.step1")}</li>
|
||||
<li>{t("shellNotWork.step2")}</li>
|
||||
</ol>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>取消</AlertDialogCancel>
|
||||
<AlertDialogCancel>{t("cancel")}</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={() =>
|
||||
window.open(
|
||||
@@ -103,7 +106,7 @@ function FeedbackAlert() {
|
||||
)
|
||||
}
|
||||
>
|
||||
反馈
|
||||
{t("feedback")}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
@@ -112,36 +115,40 @@ function FeedbackAlert() {
|
||||
}
|
||||
|
||||
function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center justify-between">
|
||||
基础信息
|
||||
{t("generateResult.basicInfo")}
|
||||
<FeedbackAlert />
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-2">
|
||||
<CopyableField label="目标服务" text={generateResult?.shellConfig.server} />
|
||||
<CopyableField label="内存马功能" text={generateResult?.shellConfig.shellTool} />
|
||||
<CopyableField label={t("mainConfig.server")} text={generateResult?.shellConfig.server} />
|
||||
<CopyableField label={t("mainConfig.shellTool")} text={generateResult?.shellConfig.shellTool} />
|
||||
</div>
|
||||
<CopyableField label="内存马挂载类型" text={generateResult?.shellConfig.shellType} />
|
||||
<CopyableField label={t("mainConfig.shellMountType")} text={generateResult?.shellConfig.shellType} />
|
||||
<CopyableField
|
||||
label="请求路径"
|
||||
label={t("mainConfig.urlPattern")}
|
||||
text={generateResult?.injectorConfig.urlPattern}
|
||||
value={generateResult?.injectorConfig.urlPattern}
|
||||
/>
|
||||
{generateResult?.shellConfig.shellTool === "Behinder" && (
|
||||
<Fragment>
|
||||
<CopyableField label="脚本类型" text="jsp" />
|
||||
<CopyableField label="加密类型" text="默认" />
|
||||
<CopyableField label={t("shellToolConfig.behinderScriptType")} text="jsp" />
|
||||
<CopyableField
|
||||
label="连接密码"
|
||||
label={t("shellToolConfig.behinderEncryptType")}
|
||||
text={t("shellToolConfig.behinderDefaultEncryptType")}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinderPass")}
|
||||
text={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label="自定义请求头"
|
||||
label={t("shellToolConfig.customHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
/>
|
||||
@@ -150,19 +157,19 @@ function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) {
|
||||
{generateResult?.shellConfig.shellTool === "Godzilla" && (
|
||||
<Fragment>
|
||||
<CopyableField
|
||||
label="密码"
|
||||
label={t("shellToolConfig.pass")}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label="密钥"
|
||||
label={t("shellToolConfig.key")}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
/>
|
||||
<CopyableField label="有效载荷" text="JavaDynamicPayload" />
|
||||
<CopyableField label="加密器" text="JAVA_AES_BASE64" />
|
||||
<CopyableField label={t("shellToolConfig.godzillaPayload")} text="JavaDynamicPayload" />
|
||||
<CopyableField label={t("shellToolConfig.godzillaEncryptor")} text="JAVA_AES_BASE64" />
|
||||
<CopyableField
|
||||
label="请求配置 -> 请求头"
|
||||
label={t("shellToolConfig.godzillaHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
/>
|
||||
@@ -171,19 +178,19 @@ function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) {
|
||||
{generateResult?.shellConfig.shellTool === "Command" && (
|
||||
<Fragment>
|
||||
<CopyableField
|
||||
label="接收命令请求参数"
|
||||
label={t("shellToolConfig.paramName")}
|
||||
text={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
value={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
<CopyableField
|
||||
label="注入器类名"
|
||||
label={t("mainConfig.injectorClassName")}
|
||||
value={generateResult?.injectorClassName}
|
||||
text={`${generateResult?.injectorClassName} (${generateResult?.injectorSize} bytes)`}
|
||||
/>
|
||||
<CopyableField
|
||||
label="内存马类名"
|
||||
label={t("mainConfig.shellClassName")}
|
||||
value={generateResult?.shellClassName}
|
||||
text={`${generateResult?.shellClassName} (${generateResult?.shellSize} bytes)`}
|
||||
/>
|
||||
@@ -199,81 +206,95 @@ export function ShellResult({
|
||||
}: { packResult: string; packMethod: string; generateResult?: GenerateResult }) {
|
||||
const showCode = packMethod === "JSP";
|
||||
const isAgent = packMethod.startsWith("Agent");
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Tabs defaultValue="packResult">
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="packResult">打包结果</TabsTrigger>
|
||||
<TabsTrigger value="shell">内存马类</TabsTrigger>
|
||||
<TabsTrigger value="injector">注入器类</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="packResult" className="my-4">
|
||||
<div className="mb-4">
|
||||
{generateResult && <BasicInfo generateResult={generateResult} />}
|
||||
{!generateResult && <QuickUsage />}
|
||||
</div>
|
||||
{!isAgent && (
|
||||
<CodeViewer
|
||||
code={packResult}
|
||||
wrapLongLines={!showCode}
|
||||
showLineNumbers={showCode}
|
||||
language={showCode ? "java" : "text"}
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
{isAgent && <AgentResult packResult={packResult} generateResult={generateResult} />}
|
||||
</TabsContent>
|
||||
<TabsContent value="shell" className="mt-4">
|
||||
<Alert>
|
||||
<TriangleAlertIcon className="h-4 w-4" />
|
||||
<AlertTitle>Warning</AlertTitle>
|
||||
<AlertDescription>反编译还在开发中,因此当前仅能看到 base64 编码格式</AlertDescription>
|
||||
</Alert>
|
||||
<div className="gap-4 my-2 flex items-center justify-end">
|
||||
{generateResult && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="w-28"
|
||||
type="button"
|
||||
onClick={() => downloadBytes(generateResult?.shellBytesBase64Str, generateResult?.shellClassName)}
|
||||
>
|
||||
下载 Class
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<CodeViewer
|
||||
showLineNumbers={false}
|
||||
wrapLongLines={true}
|
||||
code={generateResult?.shellBytesBase64Str ?? ""}
|
||||
language="text"
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="injector" className="mt-4">
|
||||
<Alert>
|
||||
<TriangleAlertIcon className="h-4 w-4" />
|
||||
<AlertTitle>Warning</AlertTitle>
|
||||
<AlertDescription>反编译还在开发中,因此当前仅能看到 base64 编码格式</AlertDescription>
|
||||
</Alert>
|
||||
<div className="gap-4 my-2 flex items-center justify-end">
|
||||
{generateResult && (
|
||||
<Button
|
||||
size="sm"
|
||||
className="w-28"
|
||||
variant="outline"
|
||||
type="button"
|
||||
onClick={() => downloadBytes(generateResult?.injectorBytesBase64Str, generateResult?.injectorClassName)}
|
||||
>
|
||||
下载 Class
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<CodeViewer
|
||||
showLineNumbers={false}
|
||||
wrapLongLines={true}
|
||||
code={generateResult?.injectorBytesBase64Str ?? ""}
|
||||
language="text"
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
<Fragment>
|
||||
{generateResult ? (
|
||||
<Tabs defaultValue="packResult">
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
<TabsTrigger value="packResult">{t("generateResult.title1")}</TabsTrigger>
|
||||
<TabsTrigger value="shell">{t("generateResult.title2")}</TabsTrigger>
|
||||
<TabsTrigger value="injector">{t("generateResult.title3")}</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="packResult" className="my-4">
|
||||
<div className="mb-4">
|
||||
<BasicInfo generateResult={generateResult} />
|
||||
</div>
|
||||
{!isAgent && (
|
||||
<CodeViewer
|
||||
code={packResult}
|
||||
wrapLongLines={!showCode}
|
||||
showLineNumbers={showCode}
|
||||
language={showCode ? "java" : "text"}
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
{isAgent && <AgentResult packResult={packResult} generateResult={generateResult} />}
|
||||
</TabsContent>
|
||||
<TabsContent value="shell" className="mt-4">
|
||||
<Alert>
|
||||
<TriangleAlertIcon className="h-4 w-4" />
|
||||
<AlertTitle>Warning</AlertTitle>
|
||||
<AlertDescription>{t("tips.decompileTip")}</AlertDescription>
|
||||
</Alert>
|
||||
<div className="gap-4 my-2 flex items-center justify-end">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="w-28"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!generateResult?.shellBytesBase64Str) {
|
||||
toast.warning(t("tips.shellBytesEmpty"));
|
||||
return;
|
||||
}
|
||||
downloadBytes(generateResult?.shellBytesBase64Str, generateResult?.shellClassName);
|
||||
}}
|
||||
>
|
||||
{t("download")} Class
|
||||
</Button>
|
||||
</div>
|
||||
<CodeViewer
|
||||
showLineNumbers={false}
|
||||
wrapLongLines={true}
|
||||
code={generateResult?.shellBytesBase64Str ?? ""}
|
||||
language="text"
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="injector" className="mt-4">
|
||||
<Alert>
|
||||
<TriangleAlertIcon className="h-4 w-4" />
|
||||
<AlertTitle>Warning</AlertTitle>
|
||||
<AlertDescription>{t("tips.decompileTip")}</AlertDescription>
|
||||
</Alert>
|
||||
<div className="gap-4 my-2 flex items-center justify-end">
|
||||
<Button
|
||||
size="sm"
|
||||
className="w-28"
|
||||
variant="outline"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!generateResult?.injectorBytesBase64Str) {
|
||||
toast.warning(t("tips.shellBytesEmpty"));
|
||||
return;
|
||||
}
|
||||
downloadBytes(generateResult?.injectorBytesBase64Str, generateResult?.injectorClassName);
|
||||
}}
|
||||
>
|
||||
{t("download")} Class
|
||||
</Button>
|
||||
</div>
|
||||
<CodeViewer
|
||||
showLineNumbers={false}
|
||||
wrapLongLines={true}
|
||||
code={generateResult?.injectorBytesBase64Str ?? ""}
|
||||
language="text"
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
) : (
|
||||
<QuickUsage />
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip.tsx";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function JreTip() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
@@ -9,8 +11,8 @@ export function JreTip() {
|
||||
<InfoIcon className="cursor-pointer h-4" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>目标 JRE 版本,一般而言为了最大的兼容性,默认 Java 6 即可,Java 高版本能加载低版本的字节码。</p>
|
||||
<p>特定情况下,例如 JDK8 才能使用 lambda 表达式,JDK9 以上存在模块限制时才需要选择特定的版本。</p>
|
||||
<p>{t("tips.jreTip")}</p>
|
||||
<p>{t("tips.jreTip2")}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip.tsx";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function UrlPatternTip() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
@@ -9,10 +11,9 @@ export function UrlPatternTip() {
|
||||
<InfoIcon className="cursor-pointer h-4" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>当使用 Servlet 内存马时必须写具体的 urlPattern,不能使用 /*,不然无法使用</p>
|
||||
<p>当使用 SpringMVC ControllerHandler 内存马时必须写具体的 urlPattern,不能使用 /*,不然无法使用</p>
|
||||
<p>当使用 SpringWebFlux HandlerMethod 内存马时必须写具体的 urlPattern,不能使用 /*,不然无法使用</p>
|
||||
<p>当使用 SpringWebFlux HandlerFunction 内存马时必须写具体的 urlPattern,不能使用 /*,不然无法使用</p>
|
||||
<p>{t("tips.servletUrlPattern")}</p>
|
||||
<p>{t("tips.controllerUrlPattern")}</p>
|
||||
<p>{t("tips.handlerUrlPattern")}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
Reference in New Issue
Block a user