九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Proguard使用最新,最全教程,親自試驗

最近公司有一個項目,是外包項目,由于對方也有技術人員,出于技術上的保密,需要對class文件進行二次處理,于是網上找了好久,只發(fā)現Proguard是用的最廣泛而且網上資料最多的。由于不是純JAVA項目,而是WEB項目,涉及到大量的配置文件,所以用這個工具稍顯吃力,于是開始研究這玩意,花了好長一段時間,重復試驗了N次,終于整出來了,下面總結一下我的經驗。。

首先我介紹下我要混淆的項目框架是jeecg+easyui+spring(包含xml配置文件,導致部分class文件不能直接混淆)。下面開始說詳細的操作步奏:

1)將web項目的src目錄的java文件打包,只需要選擇java文件即可,其他配置文件什么的都不用選擇,如圖


2)http://proguard.sourceforge.net/下載proguard,目前我下載并使用的是proguard5.1(注:本人下載頻道也有proguard5.1)。

3)解壓proguard5.1,執(zhí)行 bin目錄下的proguardgui.bat


然后會彈出如下圖所示窗口


4)點擊左邊“input/output”菜單,然后點擊右邊的“Add input”按鈕,添加需要混淆的jar包,我這里是test.jar,然后點擊“add output”,選擇輸出的路徑和包名。


5)下面開始添加支持庫,這個地方很重要,很多同學剛開始使用這個工具的時候就是這里老是出問題。
   點擊右邊的“add”。

說明一下,這里最好把你的eclipse里java project里的libraries所有Library的jar包,包含web項目lib下面的包,jdk中jre下面的包和servlet.jar包等copy到一個目錄,然后在這里加入這些jar包。系統默認會帶上rt.jar,這里我們可以先remove掉,然后到jre下面copy所有的包。


6)點擊“shrinking”,設置成如圖所示。


7)點擊“obfuscation”,設置如圖所示


8)點擊“optimization”設置如圖所示

9)點擊information,設置如圖所示,注意選擇jdk版本(Target


10) 點擊“process”,再點擊“save configuration”,在彈出的對話框中,輸入要保存的配置文件名稱(這里我的是1111111.pro),最后點擊保存”.



11) 設置基本完成,關掉proguard窗口,找到剛剛保存的配置文件,開始手動修改部分配置。

以下是我的配置文件,經測試通過,手動修改的部分為紅色字體

-injars Test\test.jar

-outjars Test\test--.jar

 

-libraryjars 'D:\jdk1.6.0_45\jre\lib\rt.jar'

-libraryjars hunxiao\a\activation-1.1.jar

-libraryjars hunxiao\a\activiti-cxf-5.10.jar

-libraryjars hunxiao\a\activiti-engine-5.10.jar

-libraryjars hunxiao\a\activiti-spring-5.10.jar

-libraryjars hunxiao\a\alt-rt.jar

-libraryjars hunxiao\a\alt-string.jar

-libraryjars hunxiao\a\aopalliance-1.0.jar

-libraryjars hunxiao\a\c3p0-0.9.1.2.jar

-libraryjars hunxiao\a\charsets.jar

-libraryjars hunxiao\a\commons-beanutils-1.9.1.jar

-libraryjars hunxiao\a\commons-codec-1.9.jar

-libraryjars hunxiao\a\commons-collections-3.2.1.jar

-libraryjars hunxiao\a\commons-digester-1.7.jar

-libraryjars hunxiao\a\commons-digester3-3.2.jar

-libraryjars hunxiao\a\commons-io-2.0.1.jar

-libraryjars hunxiao\a\commons-lang3-3.3.jar

-libraryjars hunxiao\a\commons-logging-1.1.3.jar

-libraryjars hunxiao\a\cos-26Dec2008.jar

-libraryjars hunxiao\a\deploy.jar

-libraryjars hunxiao\a\dom4j-1.6.1.jar

-libraryjars hunxiao\a\druid-0.2.6.jar

-libraryjars hunxiao\a\edtftpj.jar

-libraryjars hunxiao\a\ehcache-core-2.5.2.jar

-libraryjars hunxiao\a\fastjson-1.2.0.jar

-libraryjars hunxiao\a\fprzMock.jar

-libraryjars hunxiao\a\freemarker-2.3.16.jar

-libraryjars hunxiao\a\groovy-all-1.5.5.jar

-libraryjars hunxiao\a\guava-16.0.1.jar

-libraryjars hunxiao\a\hessian-4.0.7.jar

-libraryjars hunxiao\a\itext-2.1.7.jar

