Giter Site home page Giter Site logo

crackercat / libpe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from merces/libpe

0.0 0.0 0.0 577 KB

The PE library used by @merces/pev

Home Page: http://pev.sf.net

License: GNU Lesser General Public License v3.0

Makefile 4.02% C 95.44% Objective-C 0.54%

libpe's Introduction

libpe

LGPLv3 C/C++ CI

The PE library used by pev - the PE file toolkit purely written in C and available to many platforms.

Features

  • Support for both 32 and 64-bits PE files.
  • ssdeep support (built-in libfuzzy).
  • Disassemble support (built-in libudis86).
  • Imphash support.
  • Crypographic digests calculation (using OpeenSSL).

How to get the source code

git clone https://github.com/merces/libpe.git

How to build on Linux

cd libpe
make

NOTE: You may need to install OpenSSL using your package manager. Examples:

apt install libssl-dev
yum install openssl-devel

How to build on macOS

cd libpe
CFLAGS="-I/usr/local/opt/openssl/include/" LDFLAGS="-L/usr/local/opt/openssl/lib/" make

NOTE: You may need to install OpenSSL and PCRE via Homebrew:

brew update
brew install openssl

Usage example

#include <stdio.h>
#include "../include/libpe/pe.h"

int main(int argc, char *argv[]) {

    if (argc < 2)
        return 1;

    pe_ctx_t ctx;
    pe_err_e err = pe_load_file(&ctx, argv[1]);

    if (err != LIBPE_E_OK) {
        pe_error_print(stderr, err);
        return 1;
    }

    err = pe_parse(&ctx);
    if (err != LIBPE_E_OK) {
        pe_error_print(stderr, err);
        return 1;
    }

    if (!pe_is_pe(&ctx))
        return 1;

    printf("Entrypoint: %#llx\n", ctx.pe.entrypoint);

    return 0;
}

Compile with:

cc -o example example.c -lpe

Troubleshooting

  • Error while loading shared libraries: libpe.so.1

    • The prefix used in libpe's makefile is /usr/local/lib
    • If your system isn't set to look here, you can add it to ld.so.conf
    • Alternatively, change prefix to whatever suits, ie. /usr/lib
  • Undefined reference to log

    • Linux' glibc does not define math functions, they live instead in libm
    • Link against both libpe and libm to fix this (ie. -lm)

libpe's People

Contributors

chkhalt avatar claudiobizzotto avatar felipensp avatar fgarcia0x0 avatar fredericopissarra avatar g5pw avatar jweyrich avatar jwilk avatar khorben avatar merces avatar sgn avatar xxami 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.