Giter Club home page Giter Club logo

l-revc's Introduction

L-RevC

Tutorial for Reversing C code

Compile Code

gcc -o app.exe app.c
  • -o : output
gcc -S -o app.s app.c 
  • -S : stop after the stage of compilation proper; do not assemble.
gcc -ggdb -o app-b.exe app.c 
  • -ggdb : Produce debugging info for use by GDB.

Dump from binary

objdump -S --disassemble app.exe > app.dump
  • -S : source, display source code intermixed with disassembly
  • --disassemble : display assembler mnemonics for the machine instructions from app.exe (objfile)
objdump -M intel -S --disassemble app.exe > app-i.dump 
  • -M : specific info to the disassembler
  • intel: syntax mode, "att" for AT&T syntax mode

Debug binary

gdb -q ./app-b.exe
  • -q: quiet, do not print the intro and copyright messages.

    Commands for GDB

  • q: quit

  • h | help break

    Commands for Static Analysis:

  • l | list 1 : list code #requires: --ggdb

  • r | run : run program

  • disass | disassemble : disassemble a function

    Commands for Dynamic Analysis:

  • b | break : set a break point

  • s | step

  • c | continue : continue program execution

  • print

  • i r | info registers : dump all registers in memory

    Comands for memory inspection:

  • x/

    : examine memory; FMT = Format

  • x/10xb 0xBFFFF450 // x= hex, b = byte

  • x/10cb $edi. // c = character constant

Finding Dependencies (Shared Object)

readelf -d app.exe | grep 'NEEDED'
  • -d : dynamic, displays the content of the file's dynamic section.
objdump -p app.exe | grep NEEDED
  • -p : private headers, print info specific to the obj file format.
ldd app.exe

l-revc's People

Contributors

adnrbp avatar

Watchers

James Cloos avatar  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.