-libraryjars hunxiao\a\iTextAsian-2.1.jar

-libraryjars hunxiao\a\jasperreports-3.7.4.jar

-libraryjars hunxiao\a\javaws.jar

-libraryjars hunxiao\a\javax.servlet.jsp.jstl-1.2.0.v201105211821.jar

-libraryjars hunxiao\a\jce.jar

-libraryjars hunxiao\a\jfinal-1.6-bin-with-src.jar

-libraryjars hunxiao\a\jfinal-ext-eu.jar

-libraryjars hunxiao\a\jna-4.1.0.jar

-libraryjars hunxiao\a\jna-platform-4.1.0.jar

-libraryjars hunxiao\a\joda-time-2.1.jar

-libraryjars hunxiao\a\joor-0.9.3.jar

-libraryjars hunxiao\a\jsse.jar

-libraryjars hunxiao\a\jxls-core-0.9.9.jar

-libraryjars hunxiao\a\kaptcha-2.3.2.jar

-libraryjars hunxiao\a\log4j-1.2.16.jar

-libraryjars hunxiao\a\management-agent.jar

-libraryjars hunxiao\a\mybatis-3.1.1.jar

-libraryjars hunxiao\a\mysql-connector-java-5.1.20-bin.jar

-libraryjars hunxiao\a\ojdbc6.jar

-libraryjars hunxiao\a\org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar

-libraryjars hunxiao\a\org.springframework.aop-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.asm-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.aspects-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.beans-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.context-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.context.support-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.core-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.expression-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.instrument-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.instrument.tomcat-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.jdbc-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.jms-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.org.apache.commons.logging-1.1.1.jar

-libraryjars hunxiao\a\org.springframework.orm-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.oxm-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.test-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.transaction-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.web-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.web.portlet-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\org.springframework.web.servlet-3.1.1.RELEASE.jar

-libraryjars hunxiao\a\plugin.jar

-libraryjars hunxiao\a\poi-3.9.jar

-libraryjars hunxiao\a\quartz-1.8.6.jar

-libraryjars hunxiao\a\resources.jar

-libraryjars hunxiao\a\rt.jar

-libraryjars hunxiao\a\servlet-api.jar

-libraryjars hunxiao\a\shiro-all-1.2.3.jar

-libraryjars hunxiao\a\slf4j-api-1.6.1.jar

-libraryjars hunxiao\a\slf4j-log4j12-1.6.1.jar

-libraryjars hunxiao\a\sqlite-jdbc-3.7.2.jar

-libraryjars hunxiao\a\ssosdk-2.0-SNAPSHOT.jar

-libraryjars hunxiao\a\TaxWsBean.jar

 

-target 1.6

-dontshrink

-useuniqueclassmembernames

-keeppackagenames

-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod

-keepparameternames

 

#保留單個類

-keep public class net.easyunion.common.shiro.ShiroDbRealm

-keep public class net.easyunion.common.filters.SetCharacterEncodingFilter

-keep public class net.easyunion.common.queue.MakeQueue

 

#保留所有控制類(如果是SSH三大框架,由于頁面發(fā)出請求到struts核心攔截器攔截之后,找到配置文件,配置文件必須對應action里面的類和方法,這里就不能混淆類和方法,所以所有的action類包括里面的方法都不需要混淆,按照如下方式設置就行,保留所有的Action類名和方法名)

-keep public class net.easyunion.app.invoice.controller.* {*;}

-keep public class net.easyunion.app.sysseting.controller.* {*;}

-keep public class net.easyunion.app.system.controller.* {*;}

-keep public class net.easyunion.app.system.model.* {*;}

-keep public class net.easyunion.app.supplier.controller.*  {*;}

-keep public class net.easyunion.common.controller.*  {*;}

 

-keep public class net.easyunion.app.Config

 

 

# Keep names - Native method names. Keep all native class/method names.

-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {

    native <methods>;

}

 

# Keep names - _class method names. Keep all .class method names. This may be

# useful for libraries that will be obfuscated again with different obfuscators.

-keepclassmembers,allowshrinking class * {

    java.lang.Class class$(java.lang.String);

    java.lang.Class class$(java.lang.String,boolean);

}

 

# Remove - System method calls. Remove all invocations of System

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.System {

    public static long currentTimeMillis();

    static java.lang.Class getCallerClass();

    public static int identityHashCode(java.lang.Object);

    public static java.lang.SecurityManager getSecurityManager();

    public static java.util.Properties getProperties();

    public static java.lang.String getProperty(java.lang.String);

    public static java.lang.String getenv(java.lang.String);

    public static java.lang.String mapLibraryName(java.lang.String);

    public static java.lang.String getProperty(java.lang.String,java.lang.String);

}

 

