proguard

Kotlin AAR library w/ proguard: How to keep ONLY class and method names?

早过忘川 提交于 2020-02-25 13:20:36
问题 I am building an android library (aar file) with Kotlin. I need to obfuscate the code in a way that the 3rd party user will see the class and method names, he must be able to use them (they are pubilc), but I need to hide/obfuscate the code itself. I tried using this file for the myLibrary\proguard-rules.pro file: https://github.com/mohitrajput987/android-utility/blob/master/preference/proguard-rules.pro but every class, method and var is changed, except for a directory that has both a Kotlin

Kotlin AAR library w/ proguard: How to keep ONLY class and method names?

橙三吉。 提交于 2020-02-25 13:19:47
问题 I am building an android library (aar file) with Kotlin. I need to obfuscate the code in a way that the 3rd party user will see the class and method names, he must be able to use them (they are pubilc), but I need to hide/obfuscate the code itself. I tried using this file for the myLibrary\proguard-rules.pro file: https://github.com/mohitrajput987/android-utility/blob/master/preference/proguard-rules.pro but every class, method and var is changed, except for a directory that has both a Kotlin

Kotlin AAR library w/ proguard: How to keep ONLY class and method names?

不想你离开。 提交于 2020-02-25 13:18:06
问题 I am building an android library (aar file) with Kotlin. I need to obfuscate the code in a way that the 3rd party user will see the class and method names, he must be able to use them (they are pubilc), but I need to hide/obfuscate the code itself. I tried using this file for the myLibrary\proguard-rules.pro file: https://github.com/mohitrajput987/android-utility/blob/master/preference/proguard-rules.pro but every class, method and var is changed, except for a directory that has both a Kotlin

代码混淆

时间秒杀一切 提交于 2020-02-24 06:21:18
# To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the

android 混淆配置

