zoukankan      html  css  js  c++  java
  • 使用Proguard做Java代码混淆

    下载Proguard, 我下的是最新的Proguad5.2

    在windows下运行bin/proguardgui.bat, 可以看见图形界面, 载入配置, 然后process.

    配置文件例子

     1 -injars 'C:UsersMicrosoftUserDesktopdemo.jar'
     2 -outjars 'C:UsersMicrosoftUserDesktopdemo-pg.jar'
     3 
     4 -libraryjars 'D:workJavaworkspacedemolibMemcached-Java-Client-3.0.2.jar'
     5 -libraryjars 'D:workJavaworkspacedemolibcommons-codec-1.6.jar'
     6 -libraryjars 'D:workJavaworkspacedemolibcommons-imaging-1.0-SNAPSHOT.jar'
     7 -libraryjars 'D:workJavaworkspacedemolibcommons-io-2.2.jar'
     8 -libraryjars 'D:workJavaworkspacedemolibcommons-lang3-3.1.jar'
     9 -libraryjars 'D:workJavaworkspacedemolibdom4j-1.6.1.jar'
    10 -libraryjars 'D:workJavaworkspacedemolibehcache-core-2.6.9.jar'
    11 -libraryjars 'D:workJavaworkspacedemolibhttpclient-4.3.3.jar'
    12 -libraryjars 'D:workJavaworkspacedemolibhttpcore-4.3.2.jar'
    13 -libraryjars 'D:workJavaworkspacedemolibim4java-1.4.0.jar'
    14 -libraryjars 'D:workJavaworkspacedemolibjackson-core-asl-1.9.13.jar'
    15 -libraryjars 'D:workJavaworkspacedemolibjackson-mapper-asl-1.9.13.jar'
    16 -libraryjars 'D:workJavaworkspacedemoliblog4j-1.2.16.jar'
    17 -libraryjars 'D:workJavaworkspacedemolibmail-1.4.7.jar'
    18 -libraryjars 'D:workJavaworkspacedemolibspring-web-3.1.1.RELEASE.jar'
    19 -libraryjars 'D:workJavaworkspacedemolibspring-webmvc-3.1.1.RELEASE.jar'
    20 -libraryjars 'D:workJavaworkspacedemolibxstream-1.2.2.jar'
    21 -libraryjars 'C:Program FilesJavajre6libjce.jar'
    22 -libraryjars 'C:Program FilesJavajre6lib
    t.jar'
    23 -libraryjars 'C:Program FilesJavajre6libjavaws.jar'
    24 -libraryjars 'D:workJavaservers	omcat-7.0.54libservlet-api.jar'
    25 -libraryjars 'C:Program FilesJavajre6libjsse.jar'
    26 
    27 -target 1.6
    28 -dontshrink
    29 -dontoptimize
    30 -dontusemixedcaseclassnames
    31 -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
    32 
    33 
    34 # 设置不需要混淆的包, 可以使用通配符 * 和 *.**, 注意, 后者不包含前者
    35 -keep class com.demo.common.bean.* {
    36     public <fields>;
    37     public <methods>;
    38     *** set*(***);
    39     *** get*();
    40 }
    41 
    42 # 
    43 -keep class com.demo.common.config.* {
    44     public <fields>;
    45     public <methods>;
    46     *** set*(***);
    47     *** get*();
    48 }
    49 
    50 # 
    51 -keep class com.demo.common.dao.*.** {
    52     public <fields>;
    53     public <methods>;
    54     *** set*(***);
    55     *** get*();
    56 }
    57 
    58 # 
    59 -keep class com.demo.common.web.*.** {
    60     public <fields>;
    61     public <methods>;
    62     *** set*(***);
    63     *** get*();
    64 }
    65 
    66 # Keep - Applications. Keep all application classes, along with their 'main'
    67 # methods.
    68 -keepclasseswithmembers public class * {
    69     public static void main(java.lang.String[]);
    70 }
    71 
    72 # Keep names - Native method names. Keep all native class/method names.
    73 -keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
    74     native <methods>;
    75 }
  • 相关阅读:
    我是一条内存[转]
    随机翻唱辑 [2006.8.18更新]
    CentOS NTFS 挂载
    grub备忘
    CentOS 使用163软件源
    被车撞了
    爱上苦瓜
    无聊的游戏
    今天去爬山了
    博客搬家了:www.sanv.org
  • 原文地址:https://www.cnblogs.com/milton/p/4323795.html
Copyright © 2011-2022 走看看