# Remove - Math method calls. Remove all invocations of Math

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.Math {

    public static double sin(double);

    public static double cos(double);

    public static double tan(double);

    public static double asin(double);

    public static double acos(double);

    public static double atan(double);

    public static double toRadians(double);

    public static double toDegrees(double);

    public static double exp(double);

    public static double log(double);

    public static double log10(double);

    public static double sqrt(double);

    public static double cbrt(double);

    public static double IEEEremainder(double,double);

    public static double ceil(double);

    public static double floor(double);

    public static double rint(double);

    public static double atan2(double,double);

    public static double pow(double,double);

    public static int round(float);

    public static long round(double);

    public static double random();

    public static int abs(int);

    public static long abs(long);

    public static float abs(float);

    public static double abs(double);

    public static int max(int,int);

    public static long max(long,long);

    public static float max(float,float);

    public static double max(double,double);

    public static int min(int,int);

    public static long min(long,long);

    public static float min(float,float);

    public static double min(double,double);

    public static double ulp(double);

    public static float ulp(float);

    public static double signum(double);

    public static float signum(float);

    public static double sinh(double);

    public static double cosh(double);

    public static double tanh(double);

    public static double hypot(double,double);

    public static double expm1(double);

    public static double log1p(double);

}

 

# Remove - Number method calls. Remove all invocations of Number

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.* extends java.lang.Number {

    public static java.lang.String toString(byte);

    public static java.lang.Byte valueOf(byte);

    public static byte parseByte(java.lang.String);

    public static byte parseByte(java.lang.String,int);

    public static java.lang.Byte valueOf(java.lang.String,int);

    public static java.lang.Byte valueOf(java.lang.String);

    public static java.lang.Byte decode(java.lang.String);

    public int compareTo(java.lang.Byte);

    public static java.lang.String toString(short);

    public static short parseShort(java.lang.String);

    public static short parseShort(java.lang.String,int);

    public static java.lang.Short valueOf(java.lang.String,int);

    public static java.lang.Short valueOf(java.lang.String);

    public static java.lang.Short valueOf(short);

    public static java.lang.Short decode(java.lang.String);

    public static short reverseBytes(short);

    public int compareTo(java.lang.Short);

    public static java.lang.String toString(int,int);

    public static java.lang.String toHexString(int);

    public static java.lang.String toOctalString(int);

    public static java.lang.String toBinaryString(int);

    public static java.lang.String toString(int);

    public static int parseInt(java.lang.String,int);

    public static int parseInt(java.lang.String);

    public static java.lang.Integer valueOf(java.lang.String,int);

    public static java.lang.Integer valueOf(java.lang.String);

    public static java.lang.Integer valueOf(int);

    public static java.lang.Integer getInteger(java.lang.String);

    public static java.lang.Integer getInteger(java.lang.String,int);

    public static java.lang.Integer getInteger(java.lang.String,java.lang.Integer);

    public static java.lang.Integer decode(java.lang.String);

    public static int highestOneBit(int);

    public static int lowestOneBit(int);

    public static int numberOfLeadingZeros(int);

    public static int numberOfTrailingZeros(int);

    public static int bitCount(int);

    public static int rotateLeft(int,int);

    public static int rotateRight(int,int);

    public static int reverse(int);

    public static int signum(int);

    public static int reverseBytes(int);

    public int compareTo(java.lang.Integer);

    public static java.lang.String toString(long,int);

    public static java.lang.String toHexString(long);

    public static java.lang.String toOctalString(long);

    public static java.lang.String toBinaryString(long);

    public static java.lang.String toString(long);

    public static long parseLong(java.lang.String,int);

    public static long parseLong(java.lang.String);

    public static java.lang.Long valueOf(java.lang.String,int);

    public static java.lang.Long valueOf(java.lang.String);

    public static java.lang.Long valueOf(long);

    public static java.lang.Long decode(java.lang.String);

    public static java.lang.Long getLong(java.lang.String);

    public static java.lang.Long getLong(java.lang.String,long);

    public static java.lang.Long getLong(java.lang.String,java.lang.Long);

    public static long highestOneBit(long);

    public static long lowestOneBit(long);

    public static int numberOfLeadingZeros(long);

    public static int numberOfTrailingZeros(long);

    public static int bitCount(long);

    public static long rotateLeft(long,int);

    public static long rotateRight(long,int);

    public static long reverse(long);

    public static int signum(long);

    public static long reverseBytes(long);

    public int compareTo(java.lang.Long);

    public static java.lang.String toString(float);

    public static java.lang.String toHexString(float);

    public static java.lang.Float valueOf(java.lang.String);

    public static java.lang.Float valueOf(float);

    public static float parseFloat(java.lang.String);

    public static boolean isNaN(float);

    public static boolean isInfinite(float);

    public static int floatToIntBits(float);

    public static int floatToRawIntBits(float);

    public static float intBitsToFloat(int);

    public static int compare(float,float);

    public boolean isNaN();

    public boolean isInfinite();

    public int compareTo(java.lang.Float);

    public static java.lang.String toString(double);

    public static java.lang.String toHexString(double);

    public static java.lang.Double valueOf(java.lang.String);

    public static java.lang.Double valueOf(double);

    public static double parseDouble(java.lang.String);

    public static boolean isNaN(double);

    public static boolean isInfinite(double);

    public static long doubleToLongBits(double);

    public static long doubleToRawLongBits(double);

    public static double longBitsToDouble(long);

    public static int compare(double,double);

    public boolean isNaN();

    public boolean isInfinite();

    public int compareTo(java.lang.Double);

    public byte byteValue();

    public short shortValue();

    public int intValue();

    public long longValue();

    public float floatValue();

    public double doubleValue();

    public int compareTo(java.lang.Object);

    public boolean equals(java.lang.Object);

    public int hashCode();

    public java.lang.String toString();

}

 

