diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f70ed106 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "modules"] + path = modules + url = git@github.com:GravitLauncher/LauncherModules.git diff --git a/.travis.yml b/.travis.yml index 7617d885..778e6078 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,14 @@ +# project is java language: java +# Use https (public access) instead of git for git-submodules. This modifies only Travis-CI behavior! +# disable the default submodule logic +git: + submodules: false +# use sed to replace the SSH URL with the public URL, then init and update submodules +before_install: + - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules + - git submodule update --init --recursive +# gradle before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ @@ -8,5 +18,6 @@ cache: - $HOME/.gradle/wrapper/ script: - ./gradlew assemble build +# not working artifacts addons: - artifacts: true + artifacts: false diff --git a/modules b/modules new file mode 160000 index 00000000..5f65c646 --- /dev/null +++ b/modules @@ -0,0 +1 @@ +Subproject commit 5f65c6466c3dac204942e91b06b593052530673c diff --git a/modules/NeverDecomp/build.gradle b/modules/NeverDecomp/build.gradle deleted file mode 100644 index f7d1a61b..00000000 --- a/modules/NeverDecomp/build.gradle +++ /dev/null @@ -1,8 +0,0 @@ -def mainClassName = "NeverDecompModule" - -sourceCompatibility = '1.8' -targetCompatibility = '1.8' - -jar { - manifest.attributes("Main-Class": mainClassName) -} \ No newline at end of file diff --git a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/NeverDecompModule.java b/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/NeverDecompModule.java deleted file mode 100644 index 1304b4ff..00000000 --- a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/NeverDecompModule.java +++ /dev/null @@ -1,50 +0,0 @@ -package ru.gravit.launcher.neverdecomp; - -import ru.gravit.launcher.LauncherVersion; -import ru.gravit.launcher.modules.Module; -import ru.gravit.launcher.modules.ModuleContext; -import ru.gravit.launcher.neverdecomp.asm.TransformerClass; -import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry; -import ru.gravit.launchserver.modules.LaunchServerModuleContext; - -public class NeverDecompModule implements Module { - @Override - public void close() { - - } - - @Override - public String getName() { - return "NeverDecomp"; - } - - @Override - public LauncherVersion getVersion() { - return new LauncherVersion(1, 0, 1, 2); - } - - @Override - public int getPriority() { - return 1; - } - - @Override - public void init(ModuleContext context1) { - if (context1.getType().equals(ModuleContext.Type.LAUNCHSERVER)) { - // Config may has boolean variable "hardAntiDecomp", which enables hard mode (needs -noverify to JVM) - LaunchServerModuleContext context = (LaunchServerModuleContext) context1; - boolean hobf = context.launchServer.config.block.hasEntry("hardAntiDecomp") ? context.launchServer.config.block.getEntryValue("hardAntiDecomp", BooleanConfigEntry.class) : false; - context.launchServer.buildHookManager.registerClassTransformer(new TransformerClass(hobf)); - } - } - - @Override - public void preInit(ModuleContext context1) { - - } - - @Override - public void postInit(ModuleContext context1) { - - } -} diff --git a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileClassVisitor.java b/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileClassVisitor.java deleted file mode 100644 index e59d3feb..00000000 --- a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileClassVisitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package ru.gravit.launcher.neverdecomp.asm; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -public class AntiDecompileClassVisitor extends ClassVisitor { - private final boolean context; - - public AntiDecompileClassVisitor(ClassVisitor writer, boolean context) { - super(Opcodes.ASM5, writer); - this.context = context; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, - String signature, String[] exceptions) { - return new AntiDecompileMethodVisitor(access, super.visitMethod(access, name, desc, signature, exceptions), name, desc, context); - } -} \ No newline at end of file diff --git a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileMethodVisitor.java b/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileMethodVisitor.java deleted file mode 100644 index 80cecd60..00000000 --- a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/AntiDecompileMethodVisitor.java +++ /dev/null @@ -1,84 +0,0 @@ -package ru.gravit.launcher.neverdecomp.asm; - -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.AdviceAdapter; - -public class AntiDecompileMethodVisitor extends AdviceAdapter implements Opcodes { - - private final boolean context; - - protected AntiDecompileMethodVisitor(int access, MethodVisitor mw, String name, String desc, boolean context) { - super(ASM5, mw, access, name, desc); - this.context = context; - } - - // в начале каждого метода - // убивает декомпиляторы - @Override - public void onMethodEnter() { - if (context) expAntiDecomp(); - antiDecomp(); - } - - public void expAntiDecomp() { - Label lbl1 = this.newLabel(), lbl15 = this.newLabel(), - lbl2 = this.newLabel(), lbl25 = this.newLabel(); - - // try-catch блок с lbl1 до lbl2 с переходом на lbl2 при java/lang/Exception - this.visitException(lbl1, lbl2, lbl2); - - // lbl1: iconst_0 - this.visitLabel(lbl1); - this.visitInsn(ICONST_0); - // lbl15: pop; goto lbl25 - this.visitLabel(lbl15); - this.visitInsn(POP); - this.jumpLabel(lbl25); - // lbl2: pop; pop2 - this.visitLabel(lbl2); - this.visitInsn(POP); - this.visitInsn(POP); - // lbl25: - this.visitLabel(lbl25); - } - - public void antiDecomp() { - Label lbl1 = this.newLabel(), lbl15 = this.newLabel(), - lbl2 = this.newLabel(), lbl3 = this.newLabel(), - lbl35 = this.newLabel(), lbl4 = this.newLabel(); - - // try-catch блок с lbl1 до lbl2 с переходом на lbl15 при java/lang/Exception - this.visitException(lbl1, lbl2, lbl15); - // try-catch блок с lbl3 до lbl4 с переходом на lbl3 при java/lang/Exception - this.visitException(lbl3, lbl4, lbl3); - - // lbl1: goto lbl2 - this.visitLabel(lbl1); - this.jumpLabel(lbl2); - // lbl15: pop - this.visitLabel(lbl15); - this.visitInsn(POP); - // lbl2: goto lbl35 - this.visitLabel(lbl2); - this.jumpLabel(lbl35); - // lbl3: pop - this.visitLabel(lbl3); - this.visitInsn(POP); - // lbl35: nop - this.visitLabel(lbl35); - this.visitInsn(NOP); - // lbl4: nop - this.visitLabel(lbl4); - this.visitInsn(NOP); - } - - public void visitException(Label st, Label en, Label h) { - this.visitTryCatchBlock(st, en, h, "java/lang/Exception"); - } - - public void jumpLabel(Label to) { - this.visitJumpInsn(GOTO, to); - } -} \ No newline at end of file diff --git a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/TransformerClass.java b/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/TransformerClass.java deleted file mode 100644 index 8eb08695..00000000 --- a/modules/NeverDecomp/src/main/java/ru/gravit/launcher/neverdecomp/asm/TransformerClass.java +++ /dev/null @@ -1,23 +0,0 @@ -package ru.gravit.launcher.neverdecomp.asm; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; - -import ru.gravit.launchserver.manangers.BuildHookManager.Transformer; - -public class TransformerClass implements Transformer { - - private final boolean context; - - public TransformerClass(boolean hobf) { - this.context = hobf; - } - - @Override - public byte[] transform(byte[] input, CharSequence classname) { - ClassReader classReader = new ClassReader(input); - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); - classReader.accept(new AntiDecompileClassVisitor(writer, context), 0); - return writer.toByteArray(); - } -} \ No newline at end of file diff --git a/modules/build.gradle b/modules/build.gradle deleted file mode 100644 index b4cc3481..00000000 --- a/modules/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -subprojects { - dependencies { - compileOnly project(':LaunchServer') - compileOnly 'org.javassist:javassist:3.23.1-GA' - compileOnly 'org.ow2.asm:asm-debug-all:5.0.4' - } - jar { - from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 5993c62c..b5a81103 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,4 +3,7 @@ include 'Launcher' include 'libLauncher' include 'LaunchServer' -include 'modules:NeverDecomp' \ No newline at end of file +include 'modules' +file('modules').eachDir { sub -> + if (sub.name.endsWith('_module')) include 'modules:' + sub.name +} \ No newline at end of file