feat: support i18n [skip ci]

This commit is contained in:
ReaJason
2025-01-20 00:34:10 +08:00
parent a64238eea0
commit f90f0f0713
19 changed files with 578 additions and 215 deletions
+32
View File
@@ -0,0 +1,32 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import { resources } from "./translations";
const getStoredLanguage = () => {
const storedLang = localStorage.getItem("i18nextLng");
if (storedLang && ["en", "zh"].includes(storedLang)) {
return storedLang;
}
const browserLang = navigator.language.split("-")[0];
return ["en", "zh"].includes(browserLang) ? browserLang : "en";
};
i18n.use(initReactI18next).init({
resources,
lng: getStoredLanguage(),
fallbackLng: "en",
interpolation: {
escapeValue: false,
},
detection: {
order: ["localStorage", "navigator"],
},
saveMissing: true,
load: "languageOnly",
});
i18n.on("languageChanged", (lng) => {
localStorage.setItem("i18nextLng", lng);
});
export default i18n;
+217
View File
@@ -0,0 +1,217 @@
export const resources = {
en: {
translation: {
download: "Downlaod",
feedback: "Feedback",
cancel: "Cancel",
placeholders: {
select: "Please select",
input: "Please input",
},
configs: {
"main-config": "Main Config",
"package-config": "Package Config",
},
optional: "(Optional)",
mainConfig: {
server: "Target Server",
jre: "Target JRE Version",
debug: "Debug Mode",
bypassJavaModule: "Bypass Java Module",
shellMountType: "Shell Mount Type",
shellTool: "Shell Tool",
urlPattern: "URL Pattern",
shellClassName: "Shell ClassName",
injectorClassName: "Injector ClassName",
},
shellToolConfig: {
godzilla: "Godzilla",
behinder: "Behinder",
command: "Command",
customHeader: "Custom Header",
headerName: "Header Name",
headerValue: "Header Value",
pass: "Pass",
key: "Key",
godzillaHeader: "Request Config -> Request Header",
godzillaPayload: "Payload",
godzillaEncryptor: "Encryptor",
behinderPass: "Pass",
behinderScriptType: "Script Type",
behinderEncryptType: "Encrypt Type",
behinderDefaultEncryptType: "Default",
paramName: "Param Name",
},
packageConfig: {
title: "Package Method",
packer: {
Base64: "Base64",
BCEL: "BCEL",
JSP: "JSP",
JAR: "JAR",
EL: "EL",
SpEL: "SpEL",
OGNL: "OGNL",
MVEL: "MVEL",
Freemarker: "Freemarker",
Velocity: "Velocity",
Groovy: "Groovy",
AgentJar: "AgentJar",
Deserialize: "Deserialize(Only CB4, 1.9.x)",
ScriptEngine: "ScriptEngine",
},
},
tips: {
shellToolNotSelected: "Please select a shell tool type first",
targetServerNotFound: "Target server not found?",
waitingForGeneration: "// Waiting for generation...",
targetServerRequest: "Request",
servletUrlPattern: "Servlet type requires a specific URL Pattern, e.g., /hello_servlet",
controllerUrlPattern: "ControllerHandler type requires a specific URL Pattern, e.g., /hello_controller",
handlerUrlPattern: "HandlerMethod/HandlerFunction type requires a specific URL Pattern, e.g., /hello_handler",
jreTip:
"Target JRE version, generally speaking, Java 6 is the default version for maximum compatibility, and Java high versions can load low version bytecode.",
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.",
decompileTip: "Decompilation is still under development, so the current only sees the base64 encoding format",
shellBytesEmpty: "Shell bytes is empty, please generate shell first",
},
quickUsage: {
title: "Quick Usage",
step1: "Select Target Server",
step2: "Select Shell Tool, Godzilla, Behinder, etc.",
step3: "Select Shell Mount Type, Filter, Listener, etc.",
step4: "Select Packing Method",
step5: "Click Generate Shell",
},
generateResult: {
basicInfo: "Basic Info",
usage: "Usage",
title1: "Generate Result",
title2: "Shell Class",
title3: "Injector Class",
},
shellNotWork: {
title: "Shell Not Work ?",
step1: "1. Try to enable the debug mode, regenerate the memory shell and inject it, check the console or log",
step2:
"2. If an exception stack trace is displayed, or no exception is seen, please take a screenshot of the current generation interface and the exception log, and describe the target environment as much as possible for feedback",
},
buttons: {
generate: "Generate Shell",
},
success: {
generated: "Generation successful",
},
errors: {
generationFailed: "Generation failed, {{error}}",
},
},
},
zh: {
translation: {
download: "下载",
feedback: "反馈",
cancel: "取消",
placeholders: {
select: "请选择",
input: "请输入",
},
configs: {
"main-config": "核心配置",
"package-config": "打包配置",
},
optional: "(可选)",
mainConfig: {
server: "目标服务",
jre: "目标 JRE 版本",
debug: "调试模式",
bypassJavaModule: "绕过 Java 模块限制",
shellMountType: "内存马挂载类型",
shellTool: "内存马功能",
urlPattern: "请求路径",
shellClassName: "内存马类名",
injectorClassName: "注入器类名",
},
shellToolConfig: {
godzilla: "哥斯拉",
behinder: "冰蝎",
command: "命令回显",
customHeader: "自定义请求头",
headerName: "请求头键",
headerValue: "请求头值",
pass: "密码",
key: "密钥",
godzillaPayload: "有效载荷",
godzillaEncryptor: "加密器",
godzillaHeader: "请求配置 -> 请求头",
behinderPass: "连接密码",
behinderScriptType: "脚本类型",
behinderEncryptType: "加密类型",
behinderDefaultEncryptType: "默认",
paramName: "请求参数",
},
packageConfig: {
title: "打包方式",
packer: {
Base64: "Base64",
BCEL: "BCEL",
JSP: "JSP",
JAR: "JAR",
EL: "EL 表达式",
SpEL: "SpEL 表达式",
OGNL: "OGNL 表达式",
MVEL: "MVEL 表达式",
Freemarker: "Freemarker",
Velocity: "Velocity",
Groovy: "Groovy",
AgentJar: "AgentJar",
Deserialize: "反序列化(仅支持 CB4, 1.9.x)",
ScriptEngine: "脚本引擎",
},
},
tips: {
shellToolNotSelected: "请先选择内存马工具类型",
targetServerNotFound: "找不到目标服务 ?",
targetServerRequest: "请求适配",
waitingForGeneration: "// 等待填写参数生成中...",
servletUrlPattern: "Servlet 类型的需要填写具体的 URL Pattern,例如 /hello_servlet",
controllerUrlPattern: "ControllerHandler 类型的需要填写具体的 URL Pattern,例如 /hello_controller",
handlerUrlPattern: "HandlerMethod/HandlerFunction 类型的需要填写具体的 URL Pattern,例如 /hello_handler",
jreTip: "目标 JRE 版本,一般而言为了最大的兼容性,默认 Java 6 即可,Java 高版本能加载低版本的字节码。",
jreTip2: "特定情况下,例如 JDK8 才能使用 lambda 表达式,JDK9 以上存在模块限制时才需要选择特定的版本。",
decompileTip: "反编译还在开发中,因此当前仅能看到 base64 编码格式",
shellBytesEmpty: "内存马字节码为空,无法下载, 请先生成内存马",
},
quickUsage: {
title: "快速使用",
step1: "选择目标服务",
step2: "选择内存马功能,Godzilla、Behinder 或者其他",
step3: "选择内存马挂载类型,Filter、Listener 或者其他",
step4: "选择打包方式",
step5: "点击生成内存马",
},
generateResult: {
basicInfo: "基本信息",
usage: "使用方法",
title1: "生成结果",
title2: "内存马类",
title3: "注入器类",
},
shellNotWork: {
title: "内存马利用失败 ?",
step1: "1. 尝试开启调试模式,重新生成内存马并注入,查看控制台或日志",
step2: "2. 如果出现异常堆栈信息,或未见异常,请截图当前生成界面以及异常日志,并尽可能描述目标环境进行反馈",
},
buttons: {
generate: "生成内存马",
},
success: {
generated: "生成成功",
},
errors: {
generationFailed: "生成失败,{{error}}",
},
},
},
};