diff --git a/bom/build.gradle b/bom/build.gradle index 43810336..fe96df6e 100644 --- a/bom/build.gradle +++ b/bom/build.gradle @@ -6,6 +6,7 @@ dependencies { constraints { api 'net.bytebuddy:byte-buddy:1.+' api 'org.ow2.asm:asm-commons:9.7.1' + api 'com.github.jar-analyzer:class-obf:1.5.0' api 'javax.servlet:javax.servlet-api:3.0.1' api 'jakarta.servlet:jakarta.servlet-api:6.0.0' diff --git a/build.gradle b/build.gradle index 60fc093e..a0909fe8 100644 --- a/build.gradle +++ b/build.gradle @@ -12,10 +12,6 @@ allprojects { implementation platform(project(':bom')) } } - - repositories { - mavenCentral() - } } idea { diff --git a/generator/build.gradle b/generator/build.gradle index 4a07415e..bc13edb5 100644 --- a/generator/build.gradle +++ b/generator/build.gradle @@ -39,6 +39,7 @@ dependencies { implementation project(":memshell-java8") implementation 'net.bytebuddy:byte-buddy' implementation 'org.ow2.asm:asm-commons' + implementation 'com.github.jar-analyzer:class-obf' implementation 'javax.servlet:javax.servlet-api' implementation 'javax.websocket:javax.websocket-api' diff --git a/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java b/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java index 9f70e85c..872d1ddc 100644 --- a/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java +++ b/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java @@ -4,6 +4,8 @@ import com.reajason.javaweb.memshell.config.*; import com.reajason.javaweb.memshell.generator.*; import com.reajason.javaweb.memshell.server.AbstractShell; import com.reajason.javaweb.memshell.utils.CommonUtil; +import me.n1ar4.clazz.obfuscator.api.ClassObf; +import me.n1ar4.clazz.obfuscator.config.BaseConfig; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -46,12 +48,39 @@ public class MemShellGenerator { byte[] shellBytes = generateShellBytes(shellConfig, shellToolConfig); + if (shellConfig.isObfuscate()) { + BaseConfig config = BaseConfig.Default(); + config.setIgnorePublic(true); + config.setEnableMethodName(false); + config.setEnableFieldName(false); + config.setEnableAES(false); + config.setEnableAdvanceString(false); + config.setQuiet(true); + + ClassObf classObf = new ClassObf(config); + shellBytes = classObf.run(shellBytes).getData(); + } + injectorConfig.setInjectorClass(injectorClass); injectorConfig.setShellClassName(shellToolConfig.getShellClassName()); injectorConfig.setShellClassBytes(shellBytes); InjectorGenerator injectorGenerator = new InjectorGenerator(shellConfig, injectorConfig); byte[] injectorBytes = injectorGenerator.generate(); + + if (shellConfig.isObfuscate()) { + BaseConfig config = BaseConfig.Default(); + config.setIgnorePublic(true); + config.setEnableMethodName(false); + config.setEnableFieldName(false); + config.setEnableAES(false); + config.setEnableAdvanceString(false); + config.setQuiet(true); + + ClassObf classObf = new ClassObf(config); + injectorBytes = classObf.run(injectorBytes).getData(); + } + Map innerClassBytes = injectorGenerator.getInnerClassBytes(); return GenerateResult.builder() diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertionTool.java b/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertionTool.java index f509898c..eba7e9c9 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertionTool.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertionTool.java @@ -232,8 +232,13 @@ public class ShellAssertionTool { .targetJreVersion(targetJdkVersion) .debug(true) .shrink(true) + .obfuscate(true) .build(); + if (ShellTool.NeoreGeorg.equals(shellTool)) { + shellConfig.setObfuscate(false); + } + ShellToolConfig shellToolConfig = null; String uniqueName = shellTool + RandomStringUtils.randomAlphabetic(5) + shellType + RandomStringUtils.randomAlphabetic(5) + packer.name(); switch (shellTool) { diff --git a/memshell-agent/memshell-agent-asm/build.gradle b/memshell-agent/memshell-agent-asm/build.gradle index 1c0f6e68..df0d3a1e 100644 --- a/memshell-agent/memshell-agent-asm/build.gradle +++ b/memshell-agent/memshell-agent-asm/build.gradle @@ -6,10 +6,6 @@ plugins { group = 'com.reajason.javaweb' version = '1.0.0' -repositories { - mavenCentral() -} - java { toolchain { languageVersion = JavaLanguageVersion.of(8) diff --git a/memshell-agent/memshell-agent-bytebuddy/build.gradle b/memshell-agent/memshell-agent-bytebuddy/build.gradle index 8cc99a00..1d470d51 100644 --- a/memshell-agent/memshell-agent-bytebuddy/build.gradle +++ b/memshell-agent/memshell-agent-bytebuddy/build.gradle @@ -5,9 +5,6 @@ plugins { group = 'com.reajason.javaweb' version = '1.0.0' -repositories { - mavenCentral() -} dependencies { testImplementation platform('org.junit:junit-bom:5.10.0') diff --git a/memshell-agent/memshell-agent-javassist/build.gradle b/memshell-agent/memshell-agent-javassist/build.gradle index 8cc99a00..d5eaeef3 100644 --- a/memshell-agent/memshell-agent-javassist/build.gradle +++ b/memshell-agent/memshell-agent-javassist/build.gradle @@ -5,10 +5,6 @@ plugins { group = 'com.reajason.javaweb' version = '1.0.0' -repositories { - mavenCentral() -} - dependencies { testImplementation platform('org.junit:junit-bom:5.10.0') testImplementation 'org.junit.jupiter:junit-jupiter' diff --git a/settings.gradle b/settings.gradle index c1cfcf81..ebcd4e42 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,6 +2,14 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' } +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + maven { url 'https://jitpack.io' } + } +} + rootProject.name = 'MemShellParty' include 'bom' diff --git a/vul/vul-springboot1/build.gradle b/vul/vul-springboot1/build.gradle index 7c09bf7a..29257cfc 100644 --- a/vul/vul-springboot1/build.gradle +++ b/vul/vul-springboot1/build.gradle @@ -8,10 +8,6 @@ java { sourceCompatibility = JavaVersion.VERSION_1_8 } -repositories { - mavenCentral() -} - configurations { providedRuntime } diff --git a/vul/vul-springboot2/build.gradle b/vul/vul-springboot2/build.gradle index 297381d1..ef477fa6 100644 --- a/vul/vul-springboot2/build.gradle +++ b/vul/vul-springboot2/build.gradle @@ -9,10 +9,6 @@ java { sourceCompatibility = JavaVersion.VERSION_1_8 } -repositories { - mavenCentral() -} - dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'commons-io:commons-io:2.+' diff --git a/web/bun.lockb b/web/bun.lockb index 33404320..0f676f38 100755 Binary files a/web/bun.lockb and b/web/bun.lockb differ diff --git a/web/package.json b/web/package.json index d9f758fc..fb299fb1 100644 --- a/web/package.json +++ b/web/package.json @@ -15,7 +15,7 @@ }, "devDependencies": { "@biomejs/biome": "1.9.4", - "@tanstack/router-plugin": "^1.114.29", + "@tanstack/router-plugin": "^1.114.30", "@types/node": "^22.13.14", "@types/react": "^19.0.12", "@types/react-copy-to-clipboard": "^5.0.7", @@ -42,22 +42,22 @@ "@radix-ui/react-tabs": "^1.1.3", "@radix-ui/react-tooltip": "^1.1.8", "@tailwindcss/vite": "^4.0.17", - "@tanstack/react-query": "^5.69.0", + "@tanstack/react-query": "^5.70.0", "@tanstack/react-router": "^1.114.29", "@tanstack/router-devtools": "^1.114.29", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "i18next": "^24.2.3", - "lucide-react": "^0.484.0", - "react": "^19.0.0", + "lucide-react": "^0.485.0", + "react": "^19.1.0", "react-copy-to-clipboard": "^5.1.0", - "react-dom": "^19.0.0", - "react-hook-form": "^7.54.2", + "react-dom": "^19.1.0", + "react-hook-form": "^7.55.0", "react-i18next": "^15.4.1", "react-syntax-highlighter": "^15.6.1", "sonner": "^2.0.2", "tailwind-merge": "^3.0.2", - "tailwind-scrollbar": "^4.0.1", + "tailwind-scrollbar": "^4.0.2", "tailwindcss-animate": "^1.0.7", "zod": "^3.24.2" }, diff --git a/web/src/components/main-config-card.tsx b/web/src/components/main-config-card.tsx index 9f5580c6..c5f6d245 100644 --- a/web/src/components/main-config-card.tsx +++ b/web/src/components/main-config-card.tsx @@ -287,6 +287,18 @@ export function MainConfigCard({ )} /> + ( + + + + + + + )} + /> diff --git a/web/src/i18n/en.json b/web/src/i18n/en.json index 6e913ec7..ffe3542e 100644 --- a/web/src/i18n/en.json +++ b/web/src/i18n/en.json @@ -37,7 +37,8 @@ "shellMountType": "Shell Mount Type", "shellTool": "Shell Tool", "shrink": "Shrink Bytecode", - "urlPattern": "URL Pattern" + "urlPattern": "URL Pattern", + "obfuscate": "Obfuscate" }, "optional": "(Optional)", "packageConfig": { @@ -130,7 +131,8 @@ "targetServerRequest": "Request", "try-to-use-shell": "Try to use the memory shell", "waitingForGeneration": "// Waiting for generation...", - "customShellClass": "Custom shell class is required, base64 or classfile" + "customShellClass": "Custom shell class is required, base64 or classfile", + "neoreGeorgObfuscate": "Do not support obfuscate for NeoreGeorg" }, "version": { "updateAvailable": "Update Available", diff --git a/web/src/i18n/zh-CN.json b/web/src/i18n/zh-CN.json index b088cfcf..6d431528 100644 --- a/web/src/i18n/zh-CN.json +++ b/web/src/i18n/zh-CN.json @@ -37,7 +37,8 @@ "shellMountType": "内存马挂载类型", "shellTool": "内存马功能", "shrink": "缩小字节码", - "urlPattern": "请求路径" + "urlPattern": "请求路径", + "obfuscate": "代码混淆" }, "optional": "(可选)", "packageConfig": { @@ -130,7 +131,8 @@ "targetServerRequest": "请求适配", "try-to-use-shell": "尝试利用内存马", "waitingForGeneration": "// 等待填写参数生成中...", - "customShellClass": "请输入自定义内存马类,base64 或类文件" + "customShellClass": "请输入自定义内存马类,base64 或类文件", + "neoreGeorgObfuscate": "NeoreGeorg 目前不支持代码混淆" }, "version": { "updateAvailable": "有可用升级", diff --git a/web/src/routes/index.tsx b/web/src/routes/index.tsx index dffcd319..6445c0d4 100644 --- a/web/src/routes/index.tsx +++ b/web/src/routes/index.tsx @@ -87,6 +87,11 @@ function IndexComponent() { toast.warning(t("tips.customShellClass")); return false; } + + if (values.obfuscate && values.shellTool === ShellToolType.NeoreGeorg) { + toast.warning(t("tips.neoreGeorgObfuscate")); + return false; + } return true; } diff --git a/web/src/types/schema.ts b/web/src/types/schema.ts index 336464e6..7c3ffeb8 100644 --- a/web/src/types/schema.ts +++ b/web/src/types/schema.ts @@ -19,6 +19,7 @@ export const formSchema = z.object({ injectorClassName: z.optional(z.string()), packingMethod: z.string().min(1), shrink: z.optional(z.boolean()), + obfuscate: z.optional(z.boolean()), shellClassBase64: z.optional(z.string()), }); diff --git a/web/src/utils/transformer.ts b/web/src/utils/transformer.ts index e5d872a7..589443ca 100644 --- a/web/src/utils/transformer.ts +++ b/web/src/utils/transformer.ts @@ -10,6 +10,7 @@ export function transformToPostData(formValue: FormSchema) { targetJreVersion: formValue.targetJdkVersion, byPassJavaModule: formValue.bypassJavaModule, shrink: formValue.shrink, + obfuscate: formValue.obfuscate, }; const shellToolConfig: ShellToolConfig = { shellClassName: formValue.shellClassName,