Coder Social home page Coder Social logo

softk's Introduction

Dynamic library C API signature extraction for dynamic invocation

This library extracts function signatures of exported C functions in an ELF file and creates a table of function to an ffi_type array describing the function parameters. For signature extraction, this library requires the input ELF to be compiled with DWARF information generated with gcc -g switch. Note -g should be used even when the input ELF is compliled with optimization like -O2 or -O3.

Dependencies

  1. libdw
  2. libelf
  3. libffi

Build

Release

mkdir -p build/Release
cd build/Release
cmake -DCMAKE_BUILD_TYPE=Release ../../src/
make
make test

Debug

mkdir -p build/Debug
cd build/Debug
cmake -DCMAKE_BUILD_TYPE=Debug ../../src/
make
make test

Usage

./sk <elf_file_with_debug_symbols>

Example Session

xsjsonalsmbp:~/<1>softk/build/Debug>./sk ./sk
Using shared object file: ./sk
----
main(int argc, * argv)
----
----
poo(?? tear, float fear)
----
----
doo(int ear, * var)
----
----
zoo(int8_t zar, int16_t dar)
----
----
foo(* bar, double baz)
----
xsjsonalsmbp:~/<1>softk/build/Debug>

TODO

Add infrastructure to the library to dlopen an input ELF, enumerate symbols using generated signal table, find a given function's entry point using dlsym and then invoke the function after dynamically assembling a call frame using user provided function args.

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.