# Remove - String method calls. Remove all invocations of String

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.String {

    public static java.lang.String copyValueOf(char[]);

    public static java.lang.String copyValueOf(char[],int,int);

    public static java.lang.String valueOf(boolean);

    public static java.lang.String valueOf(char);

    public static java.lang.String valueOf(char[]);

    public static java.lang.String valueOf(char[],int,int);

    public static java.lang.String valueOf(double);

    public static java.lang.String valueOf(float);

    public static java.lang.String valueOf(int);

    public static java.lang.String valueOf(java.lang.Object);

    public static java.lang.String valueOf(long);

    public boolean contentEquals(java.lang.StringBuffer);

    public boolean endsWith(java.lang.String);

    public boolean equalsIgnoreCase(java.lang.String);

    public boolean equals(java.lang.Object);

    public boolean matches(java.lang.String);

    public boolean regionMatches(boolean,int,java.lang.String,int,int);

    public boolean regionMatches(int,java.lang.String,int,int);

    public boolean startsWith(java.lang.String);

    public boolean startsWith(java.lang.String,int);

    public byte[] getBytes();

    public byte[] getBytes(java.lang.String);

    public char charAt(int);

    public char[] toCharArray();

    public int compareToIgnoreCase(java.lang.String);

    public int compareTo(java.lang.Object);

    public int compareTo(java.lang.String);

    public int hashCode();

    public int indexOf(int);

    public int indexOf(int,int);

    public int indexOf(java.lang.String);

    public int indexOf(java.lang.String,int);

    public int lastIndexOf(int);

    public int lastIndexOf(int,int);

    public int lastIndexOf(java.lang.String);

    public int lastIndexOf(java.lang.String,int);

    public int length();

    public java.lang.CharSequence subSequence(int,int);

    public java.lang.String concat(java.lang.String);

    public java.lang.String replaceAll(java.lang.String,java.lang.String);

    public java.lang.String replace(char,char);

    public java.lang.String replaceFirst(java.lang.String,java.lang.String);

    public java.lang.String[] split(java.lang.String);

    public java.lang.String[] split(java.lang.String,int);

    public java.lang.String substring(int);

    public java.lang.String substring(int,int);

    public java.lang.String toLowerCase();

    public java.lang.String toLowerCase(java.util.Locale);

    public java.lang.String toString();

    public java.lang.String toUpperCase();

    public java.lang.String toUpperCase(java.util.Locale);

    public java.lang.String trim();

}

 

# Remove - StringBuffer method calls. Remove all invocations of StringBuffer

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.StringBuffer {

    public java.lang.String toString();

    public char charAt(int);

    public int capacity();

    public int codePointAt(int);

    public int codePointBefore(int);

    public int indexOf(java.lang.String,int);

    public int lastIndexOf(java.lang.String);

    public int lastIndexOf(java.lang.String,int);

    public int length();

    public java.lang.String substring(int);

    public java.lang.String substring(int,int);

}

 

# Remove - StringBuilder method calls. Remove all invocations of StringBuilder

# methods without side effects whose return values are not used.

