From c99ebcb355f8c28ae41d866466864a04b6ca358e Mon Sep 17 00:00:00 2001 From: Desetude Date: Sat, 9 May 2020 13:02:16 +0100 Subject: [PATCH] Add logging to the AST deobfuscator Signed-off-by: Desetude --- .../src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt b/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt index 57dfafb0..43698516 100644 --- a/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt +++ b/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt @@ -9,6 +9,7 @@ import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSol import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver import com.github.javaparser.utils.SourceRoot +import com.github.michaelbull.logging.InlineLogger import dev.openrs2.deob.ast.transform.AddSubTransformer import dev.openrs2.deob.ast.transform.BinaryExprOrderTransformer import dev.openrs2.deob.ast.transform.BitMaskTransformer @@ -50,6 +51,7 @@ class AstDeobfuscator(private val modules: List) { val units = mutableMapOf() for (root in roots) { + logger.info { "Parsing root ${root.root}" } val results = root.tryToParseParallelized() for (result in results) { require(result.isSuccessful) { result } @@ -62,16 +64,20 @@ class AstDeobfuscator(private val modules: List) { } for (transformer in TRANSFORMERS) { + logger.info { "Running transformer ${transformer.javaClass.simpleName}" } transformer.transform(units) } for (root in roots) { + logger.info { "Saving root ${root.root}" } root.printer = Function(printer::print).andThen(::stripNewlineAfterPcAnnotation) root.saveAll() } } companion object { + private val logger = InlineLogger() + private val TRANSFORMERS = listOf( UnencloseTransformer(), NegativeLiteralTransformer(),