From 50c8d675ed981279d04466a2f1dd79a96624d1e4 Mon Sep 17 00:00:00 2001 From: mao Date: Sun, 20 Jun 2021 12:05:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=84=E5=88=99=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{obfus => deobfus}/MappingProcessor.java | 2 +- .../{obfus => deobfus}/MappingReader.java | 2 +- .../apkprotect/{obfus => deobfus}/Pair.java | 2 +- .../apkprotect/dex2c/filters/KeepConfig.java | 2 +- .../dex2c/filters/ProguardMappingConfig.java | 4 +-- .../dex2c/filters/RegexKeepConfig.java | 36 +++++++++++++++++++ .../{obfus => deobfus}/MappingReaderTest.java | 2 +- .../main/java/com/nmmedit/protect/Main.java | 4 +-- 8 files changed, 45 insertions(+), 9 deletions(-) rename nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/{obfus => deobfus}/MappingProcessor.java (98%) rename nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/{obfus => deobfus}/MappingReader.java (99%) rename nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/{obfus => deobfus}/Pair.java (81%) create mode 100644 nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/RegexKeepConfig.java rename nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/{obfus => deobfus}/MappingReaderTest.java (97%) diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingProcessor.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingProcessor.java similarity index 98% rename from nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingProcessor.java rename to nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingProcessor.java index 5d3930a..4b146e0 100644 --- a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingProcessor.java +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingProcessor.java @@ -1,4 +1,4 @@ -package com.nmmedit.apkprotect.obfus; +package com.nmmedit.apkprotect.deobfus; public interface MappingProcessor { /** diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingReader.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingReader.java similarity index 99% rename from nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingReader.java rename to nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingReader.java index 360276f..5c93238 100644 --- a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/MappingReader.java +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/MappingReader.java @@ -1,4 +1,4 @@ -package com.nmmedit.apkprotect.obfus; +package com.nmmedit.apkprotect.deobfus; import java.io.BufferedReader; import java.io.File; diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/Pair.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/Pair.java similarity index 81% rename from nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/Pair.java rename to nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/Pair.java index 9775af0..2cef851 100644 --- a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/obfus/Pair.java +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/deobfus/Pair.java @@ -1,4 +1,4 @@ -package com.nmmedit.apkprotect.obfus; +package com.nmmedit.apkprotect.deobfus; public class Pair { public final T first; diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/KeepConfig.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/KeepConfig.java index 433b2fc..18fecc2 100644 --- a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/KeepConfig.java +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/KeepConfig.java @@ -1,6 +1,6 @@ package com.nmmedit.apkprotect.dex2c.filters; -import com.nmmedit.apkprotect.obfus.MappingReader; +import com.nmmedit.apkprotect.deobfus.MappingReader; import org.jf.dexlib2.iface.ClassDef; import org.jf.dexlib2.iface.Method; diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/ProguardMappingConfig.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/ProguardMappingConfig.java index 8ed6c2c..1af629c 100644 --- a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/ProguardMappingConfig.java +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/ProguardMappingConfig.java @@ -1,7 +1,7 @@ package com.nmmedit.apkprotect.dex2c.filters; -import com.nmmedit.apkprotect.obfus.MappingProcessor; -import com.nmmedit.apkprotect.obfus.MappingReader; +import com.nmmedit.apkprotect.deobfus.MappingProcessor; +import com.nmmedit.apkprotect.deobfus.MappingReader; import org.jf.dexlib2.iface.ClassDef; import org.jf.dexlib2.iface.Method; diff --git a/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/RegexKeepConfig.java b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/RegexKeepConfig.java new file mode 100644 index 0000000..dcca500 --- /dev/null +++ b/nmm-protect/apkprotect/src/main/java/com/nmmedit/apkprotect/dex2c/filters/RegexKeepConfig.java @@ -0,0 +1,36 @@ +package com.nmmedit.apkprotect.dex2c.filters; + +import org.jf.dexlib2.iface.ClassDef; +import org.jf.dexlib2.iface.Method; + +import java.io.File; + +/** + * class * extends android.app.Activity + * class * implements java.io.Serializable + */ +public class RegexKeepConfig implements ClassAndMethodFilter { + private ClassAndMethodFilter filter; + + public RegexKeepConfig(ClassAndMethodFilter filter, File ruleFile) { + this.filter = filter; + } + + @Override + public boolean acceptClass(ClassDef classDef) { + if (filter != null && !filter.acceptClass(classDef)) { + return false; + } + //todo + return true; + } + + @Override + public boolean acceptMethod(Method method) { + if (filter != null && !filter.acceptMethod(method)) { + return false; + } + //todo + return false; + } +} diff --git a/nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/obfus/MappingReaderTest.java b/nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/deobfus/MappingReaderTest.java similarity index 97% rename from nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/obfus/MappingReaderTest.java rename to nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/deobfus/MappingReaderTest.java index 89e6e08..1d1b996 100644 --- a/nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/obfus/MappingReaderTest.java +++ b/nmm-protect/apkprotect/src/test/java/com/nmmedit/apkprotect/deobfus/MappingReaderTest.java @@ -1,4 +1,4 @@ -package com.nmmedit.apkprotect.obfus; +package com.nmmedit.apkprotect.deobfus; import com.nmmedit.apkprotect.util.ApkUtils; import org.junit.Test; diff --git a/nmm-protect/src/main/java/com/nmmedit/protect/Main.java b/nmm-protect/src/main/java/com/nmmedit/protect/Main.java index 8c4a51e..bbadc19 100644 --- a/nmm-protect/src/main/java/com/nmmedit/protect/Main.java +++ b/nmm-protect/src/main/java/com/nmmedit/protect/Main.java @@ -6,7 +6,7 @@ import com.nmmedit.apkprotect.dex2c.filters.BasicKeepConfig; import com.nmmedit.apkprotect.dex2c.filters.ClassAndMethodFilter; import com.nmmedit.apkprotect.dex2c.filters.ProguardMappingConfig; -import com.nmmedit.apkprotect.obfus.MappingReader; +import com.nmmedit.apkprotect.deobfus.MappingReader; import com.nmmedit.apkprotect.sign.ApkVerifyCodeGenerator; import org.jf.dexlib2.iface.ClassDef; import org.jf.dexlib2.iface.Method; @@ -19,7 +19,7 @@ public class Main { public static void main(String[] args) throws IOException { if (args.length < 1) { System.err.println("No Input apk."); - System.err.println(" "); + System.err.println(" [ [mapping.txt]]"); System.exit(-1); } final File apk = new File(args[0]);