只谈情不闲聊 提交于 2020-02-24 02:01:42
proguard 原理 Java代码编译成二进制class 文件,这个class 文件也可以反编译成源代码 ,除了注释外,原来的code 基本都可以看到。为了防止重要code 被泄露,我们往往需要混淆(Obfuscation code , 也就是把方法,字段,包和类这些java 元素的名称改成无意义的名称,这样代码结构没有变化,还可以运行,但是想弄懂代码的架构却很难。 proguard 就是这样的混淆工具,它可以分析一组class 的结构,根据用户的配置,然后把这些class 文件的可以混淆java 元素名混淆掉。在分析class 的同时,他还有其他两个功能,删除无效代码(Shrinking 收缩),和代码进行优化 (Optimization Options)。 缺省情况下,proguard 会混淆所有代码,但是下面几种情况是不能改变java 元素的名称,否则就会这样就会导致程序出错。 一, 我们用到反射的地方。 二, 我们代码依赖于系统的接口,比如被系统代码调用的回调方法,这种情况最复杂。 三, 是我们的java 元素名称是在配置文件中配置好的。 所以使用proguard时,我们需要有个配置文件告诉proguard 那些java 元素是不能混淆的。 proguard 配置 最常用的配置选项 -dontwarn 缺省proguard 会检查每一个引用是否正确

ProGuard使用简介

北战南征 提交于 2020-02-22 15:06:10
我们做java开发的一般都会遇到如何保护我们开发的代码问题。java语言由于是基于jvm上面,所以反编译class 文件很很容易。假如我们做了一个web程序,并把这个web程序发布给客户。实际上,客户是很容易反编译出我们的源代码出来,包括所有的src文件和 jsp文件等等。 那么,如何保护我们的源代码,实际上,应该有几种方法可以使用:1、使用代码混淆器 2、重载应用服务器的classloader 对于第一种方法来说,现在外面有很多开源工具可以使用,个人认为最好用的当属proguard莫属。proguard主要是易用易学。而且提供的功能也挺多。下面是个人一点使用心得 (1)、从网上download proguard工具,proguard工具主要包含是几个jar文件和一些example,下载地址http://proguard.sourceforge.net/ (2)、将里面的几个jar文件添加到类路径下面。当然,也可以不添加,但是下面在做混淆的时候,必须指定classpath,使在做混淆的过程中,能否访问该类 (3)、编写一个配置文件,主要是混淆器的一些参数。比如,下面是一个例子 -injars platform.jar -outjars platform_out.jar -libraryjars <java.home>/lib/rt.jar -libraryjars ibatis

【Android】proguard混淆代码

久未见 提交于 2020-02-22 14:00:24
【doc】 http://developer.android.com/tools/help/proguard.html#configuring 以下是简略的内容,如果需要仔细查看相关手册,请点击上述链接。 一、步骤 1、将proguard.cfg文件拷贝到XX工程下;如果新建工程时选择的Android版本是2.3及以上的,创建后工程下就会自带该文件 2、在project.propertites文件中,加入语句: proguard.config=proguard.cfg 或者 proguard.config=/path/to/proguard.cfg 3、clean工程 4、签名 以上步骤即可完成一定保护代码的作用。 二、例子说明 测试XX.apk反编译获取相关文件,proguard.cfg脚本没有做任何修改 使用apktool获取res资源文件 dex2jar获取src文件 没有proguard 可以 可以 有proguard 可以 部分类的类名已混淆(a,b…),代码可读性下降 三、文件说明 【参考】 http://developer.android.com/tools/help/proguard.html#configuring ProGuard运行结束后,输出以下文件: dump.txt 描述.apk文件中所有类文件间的内部结构 mapping.txt 列出了原始的类

Android安全-代码安全1-ProGuard混淆处理

你说的曾经没有我的故事 提交于 2020-02-22 13:58:52
  Android安全-代码安全1-ProGuard混淆处理 ProGuard简介 ProGuard是一个SourceForge上非常知名的开源项目。官网网址是:http://proguard.sourceforge.net/。 Java的字节码一般是非常容易反编译的。为了很好的保护Java源代码,我们往往会对编译好的class文件进行混淆处理。ProGuard的主要作用就是混淆。当然它还能对字节码进行缩减体积、优化等,但那些对于我们来说都算是次要的功能。 Android Eclipse开发环境与ProGuard 在新版本的ADT创建项目时,混码的文件不再是proguard.cfg,而是project.properties和proguard-project.txt。 如果需要对项目进行全局混码,只需要进行一步操作: 将project.properties的中 “# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt”的“#”去掉就可以了。 如 果有一些代码不能被混淆,比如需要加入了so文件,需要调用里面的方法,那么调用JNI访问so文件的方法就不能被混码。在导出的时候,可能不会报错。但 是在手机上运行的时候,需要调用so文件的时候,就会报某某方法无法找到

android studio 混淆

好久不见. 提交于 2020-02-22 13:58:09
这篇文章等是跟大家分享一在Android studio 进行代码混淆配置。之前大家在eclipse上也弄过代码混淆配置,其实一样,大家可以把之前在eclipse上的配置文件直接拿过来用。不管是.cfg文件还是.txt文件都一样。 先给大家贴一个混淆模板吧。注释很清楚。是我目前一个项目用的proguard.cfg配置文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137

Android 混淆与混淆过滤

爷,独闯天下 提交于 2020-02-22 13:57:27
Android 中代码混淆一般用的是 ProGuard .它除了混淆代码之后还有其它许多实用的功能。这里主要记录混淆相关的实现。 1.ProGuard的作用   删除无用代码,压缩和优化Class文件,缩小APK的体积;   提高逆向门槛,保护代码安全; 2.ProGuard的使用   Eclipse   在Android2.3之前,混淆代码需手动添加proguard来实现代码混淆;2.3之后,Google将其加入到SDK中(SDK\tools\groguard)。当创建工程时,在工程的根目录下会自动生成project.properties,proguard-project.txt(旧片本为proguard.cfg),然后在Eclipse工程中可直接使用ProGuard混淆工程。启用混淆只需要简单的两步:   老版本   1)在project.properties中添加“proguard.config=proguard.cfg”   2)在proguard.cfg中添加混淆和过滤的规则   新版本   1)解除project.properties文件中的“#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt”的注释   2)在proguard-project