chore(script): adjust scripts format

This commit is contained in:
Skylot
2023-09-12 19:52:50 +01:00
parent 24657f6b3c
commit 2dc0db230c
13 changed files with 59 additions and 38 deletions
@@ -0,0 +1,31 @@
/**
* Custom regexp deobfuscator
*/
val jadx = getJadxInstance()
jadx.args.isDeobfuscationOn = false
jadx.args.renameFlags = emptySet()
val regexOpt = jadx.options.registerString(
"regex",
"Apply rename for names matches regex",
defaultValue = "[Oo0]+",
)
val regex = regexOpt.value.toRegex()
var n = 0
jadx.rename.all { name, node ->
when {
name matches regex -> {
val newName = "${node.typeName()}${n++}"
log.info { "renaming ${node.typeName()} '$node' to '$newName'" }
newName
}
else -> null
}
}
jadx.afterLoad {
log.info { "Renames count: $n" }
}