GithubHelp home page GithubHelp logo

protod3's Introduction

Protod3

This is a fork of sysdream/Protod. Credits to the creators of Protod.

This code has successfully been used to extract .proto files from a binary that used the proto2 syntax.

However, it is untested on proto3.

Protod - Protobuf's metadata extractor

(c) 2012, Sysdream ([email protected])

Changes:

  • Adapted to Python 3.10

  • Code has been refactored to (hopefully) make it easier to understand

  • New functionality that improves execution time, in my case by ~50x

    • NEW: Specify pattern to search for (instead of b'.proto', you might choose b'.proto\x12'. In my case, this avoided many "false positives")
    • NEW: Ignore certain filenames by passing a filename predicate to the ProtobufExtractor. For instance:
    def filename_predicate(filename: str):
        return "google/protobuf" not in filename
    
        [...]
        extractor = ProtobufExtractor(sys.argv[1], filename_predicate=filename_predicate)
        extractor.extract(byte_pattern=b".proto\x12")

Usage

To extract every .proto file from a given executable:

python src/protod.py somebinary

Configuration

  • To change what filenames are included, modify the filename_predicate function in src/protod3.py.
  • To change the byte_pattern (most permissive to catch all proto files: b'.proto'), edit the byte_pattern parameter that is passed to ProtobufExtractor::extract. b'.proto\x12' worked well for my use case.

What is Protod ?

Protod is a tool able to extract Google's protobuf metadata from any binary file. This version has been designed to cover every file format.

The goal of this tool is to recover serialized protobuf's metadata inserted at compilation time inside an executable, and to make it available as .proto file, ready to compile with protoc (protobuf's compiler).

For further information on Google's protobuf library, please see:

https://developers.google.com/protocol-buffers/docs/overview

protod3's People

Contributors

virtualabs avatar giuinktse7 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.