DexDump使用和解析

背景

因为毕设是脱壳,就借鉴http://cb.drops.wiki/drops/tips-9214.html
乌云上的这篇上交的大牛脱壳机的思路,卡在脱壳那里了

我们的第一个反应是有没有现成的程序,可以去翻译Dalvik字节码的,但是以读入内存中的DexFile结构体为输入,同时可以直接基于源码实现,也就是用C/C++实现的,而不是像更多的静态逆向工具直接以读入一个静态DEX文件为输入。找了下发现Android系统源码里本身就提供了DexDump(dalvik/dexdump/DexDump.cpp)这个工具,直接能满足这个要求。我们对DexDump代码稍作修改,插入到解释器中

使用

在win上 搜索sdk下的dexdump.exe文件 然后使用命令

 C:\Users\tangsilian\AppData\Local\Android\Sdk\build-tools\23.0.2\dexdump.exe C:\Users\tangsilian\Desktop\classes.dex
>>tangsilian.txt

得到如下的文件

Processing 'C:\Users\tangsilian\Desktop\classes.dex'...
Opened 'C:\Users\tangsilian\Desktop\classes.dex', DEX version '035'
Class #0            -
  Class descriptor  : 'Landroid/support/annotation/AnimRes;'
  Access flags      : 0x2601 (PUBLIC INTERFACE ABSTRACT ANNOTATION)
  Superclass        : 'Ljava/lang/Object;'
  Interfaces        -
    #0              : 'Ljava/lang/annotation/Annotation;'
  Static fields     -
  Instance fields   -
  Direct methods    -
  Virtual methods   -
  source_file_idx   : 893 (AnimRes.java)
...

Class #1633            -
  Class descriptor  : 'Landroid/support/v4/view/ViewCompat$Api24ViewCompatImpl;'
  Access flags      : 0x0000 ()
  Superclass        : 'Landroid/support/v4/view/ViewCompat$MarshmallowViewCompatImpl;'
  Interfaces        -
  Static fields     -
  Instance fields   -
  Direct methods    -
    #0              : (in Landroid/support/v4/view/ViewCompat$Api24ViewCompatImpl;)
      name          : '<init>'
      type          : '()V'
      access        : 0x10000 (CONSTRUCTOR)
      code          -
      registers     : 1
      ins           : 1
      outs          : 1
      insns size    : 4 16-bit code units
      catches       : (none)
      positions     : 
        0x0000 line=1810
      locals        : 
        0x0000 - 0x0004 reg=0 this Landroid/support/v4/view/ViewCompat$Api24ViewCompatImpl; 
  Virtual methods   -
    #0              : (in Landroid/support/v4/view/ViewCompat$Api24ViewCompatImpl;)
      name          : 'setPointerIcon'
      type          : '(Landroid/view/View;Landroid/support/v4/view/PointerIconCompat;)V'
      access        : 0x0001 (PUBLIC)
      code          -
      registers     : 4
      ins           : 3
      outs          : 2
      insns size    : 8 16-bit code units
      catches       : (none)
      positions     : 
        0x0000 line=1813
        0x0007 line=1814
      locals        : 
        0x0000 - 0x0008 reg=1 this Landroid/support/v4/view/ViewCompat$Api24ViewCompatImpl; 
        0x0000 - 0x0008 reg=2 view Landroid/view/View; 
        0x0000 - 0x0008 reg=3 pointerIconCompat Landroid/support/v4/view/PointerIconCompat; 
  source_file_idx   : 6861 (ViewCompat.java)

分析dexdump的源码,思考如何在解释器里利用
DexDump.cpp (dalvik\dexdump) 59520 2016-12-20 源码位置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Frida-dexdump是一款基于Frida框架的Android应用程序反编译工具,可以帮助用户快速地反编译APK文件、DEX文件和ODEX文件等。下面是Frida-dexdump使用教程: 1.安装Frida 首先需要在计算机上安装Frida,可以在官网下载相应的安装文件,也可以使用npm等包管理工具进行安装。 2.连接设备 将Android设备通过USB线连接到计算机上,并在设备上开启USB调试模式。 3.启动Frida 在计算机上启动Frida,可以使用命令行或者Frida图形界面启动。启动后会出现一个命令行窗口或者一个图形界面。 4.启动应用程序 在设备上启动需要反编译的应用程序,并在Frida中使用attach命令将应用程序附加到Frida中。例如: ``` frida -U -l frida-dexdump.js com.example.app ``` 其中,-U表示连接USB设备,-l表示加载frida-dexdump.js脚本文件,com.example.app表示要反编译的应用程序的包名。 5.反编译应用程序 在Frida中输入dexdump命令,即可对应用程序进行反编译,例如: ``` dexdump("classes.dex"); ``` 其中,classes.dex表示要反编译的DEX文件,也可以指定ODEX文件进行反编译。 6.保存反编译结果 反编译完成后,可以将结果保存到本地文件中,例如: ``` var file = new File("/sdcard/classes.txt", "w"); file.write(dexdump("classes.dex")); file.flush(); file.close(); ``` 其中,/sdcard/classes.txt表示保存结果的文件名和路径,w表示以写入模式打开文件。 以上就是Frida-dexdump使用教程,通过这款工具可以快速地反编译Android应用程序,方便进行逆向分析和安全测试。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值