javaclass反編譯后的代碼還原_第1頁
javaclass反編譯后的代碼還原_第2頁
javaclass反編譯后的代碼還原_第3頁
javaclass反編譯后的代碼還原_第4頁
全文預覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、javaclass利用jad反編譯之后,偶爾回碰到一些不正常的代碼,例如:labelO:丄1MISSING_BLOCK_LABEL_30、JVMINSTRret7、JVMINSTRtableswitch13:default269、JVMINSTRmonitorexit、JVMINSTRmonitorenter,這些一般是由特殊的for循環(huán)、trycatchfinally語句塊、synchronized語句反編譯后產(chǎn)生的。下面,就簡單介紹一下,一些反編譯后的特殊代碼的還原規(guī)則。異常下面的代碼前提是類中有如下屬性,Calendarcal=Calendar.getInstance();1、Excep

2、tioin的還原反編譯后的代碼如下:publicbooleanf1()returncal.getTime().after(newDate();Exceptione;e;e.printStackTrace();returnfalse;還原后的Java代碼publicbooleanf1()tryreturncal.getTime().after(newDate();catch(Exceptione)e.printStackTrace();returnfalse;2、finally代碼的還原反編譯后的Java代碼如下:publicbooleanf2()booleanflag=cal.getTime(

3、).after(newDate();System.out.println(finally);returnflag;Exceptione;e;e.printStackTrace();System.out.println(finally);returnfalse;Exceptionexception;exception;System.out.println(finally);throwexception;還原后的代碼如下:publicbooleanf2()tryreturncal.getTime().after(newDate();catch(Exceptione)e.printStackTrac

4、e();returnfalse;finallySystem.out.println(finally);3、MISSING_BLOCK_LABEL_的還原反編譯后的代碼publicObjectf22()Datedate=cal.getTime();System.out.println(finally);returndate;Exceptione;e;e.printStackTrace();System.out.println(finally);breakMISSING_BLOCK_LABEL_45;Exceptionexception;exception;System.out.println(f

5、inally);throwexception;returnnull;還原后的Java代碼publicObjectf22()tryreturncal.getTime();catch(Exceptione)e.printStackTrace();finallySystem.out.println(finally);returnnull;4、異常中:label的還原反編譯后的代碼publicStringf4()throwsExceptionlabelO:tryIntegeri=newInteger(1);if(Value()O)System.out.println(i);breaklabelO;Sy

6、stem.err.println(i);catch(Exceptiondae)System.err.println(dae);thrownewRuntimeException(dae);returnnull;returnHello;注意,這個代碼有點詭異,實際代碼如下:publicStringf4()throwsExceptiontryIntegeri=newInteger(1);if(Value()O)System.out.println(i);elseSystem.err.println(i);returnnull;returnHello;catch(Exceptiondae)System

7、.err.println(dae);thrownewRuntimeException(dae);5、典型數(shù)據(jù)庫操作代碼還原反編譯后代碼publicHashMapf5()Connectionconn=null;HashMaphashmap;HashMapmap=newHashMap();Class.forName();conn=DriverManager.getConnection(jdbc:odbc:);PreparedStatementpstmt=conn.prepareStatement(select*fromtable);pstmt.setString(1,param);Stringco

8、lumnVallue;for(ResultSetrs=pstmt.executeQuery();rs.next();map.put(columnVallue,)columnVallue=rs.getString(column);hashmap=map;if(conn!=null)tryconn.close();catch(SQLExceptionsqlce)sqlce.printStackTrace();returnhashmap;ClassNotFoundExceptioncnfe;cnfe;cnfe.printStackTrace();if(conn!=null)tryconn.close

9、();catch(SQLExceptionsqlce)sqlce.printStackTrace();breakMISSING_BLOCK_LABEL_188;SQLExceptionsqle;sqle;sqle.printStackTrace();if(conn!=null)tryconn.close();catch(SQLExceptionsqlce)sqlce.printStackTrace();breakMISSING_BLOCK_LABEL_188;Exceptionexception;exception;if(conn!=null)tryconn.close();catch(SQL

10、Exceptionsqlce)sqlce.printStackTrace();throwexception;returnnull;實際代碼如下:publicHashMapf5()Connectionconn=null;tryHashMapmap=newHashMap();Class.forName();conn=DriverManager.getConnection(jdbc:odbc:);PreparedStatementpstmt=conn.prepareStatement(select*fromtable);pstmt.setString(1,param);ResultSetrs=pst

11、mt.executeQuery();while(rs.next()StringcolumnVallue=rs.getString(column);map.put(columnVallue,);returnmap;catch(ClassNotFoundExceptioncnfe)cnfe.printStackTrace();catch(SQLExceptionsqle)sqle.printStackTrace();finallyif(conn!=null)tryconn.close();catch(SQLExceptionsqlce)sqlce.printStackTrace();returnn

12、ull;6、兩層異常嵌套代碼還原反編譯后的代碼publicintf6()inti=cal.getTime().compareTo(newDate();System.out.println(finally);returni;Exceptione1;e1;e1.printStackTrace();System.out.println(finally);return-1;Exceptione2;e2;e2.printStackTrace();System.out.println(finally);return-2;Exceptionexception;exception;System.out.pri

13、ntln(finally);throwexception;實際代碼publicintf6()trytryreturncal.getTime().compareTo(newDate();catch(Exceptione1)e1.printStackTrace();return-1;catch(Exceptione2)e2.printStackTrace();return-2;finallySystem.out.println(finally);7、非常詭異的代碼反編譯后的代碼publicintf7()inti=cal.getTime().compareTo(newDate();System.out.println(finally);returni;Exceptione1;e1;e1.printStackTrace();_L2:System.out.println(finally);return-1;Exceptione2;e2;e2.printStackTrace();if(true)goto_L2;elsegoto_L1_L1:Exceptionexception;exception;System.out.println(fi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論