-assumenosideeffects public class java.lang.StringBuilder {

    public java.lang.String toString();

    public char charAt(int);

    public int capacity();

    public int codePointAt(int);

    public int codePointBefore(int);

    public int indexOf(java.lang.String,int);

    public int lastIndexOf(java.lang.String);

    public int lastIndexOf(java.lang.String,int);

    public int length();

    public java.lang.String substring(int);

    public java.lang.String substring(int,int);

}


12)手動設置完成后保存,然后重新打開progrard,執(zhí)行 bin目錄下的proguardgui.bat。

   點擊第一個選項“Proguard”,再點擊“Load configuration”,選擇我們剛才保存的“1111111.pro”進行加載。



13然后點擊Process,然后點擊View configuration查看是否是已經修改過后的配置文件。


14) 確認是最新修改過的配置文件,然后點擊process!開始混淆。。

如下圖,表示混淆成功。。



15)我們可以用jd-gui反編譯工具看看混淆后的效果。可以看到,之前設置不混淆的類都沒有更換類名,而混淆的類都自動更換為a,b,c等類名了。到此,整個java項目混淆就成功了,然后把混淆成功的class文件拷貝到自己的web項目中,替換原先的class文件,然后用tomcat跑項目,發(fā)現和正常的class文件運行效果一樣,項目正常運行。



16)說明下配置

參數: 
 
-include {filename}    從給定的文件中讀取配置參數 
-basedirectory {directoryname}    指定基礎目錄為以后相對的檔案名稱 
-injars {class_path}    指定要處理的應用程序jar,war,ear和目錄 
-outjars {class_path}    指定處理完后要輸出的jar,war,ear和目錄的名稱 
-libraryjars {classpath}    指定要處理的應用程序jar,war,ear和目錄所需要的程序庫文件 
-dontskipnonpubliclibraryclasses    指定不去忽略非公共的庫類。 
-dontskipnonpubliclibraryclassmembers    指定不去忽略包可見的庫類的成員。 

保留選項 

-keep {Modifier} {class_specification}    保護指定的類文件和類的成員 
-keepclassmembers {modifier} {class_specification}    保護指定類的成員,如果此類受到保護他們會保護的更好
-keepclasseswithmembers {class_specification}    保護指定的類和類的成員,但條件是所有指定的類和類成員是要存在。 
-keepnames {class_specification}    保護指定的類和類的成員的名稱(如果他們不會壓縮步驟中刪除) 
-keepclassmembernames {class_specification}    保護指定的類的成員的名稱(如果他們不會壓縮步驟中刪除)
-keepclasseswithmembernames {class_specification}    保護指定的類和類的成員的名稱,如果所有指定的類成員出席(在壓縮步驟之后) 
-printseeds {filename}    列出類和類的成員-keep選項的清單,標準輸出到給定的文件 
 
壓縮 

-dontshrink    不壓縮輸入的類文件 
-printusage {filename} 
-whyareyoukeeping {class_specification}     
 
優(yōu)化 

-dontoptimize    不優(yōu)化輸入的類文件 
-assumenosideeffects {class_specification}    優(yōu)化時假設指定的方法,沒有任何副作用 
-allowaccessmodification    優(yōu)化時允許訪問并修改有修飾符的類和類的成員 
 
混淆 

-dontobfuscate    不混淆輸入的類文件 
-printmapping {filename} 
-applymapping {filename}    重用映射增加混淆 
-obfuscationdictionary {filename}    使用給定文件中的關鍵字作為要混淆方法的名稱 
-overloadaggressively    混淆時應用侵入式重載 
-useuniqueclassmembernames    確定統一的混淆類的成員名稱來增加混淆 
-flattenpackagehierarchy {package_name}    重新包裝所有重命名的包并放在給定的單一包中 
-repackageclass {package_name}    重新包裝所有重命名的類文件中放在給定的單一包中 
-dontusemixedcaseclassnames    混淆時不會產生形形色色的類名 
-keepattributes {attribute_name,...}    保護給定的可選屬性,例如LineNumberTable, LocalVariableTable, SourceFile, Deprecated, Synthetic, Signature, and InnerClasses. 
-renamesourcefileattribute {string}    設置源文件中給定的字符串常量

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Java代碼加密與反編譯(一):利用混淆器工具proGuard對jar包加密
201871010116-祁英紅《面向對象程序設計(java)》第十六周學習總結
Proguard 使用
java Exception in thread "main" java.lang.NoSuchMethodError
201521123081《Java程序設計》 第3周學習總結
怎么解決java.lang.NoClassDefFoundError錯誤
更多類似文章 >>
生活服務
熱點新聞
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服