Git Product home page Git Product logo

pe-util's Introduction

List shared object dependencies of a portable executable (PE).

It uses the pe-parse library to read the PE structure.

2016, Georg Sauthoff [email protected]

Examples

Create a portable executable (PE) via cross-compiling and displays it shared object dependencies:

$ mkdir build
$ cd build
$ mingw64-cmake ..
$ mingw64-make main
$ peldd main.exe --no-wlist
ADVAPI32.dll
libboost_filesystem-mt.dll
libboost_system-mt.dll
libgcc_s_seh-1.dll
KERNEL32.dll
msvcrt.dll
libstdc++-6.dll
USER32.dll

Display the dependencies of a PE library:

$ peldd /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll --no-wlist
libgcc_s_seh-1.dll
KERNEL32.dll
msvcrt.dll
libwinpthread-1.dll
USER32.dll

Display the dependencies of a PE binary without any well-known system libraries:

$ peldd main.exe
libgcc_s_seh-1.dll
libstdc++-6.dll

Compute the transitive closure of a binary, using the default search path:

$ peldd main.exe --all
main.exe
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll

Error because on non whitelisted dll:

$ peldd ut.exe --all
Error: Could not resolve: WS2_32.dll

The same binary after extending the whitelist:

$ peldd ut.exe -a  -w WS2_32.dll 
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/iconv.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libboost_filesystem-mt.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libboost_regex-mt.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libboost_system-mt.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libxml2-2.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/zlib1.dll
ut.exe

There is also --ignore-errors for ignoring resolve errors.

Deploy a cross compiled binary:

$ peldd ut.exe -a | xargs cp -t /mnt/win/builds/

Build Instructions

To build peldd itself:

git clone https://github.com/gsauthof/pe-util.git
cd pe-util
git submodule update --init
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make VERBOSE=1

Or if ninja is available and enable debug mode (replace last 2 steps):

CXXFLAGS='-fsanitize=address -fsanitize=undefined -Og' cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja
ninja -v

License

Both the library and the program are licensed under the MIT license.

pe-util's People

Contributors

chriskitching avatar gsauthof avatar stweil avatar

Watchers

 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.