Skip to content

Commit 8c6a67d

Browse files
committed
feat: add loading component
1 parent 2db337d commit 8c6a67d

File tree

3 files changed

+56
-47
lines changed

3 files changed

+56
-47
lines changed

web/src/components/package-config-card.tsx

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,42 @@ export function PackageConfigCard({
6161
</CardTitle>
6262
</CardHeader>
6363
<CardContent>
64-
<FormProvider {...form}>
65-
<FormField
66-
control={form.control}
67-
name="packingMethod"
68-
render={({ field }) => (
69-
<FormItem className="space-y-3">
70-
<FormLabel className="h-6 flex items-center gap-1">{t("packageConfig.title")}</FormLabel>
71-
<FormControl>
72-
<RadioGroup
73-
onValueChange={field.onChange}
74-
value={field.value}
75-
className="grid grid-cols-2 md:grid-cols-3"
76-
>
77-
{options.map(({ name, value }) => (
78-
<FormItem key={value} className="flex items-center space-x-3 space-y-0">
79-
<FormControl>
80-
<RadioGroupItem value={value} id={value} />
81-
</FormControl>
82-
<FormLabel className="text-xs" htmlFor={value}>
83-
{name}
84-
</FormLabel>
85-
</FormItem>
86-
))}
87-
</RadioGroup>
88-
</FormControl>
89-
</FormItem>
90-
)}
91-
/>
92-
</FormProvider>
64+
{options.length > 0 ? (
65+
<FormProvider {...form}>
66+
<FormField
67+
control={form.control}
68+
name="packingMethod"
69+
render={({ field }) => (
70+
<FormItem className="space-y-3">
71+
<FormLabel className="h-6 flex items-center gap-1">{t("packageConfig.title")}</FormLabel>
72+
<FormControl>
73+
<RadioGroup
74+
onValueChange={field.onChange}
75+
value={field.value}
76+
className="grid grid-cols-2 md:grid-cols-3"
77+
>
78+
{options.map(({ name, value }) => (
79+
<FormItem key={value} className="flex items-center space-x-3 space-y-0">
80+
<FormControl>
81+
<RadioGroupItem value={value} id={value} />
82+
</FormControl>
83+
<FormLabel className="text-xs" htmlFor={value}>
84+
{name}
85+
</FormLabel>
86+
</FormItem>
87+
))}
88+
</RadioGroup>
89+
</FormControl>
90+
</FormItem>
91+
)}
92+
/>
93+
</FormProvider>
94+
) : (
95+
<div className="flex items-center justify-center p-4 space-x-2">
96+
<div className="h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent" />
97+
<span className="text-sm text-muted-foreground">{t("loading")}</span>
98+
</div>
99+
)}
93100
</CardContent>
94101
</Card>
95102
);

web/src/i18n/en.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"title3": "Injector Class",
2727
"usage": "Usage"
2828
},
29+
"loading": "Loading...",
2930
"mainConfig": {
3031
"bypassJavaModule": "Bypass Java Module",
3132
"debug": "Debug Mode",
@@ -49,6 +50,8 @@
4950
"Freemarker": "Freemarker",
5051
"Groovy": "Groovy",
5152
"GzipBase64": "GzipBase64",
53+
"Hessian2Deserialize": "Hessian2Deserialize",
54+
"HessianDeserialize": "HessianDeserialize",
5255
"JEXL": "JEXL",
5356
"JSP": "JSP",
5457
"JXPath": "JXPath",
@@ -61,9 +64,7 @@
6164
"ScriptEngine": "ScriptEngine",
6265
"SpEL": "SpEL",
6366
"Velocity": "Velocity",
64-
"XxlJob": "XXL-JOB Executor",
65-
"Hessian2Deserialize": "Hessian2Deserialize",
66-
"HessianDeserialize": "HessianDeserialize"
67+
"XxlJob": "XXL-JOB Executor"
6768
},
6869
"title": "Package Method"
6970
},
@@ -111,19 +112,19 @@
111112
"tips": {
112113
"controllerUrlPattern": "ControllerHandler type requires a specific URL Pattern, e.g., /hello_controller",
113114
"decompileTip": "Decompilation is still under development, so the current only sees the base64 encoding format",
115+
"download-jattach": "Download the Jattach tool (consider it directly encapsulated in Jar later)",
116+
"execute-command": "Execute the command to inject: /path/to/jattach pid load instrument false /path/to/agent.jar",
117+
"get-pid": "Get the process pid of the target jvm (use jps or ps)",
114118
"handlerUrlPattern": "HandlerMethod/HandlerFunction type requires a specific URL Pattern, e.g., /hello_handler",
115119
"jreTip": "Target JRE version, generally speaking, Java 6 is the default version for maximum compatibility, and Java high versions can load low version bytecode.",
116120
"jreTip2": "In specific cases, such as JDK8 being able to use lambda expressions, and JDK9 and above having module restrictions, a specific version is required.",
121+
"move-to-container": "Move MemShellAgent.jar and jattach to the container (if the test environment uses a container deployment)",
117122
"servletUrlPattern": "Servlet type requires a specific URL Pattern, e.g., /hello_servlet",
118123
"shellBytesEmpty": "Shell bytes is empty, please generate shell first",
119124
"shellToolNotSelected": "Please select a shell tool type first",
120125
"targetServerNotFound": "Target server not found?",
121126
"targetServerRequest": "Request",
122-
"waitingForGeneration": "// Waiting for generation...",
123-
"download-jattach": "Download the Jattach tool (consider it directly encapsulated in Jar later)",
124-
"move-to-container": "Move MemShellAgent.jar and jattach to the container (if the test environment uses a container deployment)",
125-
"get-pid": "Get the process pid of the target jvm (use jps or ps)",
126-
"execute-command": "Execute the command to inject: /path/to/jattach pid load instrument false /path/to/agent.jar",
127-
"try-to-use-shell": "Try to use the memory shell"
127+
"try-to-use-shell": "Try to use the memory shell",
128+
"waitingForGeneration": "// Waiting for generation..."
128129
}
129130
}

