java class反编译后的代码还原

上传人:pu****.1 文档编号:431831089 上传时间:2023-11-02 格式:DOCX 页数:4 大小:10.14KB
返回 下载 相关 举报
java class反编译后的代码还原_第1页
第1页 / 共4页
java class反编译后的代码还原_第2页
第2页 / 共4页
java class反编译后的代码还原_第3页
第3页 / 共4页
java class反编译后的代码还原_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《java class反编译后的代码还原》由会员分享,可在线阅读,更多相关《java class反编译后的代码还原(4页珍藏版)》请在金锄头文库上搜索。

1、java class 利用 jad 反编译之后,偶尔回碰到一些不正常的代码,例如: label0 :_L1 MISSING_BLOCK_LABEL_30、JVM INSTR ret 7、JVM INSTR tableswitch 1 3: default 269、JVM INSTR monitorexit、JVM INSTR monitorenter,这些一般是由特殊的 for 循环、try catch finally 语句块、 synchronized 语句反编译后产生的。下面,就简单介绍一下,一些反编译后 的特殊代码的还原规则。异常下面的代码前提是类中有如下属性,Calendar cal

2、= Calendar.getInstance();1、Exceptioin 的还原反编译后的代码如下: public boolean f1() return cal.getTime().after(new Date();Exception e; e;e.printStackTrace();return false; 还原后的 Java 代码 public boolean f1() try return cal.getTime().after(new Date(); catch (Exception e) e.printStackTrace(); return false; 2、finally

3、代码的还原 反编译后的 Java 代码如下: public boolean f2() boolean flag = cal.getTime().after(new Date();System.out.println(finally);return flag;Exception e; e;e.printStackTrace();System.out.println(finally);return false;Exception exception; exception;System.out.println(finally);throw exception; 还原后的代码如下: public bo

4、olean f2() try return cal.getTime().after(new Date(); catch (Exception e) e.printStackTrace();return false; finally System.out.println(finally); 3、MISSING_BLOCK_LABEL_的还原反编译后的代码 public Object f22() Date date = cal.getTime();System.out.println(finally);return date;Exception e;e;e.printStackTrace();Sy

5、stem.out.println(finally);break MISSING_BLOCK_LABEL_45;Exception exception;exception;System.out.println(finally);throw exception;return null; 还原后的 Java 代码 public Object f22() try return cal.getTime(); catch (Exception e) e.printStackTrace(); finally System.out.println(finally); return null;4、异常中:lab

6、el 的还原反编译后的代码 public String f4() throws Exception labelO: try Integer i = new Integer(1);if(i.intValue() O) System.out.println(i);break labelO; System.err.println(i); catch(Exception dae) System.err.println(dae);throw new RuntimeException(dae); return null; return Hello;注意,这个代码有点诡异,实际代码如下:public Str

7、ing f4() throws Exception try Integer i = new Integer(1);if (i.intValue() O) System.out.println(i); else System.err.println(i);return null; return Hello; catch (Exception dae) System.err.println(dae);throw new RuntimeException(dae); 5、典型数据库操作代码还原反编译后代码 public HashMap f5() Connection conn = null; Has

8、hMap hashmap;HashMap map = new HashMap();Class.forName();conn = DriverManager.getConnection(jdbc:odbc:);PreparedStatement pstmt = conn.prepareStatement(select * from table); pstmt.setString(1, param);String columnVallue; for(ResultSet rs = pstmt.executeQuery(); rs.next();map.put(columnVallue, ) colu

9、mnVallue = rs.getString(column); hashmap = map;if(conn != null) try conn.close(); catch(SQLException sqlce) sqlce.printStackTrace(); return hashmap;ClassNotFoundException cnfe; cnfe;cnfe.printStackTrace();if(conn != null) try conn.close(); catch(SQLException sqlce) sqlce.printStackTrace(); break MIS

10、SING_BLOCK_LABEL_188; SQLException sqle;sqle; sqle.printStackTrace();if(conn != null) try conn.close(); catch(SQLException sqlce) sqlce.printStackTrace(); break MISSING_BLOCK_LABEL_188;Exception exception; exception;if(conn != null) try conn.close(); catch(SQLException sqlce) sqlce.printStackTrace()

11、; throw exception; return null; 实际代码如下: public HashMap f5() Connection conn = null; try HashMap map = new HashMap();Class.forName();conn = DriverManager.getConnection(jdbc:odbc:);PreparedStatement pstmt = conn.prepareStatement(select * from table); pstmt.setString(1, param);ResultSet rs = pstmt.exec

12、uteQuery();while (rs.next() String columnVallue = rs.getString(column); map.put(columnVallue, ); return map; catch (ClassNotFoundException cnfe) cnfe.printStackTrace(); catch (SQLException sqle) sqle.printStackTrace(); finally if (conn != null) try conn.close(); catch (SQLException sqlce) sqlce.prin

13、tStackTrace(); return null;6、 两层异常嵌套代码 还原 反编 译后的代 码 public int f6() int i = cal.getTime().compareTo(new Date();System.out.println(finally);return i;Exception e1;e1;e1.printStackTrace(); System.out.println(finally);return -1;Exception e2;e2;e2.printStackTrace();System.out.println(finally);return -2;E

14、xception exception;exception;System.out.println(finally);throw exception; 实际代码 public int f6() try try return cal.getTime().compareTo(new Date(); catch (Exception e1) e1.printStackTrace();return -1; catch (Exception e2) e2.printStackTrace();return -2; finally System.out.println(finally); 7、非常诡异的代码反编

15、译后的代码 public int f7() int i = cal.getTime().compareTo(new Date();System.out.println(finally);return i;Exception e1;e1;e1.printStackTrace();_L2: System.out.println(finally);return -1;Exception e2;e2;e2.printStackTrace();if(true) goto _L2;else goto _L1 _L1: Exception exception;exception; System.out.prin

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 机械/制造/汽车 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号