mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
parent
a32434e446
commit
f8853ff353
10 changed files with 20 additions and 197 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "modules"]
|
||||||
|
path = modules
|
||||||
|
url = git@github.com:GravitLauncher/LauncherModules.git
|
13
.travis.yml
13
.travis.yml
|
@ -1,4 +1,14 @@
|
||||||
|
# project is java
|
||||||
language: 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:
|
before_cache:
|
||||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||||
|
@ -8,5 +18,6 @@ cache:
|
||||||
- $HOME/.gradle/wrapper/
|
- $HOME/.gradle/wrapper/
|
||||||
script:
|
script:
|
||||||
- ./gradlew assemble build
|
- ./gradlew assemble build
|
||||||
|
# not working artifacts
|
||||||
addons:
|
addons:
|
||||||
artifacts: true
|
artifacts: false
|
||||||
|
|
1
modules
Submodule
1
modules
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5f65c6466c3dac204942e91b06b593052530673c
|
|
@ -1,8 +0,0 @@
|
||||||
def mainClassName = "NeverDecompModule"
|
|
||||||
|
|
||||||
sourceCompatibility = '1.8'
|
|
||||||
targetCompatibility = '1.8'
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest.attributes("Main-Class": mainClassName)
|
|
||||||
}
|
|
|
@ -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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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) } }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,4 +3,7 @@
|
||||||
include 'Launcher'
|
include 'Launcher'
|
||||||
include 'libLauncher'
|
include 'libLauncher'
|
||||||
include 'LaunchServer'
|
include 'LaunchServer'
|
||||||
include 'modules:NeverDecomp'
|
include 'modules'
|
||||||
|
file('modules').eachDir { sub ->
|
||||||
|
if (sub.name.endsWith('_module')) include 'modules:' + sub.name
|
||||||
|
}
|
Loading…
Reference in a new issue