mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
feat: show urlPattern option when needed
This commit is contained in:
-4
@@ -25,10 +25,6 @@ public class SpringWebFluxWebFilterInjector {
|
||||
new SpringWebFluxWebFilterInjector();
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return "{{urlPattern}}";
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return "{{className}}";
|
||||
}
|
||||
|
||||
-4
@@ -20,10 +20,6 @@ public class SpringWebMvcInterceptorInjector {
|
||||
new SpringWebMvcInterceptorInjector();
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return "{{urlPattern}}";
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return "{{className}}";
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { shouldHidden } from "@/lib/utils";
|
||||
import {
|
||||
AntSwordShellToolConfig,
|
||||
BehinderShellToolConfig,
|
||||
@@ -33,11 +34,13 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: Genera
|
||||
<CopyableField label={t("mainConfig.server")} text={generateResult?.shellConfig.server} />
|
||||
<CopyableField label={t("mainConfig.shellTool")} text={generateResult?.shellConfig.shellTool} />
|
||||
<CopyableField label={t("mainConfig.shellMountType")} text={generateResult?.shellConfig.shellType} />
|
||||
<CopyableField
|
||||
label={t("mainConfig.urlPattern")}
|
||||
text={generateResult?.injectorConfig.urlPattern}
|
||||
value={generateResult?.injectorConfig.urlPattern}
|
||||
/>
|
||||
{!shouldHidden(generateResult?.shellConfig?.shellType) && (
|
||||
<CopyableField
|
||||
label={t("mainConfig.urlPattern")}
|
||||
text={generateResult?.injectorConfig.urlPattern}
|
||||
value={generateResult?.injectorConfig.urlPattern}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{generateResult?.shellConfig.shellTool !== ShellToolType.Custom && <Separator className="my-2" />}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
@@ -72,7 +75,6 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: Genera
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
/>
|
||||
<CopyableField label={t("shellToolConfig.godzillaPayload")} text="JavaDynamicPayload" />
|
||||
<CopyableField label={t("shellToolConfig.godzillaEncryptor")} text="JAVA_AES_BASE64" />
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzillaHeader")}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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>
|
||||
<TooltipTrigger asChild>
|
||||
<InfoIcon className="cursor-pointer h-4" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>{t("tips.servletUrlPattern")}</p>
|
||||
<p>{t("tips.controllerUrlPattern")}</p>
|
||||
<p>{t("tips.handlerUrlPattern")}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
import { UrlPatternTip } from "@/components/tips/url-pattern-tip.tsx";
|
||||
import { FormField, FormItem, FormLabel } from "@/components/ui/form.tsx";
|
||||
import { FormField, FormFieldItem, FormFieldLabel, FormMessage } from "@/components/ui/form.tsx";
|
||||
import { Input } from "@/components/ui/input.tsx";
|
||||
import { shouldHidden } from "@/lib/utils";
|
||||
import { FormSchema } from "@/types/schema.ts";
|
||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<FormSchema> }>) {
|
||||
const { t } = useTranslation();
|
||||
const shellType = form.watch("shellType");
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="urlPattern"
|
||||
render={({ field }) => (
|
||||
<FormItem className="gap-1">
|
||||
<FormLabel className="h-6 flex items-center gap-1">
|
||||
{t("mainConfig.urlPattern")} <UrlPatternTip />
|
||||
</FormLabel>
|
||||
<Input {...field} placeholder={t("placeholders.input")} className="h-8" />
|
||||
</FormItem>
|
||||
<FormFieldItem className={shouldHidden(shellType) ? "hidden" : "grid"}>
|
||||
<FormFieldLabel>{t("mainConfig.urlPattern")}</FormFieldLabel>
|
||||
<Input {...field} placeholder={t("placeholders.input")} />
|
||||
<FormMessage />
|
||||
</FormFieldItem>
|
||||
)}
|
||||
/>
|
||||
</FormProvider>
|
||||
|
||||
@@ -47,3 +47,17 @@ export function formatBytes(bytes: number) {
|
||||
const kbValue = Number.parseFloat((bytes / k ** 1).toFixed(1));
|
||||
return `${kbValue} ${sizes[1]}`;
|
||||
}
|
||||
|
||||
export function shouldHidden(shellType: string | undefined) {
|
||||
if (shellType === undefined) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
shellType.endsWith("Listener") ||
|
||||
shellType.endsWith("Valve") ||
|
||||
shellType.startsWith("Agent") ||
|
||||
shellType.endsWith("Interceptor") ||
|
||||
shellType.endsWith("NettyHandler") ||
|
||||
shellType.endsWith("WebFilter")
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user