mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-25 00:11:52 +08:00
feat: show urlPattern option when needed
This commit is contained in:
-4
@@ -25,10 +25,6 @@ public class SpringWebFluxWebFilterInjector {
|
|||||||
new SpringWebFluxWebFilterInjector();
|
new SpringWebFluxWebFilterInjector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrlPattern() {
|
|
||||||
return "{{urlPattern}}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return "{{className}}";
|
return "{{className}}";
|
||||||
}
|
}
|
||||||
|
|||||||
-4
@@ -20,10 +20,6 @@ public class SpringWebMvcInterceptorInjector {
|
|||||||
new SpringWebMvcInterceptorInjector();
|
new SpringWebMvcInterceptorInjector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrlPattern() {
|
|
||||||
return "{{urlPattern}}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return "{{className}}";
|
return "{{className}}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { shouldHidden } from "@/lib/utils";
|
||||||
import {
|
import {
|
||||||
AntSwordShellToolConfig,
|
AntSwordShellToolConfig,
|
||||||
BehinderShellToolConfig,
|
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.server")} text={generateResult?.shellConfig.server} />
|
||||||
<CopyableField label={t("mainConfig.shellTool")} text={generateResult?.shellConfig.shellTool} />
|
<CopyableField label={t("mainConfig.shellTool")} text={generateResult?.shellConfig.shellTool} />
|
||||||
<CopyableField label={t("mainConfig.shellMountType")} text={generateResult?.shellConfig.shellType} />
|
<CopyableField label={t("mainConfig.shellMountType")} text={generateResult?.shellConfig.shellType} />
|
||||||
<CopyableField
|
{!shouldHidden(generateResult?.shellConfig?.shellType) && (
|
||||||
label={t("mainConfig.urlPattern")}
|
<CopyableField
|
||||||
text={generateResult?.injectorConfig.urlPattern}
|
label={t("mainConfig.urlPattern")}
|
||||||
value={generateResult?.injectorConfig.urlPattern}
|
text={generateResult?.injectorConfig.urlPattern}
|
||||||
/>
|
value={generateResult?.injectorConfig.urlPattern}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{generateResult?.shellConfig.shellTool !== ShellToolType.Custom && <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">
|
||||||
@@ -72,7 +75,6 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: Genera
|
|||||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||||
value={(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.godzillaEncryptor")} text="JAVA_AES_BASE64" />
|
||||||
<CopyableField
|
<CopyableField
|
||||||
label={t("shellToolConfig.godzillaHeader")}
|
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, FormFieldItem, FormFieldLabel, FormMessage } from "@/components/ui/form.tsx";
|
||||||
import { FormField, FormItem, FormLabel } from "@/components/ui/form.tsx";
|
|
||||||
import { Input } from "@/components/ui/input.tsx";
|
import { Input } from "@/components/ui/input.tsx";
|
||||||
|
import { shouldHidden } from "@/lib/utils";
|
||||||
import { FormSchema } from "@/types/schema.ts";
|
import { FormSchema } from "@/types/schema.ts";
|
||||||
import { FormProvider, UseFormReturn } from "react-hook-form";
|
import { FormProvider, UseFormReturn } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<FormSchema> }>) {
|
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<FormSchema> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const shellType = form.watch("shellType");
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="urlPattern"
|
name="urlPattern"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="gap-1">
|
<FormFieldItem className={shouldHidden(shellType) ? "hidden" : "grid"}>
|
||||||
<FormLabel className="h-6 flex items-center gap-1">
|
<FormFieldLabel>{t("mainConfig.urlPattern")}</FormFieldLabel>
|
||||||
{t("mainConfig.urlPattern")} <UrlPatternTip />
|
<Input {...field} placeholder={t("placeholders.input")} />
|
||||||
</FormLabel>
|
<FormMessage />
|
||||||
<Input {...field} placeholder={t("placeholders.input")} className="h-8" />
|
</FormFieldItem>
|
||||||
</FormItem>
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
|
|||||||
@@ -47,3 +47,17 @@ export function formatBytes(bytes: number) {
|
|||||||
const kbValue = Number.parseFloat((bytes / k ** 1).toFixed(1));
|
const kbValue = Number.parseFloat((bytes / k ** 1).toFixed(1));
|
||||||
return `${kbValue} ${sizes[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