web/src/i18n/zh-CN.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"title3": "注入器类",
2727
"usage": "使用方法"
2828
},
29+
"loading": "加载中...",
2930
"mainConfig": {
3031
"bypassJavaModule": "绕过 Java 模块限制",
3132
"debug": "调试模式",
@@ -49,6 +50,8 @@
4950
"Freemarker": "Freemarker",
5051
"Groovy": "Groovy",
5152
"GzipBase64": "GzipBase64",
53+
"Hessian2Deserialize": "Hessian2 反序列化",
54+
"HessianDeserialize": "Hessian 反序列化",
5255
"JEXL": "JEXL 表达式",
5356
"JSP": "JSP",
5457
"JXPath": "JXPath 表达式",
@@ -61,9 +64,7 @@
6164
"ScriptEngine": "内置脚本引擎",
6265
"SpEL": "SpEL 表达式",
6366
"Velocity": "Velocity",
64-
"XxlJob": "XXL-JOB Executor",
65-
"Hessian2Deserialize": "Hessian2 反序列化",
66-
"HessianDeserialize": "Hessian 反序列化"
67+
"XxlJob": "XXL-JOB Executor"
6768
},
6869
"title": "打包方式"
6970
},
@@ -111,19 +112,19 @@
111112
"tips": {
112113
"controllerUrlPattern": "ControllerHandler 类型的需要填写具体的 URL Pattern,例如 /hello_controller",
113114
"decompileTip": "反编译还在开发中,因此当前仅能看到 base64 编码格式",
115+
"download-jattach": "下载 Jattach 工具(后期考虑直接封装在 Jar 中)",
116+
"execute-command": "执行命令进行注入:/path/to/jattach pid load instrument false /path/to/agent.jar",
117+
"get-pid": "获取目标 jvm 的进程 pid (使用 jps 或 ps)",
114118
"handlerUrlPattern": "HandlerMethod/HandlerFunction 类型的需要填写具体的 URL Pattern,例如 /hello_handler",
115119
"jreTip": "目标 JRE 版本,一般而言为了最大的兼容性,默认 Java 6 即可,Java 高版本能加载低版本的字节码。",
116120
"jreTip2": "特定情况下,例如 JDK8 才能使用 lambda 表达式,JDK9 以上存在模块限制时才需要选择特定的版本。",
121+
"move-to-container": "将 MemShellAgent.jar 和 jattach 移动到容器中(如果测试环境使用容器部署)",
117122
"servletUrlPattern": "Servlet 类型的需要填写具体的 URL Pattern,例如 /hello_servlet",
118123
"shellBytesEmpty": "内存马字节码为空,无法下载, 请先生成内存马",
119124
"shellToolNotSelected": "请先选择内存马工具类型",
120125
"targetServerNotFound": "找不到目标服务 ?",
121126
"targetServerRequest": "请求适配",
122-
"waitingForGeneration": "// 等待填写参数生成中...",
123-
"download-jattach": "下载 Jattach 工具(后期考虑直接封装在 Jar 中)",
124-
"move-to-container": "将 MemShellAgent.jar 和 jattach 移动到容器中(如果测试环境使用容器部署)",
125-
"get-pid": "获取目标 jvm 的进程 pid (使用 jps 或 ps)",
126-
"execute-command": "执行命令进行注入:/path/to/jattach pid load instrument false /path/to/agent.jar",
127-
"try-to-use-shell": "尝试利用内存马"
127+
"try-to-use-shell": "尝试利用内存马",
128+
"waitingForGeneration": "// 等待填写参数生成中..."
128129
}
129130
}

0 commit comments

Comments
 (0)