Giter Club home page Giter Club logo

lldb-capstone-arm's Introduction

lldb-capstone-arm

A lldb script for disassemble ARM(Thumb)/ARM64 code by Capstone Engine

Setup

Install capstone and Python bindings:

brew install capstone
sudo pip install capstone

Then deploy scripts:

  1. Unzip and move *.py to ~/.lldb
  2. Load script in lldb like: command script import ~/.lldb/dis_capstone.py

or add command script import ~/.lldb/dis_capstone.py to ~/.lldbinit (create if not exists)

Example

Thumb code disassemble compare:

Screenshot

discs with -f and -h:

(lldb) discs -f
  SBThread: tid = 0x357e9, frame #0: 0x31c366ba libobjc.A.dylib`objc_retain + 10
      Address: libobjc.A.dylib[0x2f2286ba] (libobjc.A.dylib.__TEXT.__text + 116410)
      Summary: libobjc.A.dylib`objc_retain + 10

-> 0x31c366ba:  09 7C            ldrb     r1, [r1, #0x10]
   0x31c366bc:  11 F0 02 0F      tst.w    r1, #2
   0x31c366c0:  18 BF            it       ne
   0x31c366c2:  00 F0 8F B9      b.w      #0x31c369e4
   0x31c366c6:  47 F6 0A 21      movw     r1, #0x7a0a
   0x31c366ca:  C0 F2 CF 21      movt     r1, #0x2cf
   0x31c366ce:  79 44            add      r1, pc
   0x31c366d0:  09 68            ldr      r1, [r1]
   0x31c366d2:  09 68            ldr      r1, [r1]
   0x31c366d4:  F2 F7 44 BC      b.w      #0x31c28f60
   0x31c366d8:  F0 B5            push     {r4, r5, r6, r7, lr}

(lldb) discs -h
Usage: discs (-f) (-s <addr>) (-l <len>) (-A <arm|arm64>) (-M <arm|thumb>)

Options:
   -h, --help            show this help message and exit
   -s START_ADDR, --start-addr=START_ADDR
                         start address (default: pc)
   -l LENGTH, --length=LENGTH
                         decode bytes length (default: 32)
   -A ARCH, --arch=ARCH  arch type: arm,arm64 (default: arm)
   -M MODE, --mode=MODE  mode type: arm,thumb (auto select by cpsr[b:5])
   -f, --full            show full outputs

lldb-capstone-arm's People

Contributors

upbit avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.