forked from openrs2/openrs2
parent
d07714a37d
commit
05a03d5bdc
@ -1,10 +1,32 @@ |
||||
package dev.openrs2.bundler |
||||
|
||||
import com.google.inject.AbstractModule |
||||
import com.google.inject.multibindings.Multibinder |
||||
import dev.openrs2.asm.transform.Transformer |
||||
import dev.openrs2.bundler.transform.BufferSizeTransformer |
||||
import dev.openrs2.bundler.transform.CachePathTransformer |
||||
import dev.openrs2.bundler.transform.HostCheckTransformer |
||||
import dev.openrs2.bundler.transform.LoadLibraryTransformer |
||||
import dev.openrs2.bundler.transform.MacResizeTransformer |
||||
import dev.openrs2.bundler.transform.PlatformDetectionTransformer |
||||
import dev.openrs2.bundler.transform.PublicKeyTransformer |
||||
import dev.openrs2.bundler.transform.RightClickTransformer |
||||
import dev.openrs2.bundler.transform.TypoTransformer |
||||
import dev.openrs2.crypto.CryptoModule |
||||
|
||||
object BundlerModule : AbstractModule() { |
||||
override fun configure() { |
||||
install(CryptoModule) |
||||
|
||||
val binder = Multibinder.newSetBinder(binder(), Transformer::class.java, BundlerQualifier::class.java) |
||||
binder.addBinding().to(BufferSizeTransformer::class.java) |
||||
binder.addBinding().to(CachePathTransformer::class.java) |
||||
binder.addBinding().to(HostCheckTransformer::class.java) |
||||
binder.addBinding().to(LoadLibraryTransformer::class.java) |
||||
binder.addBinding().to(MacResizeTransformer::class.java) |
||||
binder.addBinding().to(PlatformDetectionTransformer::class.java) |
||||
binder.addBinding().to(PublicKeyTransformer::class.java) |
||||
binder.addBinding().to(RightClickTransformer::class.java) |
||||
binder.addBinding().to(TypoTransformer::class.java) |
||||
} |
||||
} |
||||
|
@ -0,0 +1,8 @@ |
||||
package dev.openrs2.bundler |
||||
|
||||
import javax.inject.Qualifier |
||||
|
||||
@Qualifier |
||||
@Retention(AnnotationRetention.RUNTIME) |
||||
@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION) |
||||
annotation class BundlerQualifier |
@ -1,13 +1,15 @@ |
||||
package dev.openrs2.deob |
||||
|
||||
import com.github.ajalt.clikt.core.CliktCommand |
||||
import com.google.inject.Guice |
||||
import java.nio.file.Paths |
||||
|
||||
fun main(args: Array<String>) = DeobfuscateCommand().main(args) |
||||
|
||||
class DeobfuscateCommand : CliktCommand(name = "deob") { |
||||
override fun run() { |
||||
val deobfuscator = Deobfuscator(Paths.get("nonfree/lib"), Paths.get("nonfree/var/cache/deob")) |
||||
deobfuscator.run() |
||||
val injector = Guice.createInjector(DeobfuscatorModule) |
||||
val deobfuscator = injector.getInstance(Deobfuscator::class.java) |
||||
deobfuscator.run(Paths.get("nonfree/lib"), Paths.get("nonfree/var/cache/deob")) |
||||
} |
||||
} |
||||
|
@ -0,0 +1,72 @@ |
||||
package dev.openrs2.deob |
||||
|
||||
import com.google.inject.AbstractModule |
||||
import com.google.inject.multibindings.Multibinder |
||||
import dev.openrs2.asm.transform.Transformer |
||||
import dev.openrs2.bundler.BundlerModule |
||||
import dev.openrs2.bundler.transform.ResourceTransformer |
||||
import dev.openrs2.deob.transform.BitShiftTransformer |
||||
import dev.openrs2.deob.transform.BitwiseOpTransformer |
||||
import dev.openrs2.deob.transform.BundlerTransformer |
||||
import dev.openrs2.deob.transform.CanvasTransformer |
||||
import dev.openrs2.deob.transform.ClassLiteralTransformer |
||||
import dev.openrs2.deob.transform.ConstantArgTransformer |
||||
import dev.openrs2.deob.transform.CounterTransformer |
||||
import dev.openrs2.deob.transform.EmptyClassTransformer |
||||
import dev.openrs2.deob.transform.ExceptionTracingTransformer |
||||
import dev.openrs2.deob.transform.FernflowerExceptionTransformer |
||||
import dev.openrs2.deob.transform.FieldOrderTransformer |
||||
import dev.openrs2.deob.transform.FinalTransformer |
||||
import dev.openrs2.deob.transform.InvokeSpecialTransformer |
||||
import dev.openrs2.deob.transform.MethodOrderTransformer |
||||
import dev.openrs2.deob.transform.MonitorTransformer |
||||
import dev.openrs2.deob.transform.OpaquePredicateTransformer |
||||
import dev.openrs2.deob.transform.OriginalNameTransformer |
||||
import dev.openrs2.deob.transform.OriginalPcRestoreTransformer |
||||
import dev.openrs2.deob.transform.OriginalPcSaveTransformer |
||||
import dev.openrs2.deob.transform.OverrideTransformer |
||||
import dev.openrs2.deob.transform.RedundantGotoTransformer |
||||
import dev.openrs2.deob.transform.RemapTransformer |
||||
import dev.openrs2.deob.transform.ResetTransformer |
||||
import dev.openrs2.deob.transform.StaticScramblingTransformer |
||||
import dev.openrs2.deob.transform.UnusedArgTransformer |
||||
import dev.openrs2.deob.transform.UnusedLocalTransformer |
||||
import dev.openrs2.deob.transform.UnusedMethodTransformer |
||||
import dev.openrs2.deob.transform.VisibilityTransformer |
||||
|
||||
object DeobfuscatorModule : AbstractModule() { |
||||
override fun configure() { |
||||
install(BundlerModule) |
||||
|
||||
val binder = Multibinder.newSetBinder(binder(), Transformer::class.java, DeobfuscatorQualifier::class.java) |
||||
binder.addBinding().to(OriginalPcSaveTransformer::class.java) |
||||
binder.addBinding().to(OriginalNameTransformer::class.java) |
||||
binder.addBinding().to(BundlerTransformer::class.java) |
||||
binder.addBinding().to(ResourceTransformer::class.java) |
||||
binder.addBinding().to(OpaquePredicateTransformer::class.java) |
||||
binder.addBinding().to(ExceptionTracingTransformer::class.java) |
||||
binder.addBinding().to(MonitorTransformer::class.java) |
||||
binder.addBinding().to(BitShiftTransformer::class.java) |
||||
binder.addBinding().to(CanvasTransformer::class.java) |
||||
binder.addBinding().to(FieldOrderTransformer::class.java) |
||||
binder.addBinding().to(BitwiseOpTransformer::class.java) |
||||
binder.addBinding().to(RemapTransformer::class.java) |
||||
binder.addBinding().to(ConstantArgTransformer::class.java) |
||||
binder.addBinding().to(UnusedLocalTransformer::class.java) |
||||
binder.addBinding().to(UnusedMethodTransformer::class.java) |
||||
binder.addBinding().to(UnusedArgTransformer::class.java) |
||||
binder.addBinding().to(CounterTransformer::class.java) |
||||
binder.addBinding().to(ResetTransformer::class.java) |
||||
binder.addBinding().to(ClassLiteralTransformer::class.java) |
||||
binder.addBinding().to(InvokeSpecialTransformer::class.java) |
||||
binder.addBinding().to(StaticScramblingTransformer::class.java) |
||||
binder.addBinding().to(EmptyClassTransformer::class.java) |
||||
binder.addBinding().to(MethodOrderTransformer::class.java) |
||||
binder.addBinding().to(VisibilityTransformer::class.java) |
||||
binder.addBinding().to(FinalTransformer::class.java) |
||||
binder.addBinding().to(OverrideTransformer::class.java) |
||||
binder.addBinding().to(RedundantGotoTransformer::class.java) |
||||
binder.addBinding().to(OriginalPcRestoreTransformer::class.java) |
||||
binder.addBinding().to(FernflowerExceptionTransformer::class.java) |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
package dev.openrs2.deob |
||||
|
||||
import javax.inject.Qualifier |
||||
|
||||
@Qualifier |
||||
@Retention(AnnotationRetention.RUNTIME) |
||||
@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION) |
||||
annotation class DeobfuscatorQualifier |
@ -0,0 +1,24 @@ |
||||
package dev.openrs2.deob.transform |
||||
|
||||
import com.github.michaelbull.logging.InlineLogger |
||||
import dev.openrs2.asm.classpath.ClassPath |
||||
import dev.openrs2.asm.transform.Transformer |
||||
import dev.openrs2.bundler.BundlerQualifier |
||||
import javax.inject.Inject |
||||
import javax.inject.Singleton |
||||
|
||||
@Singleton |
||||
class BundlerTransformer @Inject constructor( |
||||
@BundlerQualifier private val transformers: Set<@JvmSuppressWildcards Transformer> |
||||
) : Transformer() { |
||||
override fun transform(classPath: ClassPath) { |
||||
for (transformer in transformers) { |
||||
logger.info { "Running transformer ${transformer.javaClass.simpleName}" } |
||||
transformer.transform(classPath) |
||||
} |
||||
} |
||||
|
||||
companion object { |
||||
private val logger = InlineLogger() |
||||
} |
||||
} |
Loading…
Reference in new issue