Coder Social home page Coder Social logo

dwarf2json's Introduction

Introduction

dwarf2json is a Go utility that processes files containing symbol and type information to generate Volatility3 Intermediate Symbol File (ISF) JSON output suitable for Linux and macOS analysis.

build

To build (Go 1.14+ required):

  $ go build

To run:

  $ ./dwarf2json --help
  Usage: ./dwarf2json COMMAND

  A tool for generating intermediate symbol file (ISF)

  Commands:
    linux  generate ISF for Linux analysis
    mac    generate ISF for macOS analysis

Note: processing large DWARF files requires a minimum of 8GB RAM.

Linux Processing

dwarf2json supports processing DWARF and symbol table information from ELF files and symbols from System.map input files to produce ISF for Linux analysis.

The user is able to select whether to include symbol, type, or both for each input file.

  $ ./dwarf2json linux --help
  Usage: dwarf2json linux [OPTIONS]

        --elf PATH           ELF file PATH to extract symbol and type information
        --elf-symbols PATH   ELF file PATH to extract only symbol information
        --elf-types PATH     ELF file PATH to extract only type information
        --system-map PATH    System.Map file PATH to extract symbol information

For example, to include symbols and types for a given Linux kernel DWARF file can be done with:

  $ ./dwarf2json linux --elf /usr/lib/debug/boot/vmlinux-4.4.0-137-generic > output.json

Symbol offsets for symbols extracted from symbol table information take precedence over those extracted from DWARF information. Thus, symbols extracted from files specified with --elf-symbols flag take precedence over symbols extracted from files specified with --elf. Symbol offsets for symbols from System.Map, specified with --system-map flag, are the highest precedence. If there is a conflict between the different symbol information sources, the offset from System.Map will be used.

Providing multiple input files for a given flag is allowed. For example, ./dwarf2json --elf file1 --elf file2 ... would process both file1 and file2. When conflicting symbol or type information is encountered, the data from the last file specified in the command invocation would take precedence.

MacOS Processing

dwarf2json supports processing DWARF and symbol table information from Mach-O files to produce ISF for macOS analysis.

The user is able to select whether to include symbol, type, or both for each input file.

  $ ./dwarf2json mac --help
  Usage: dwarf2json mac [OPTIONS]

        --arch NAME            architecture for universal FAT files. NAME is one of {i386|x86_64}
        --macho PATH           Mach-O file PATH to extract symbol and type information
        --macho-symbols PATH   Mach-O file PATH to extract only symbol information
        --macho-types PATH     Mach-O file PATH to extract only type information

For example, to include symbols and types for a given macOS kernel DWARF file and symbols from a macOS kernel can be done with:

  $ ./dwarf2json mac --macho /path/kernel.dSYM/Contents/Resources/DWARF/kernel \
    --macho-symbols /path/kernel > output.json

Symbol offsets for symbols extracted from symbol table information take precedence over those extracted from DWARF information. Thus, symbols extracted from files specified with --macho-symbols flag take precedence over symbols extracted from files specified with --macho.

Providing multiple input files for a given flag is allowed. For example, ./dwarf2json --macho file1 --macho file2 ... would process both file1 and file2. When conflicting symbol or type information is encountered, the data from the last file specified in the command invocation would take precedence.

When processing Mach-O universal FAT binaries, the --arch flag needs to be used to select the architecture for one of the embedded Mach-O files.

For example, generating ISF JSON file for i386 architecture of a OS X 10.7 kernel debug kit can be done with:

  $ ./dwarf2json mac --arch i386 \
  --macho mach_kernel.dSYM/Contents/Resources/DWARF/mach_kernel \
  --macho-symbols mach_kernel > mach_kernel.json

dwarf2json's People

Contributors

ilch1 avatar digitalisx avatar mkonshie avatar npetroni 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.