protod

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 11 Imported by: 0

README

protod

Sometimes it is necessary to recover .proto files from binaries or memory dumps.

protod does exactly this - it finds protobuf descriptors in any binary files and writes them back as .proto text files.

Supports:

  • proto2 and proto3
  • messages, enums, services
  • Extraction from uncompressed file descriptors (used in C/C++, maybe others)

Not supported yet:

  • Field or file options
  • Oneof fields
  • Extensions
  • Compressed file descriptors (used in Go)
  • Recovery without file descriptors

Installation

Go 1.12+ is required.

go get -u github.com/dennwc/protod
go install github.com/dennwc/protod/cmd/protod 

Usage

protod --out=./out some_binary

The tool will emit recovered .proto files to ./out directory.

License

MIT (based on protod Python script by Sysdream)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(r io.Reader, fnc ExtractFunc) error

Extract reads data from r and calls a function for each occurrence of protobuf file descriptors.

func ExtractBytes

func ExtractBytes(data []byte, fnc ExtractFunc) error

ExtractBytes calls a function for each occurrence of protobuf file descriptors in a bytes slice.

func Render

func Render(w io.Writer, fd *FileDescriptorProto) error

Render writes a .proto file based on a FileDescriptorProto.

Types

type ExtractFunc

type ExtractFunc func(data []byte, fd *FileDescriptorProto) error

ExtractFunc is a callback for Extract functions. The first argument is an encoded proto file descriptor, and the second one is a decoded file descriptor.

type FileDescriptorProto

type FileDescriptorProto = descriptor.FileDescriptorProto

FileDescriptorProto is an alias for protobuf's FileDescriptorProto.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL