https://github.com/rsc-dev/pbd
Pbd is a Python module to disassemble serialized protocol buffers descriptors (https://developers.google.com/protocol-buffers/).
https://github.com/rsc-dev/pbd
disassembler protocol-buffers protocol-buffers-disassembler python reverse-engineering security
Last synced: 5 months ago
JSON representation
Pbd is a Python module to disassemble serialized protocol buffers descriptors (https://developers.google.com/protocol-buffers/).
- Host: GitHub
- URL: https://github.com/rsc-dev/pbd
- Owner: rsc-dev
- License: mit
- Created: 2016-01-20T09:27:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-01-12T17:32:38.000Z (almost 5 years ago)
- Last Synced: 2025-07-02T23:57:03.192Z (6 months ago)
- Topics: disassembler, protocol-buffers, protocol-buffers-disassembler, python, reverse-engineering, security
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 86
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Pbd - Protocol Buffers Disassembler
[](https://pypi.python.org/pypi/pbd)
[](https://gitter.im/rsc-dev/pbd?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## About
Pbd is a Python module to disassemble serialized protocol buffers descriptors (https://developers.google.com/protocol-buffers/).
Example:
```sh
>python -m pbd -f examples\test.ser
_|_|_| _| _|
_| _| _|_|_| _|_|_|
_|_|_| _| _| _| _|
_| _| _| _| _|
_| _|_|_| _|_|_|
ver 0.9
[+] Paring file test.ser
[+] Proto file saved as .\test.proto
>type test.proto
// Reversed by pbd (https://github.com/rsc-dev/pbd)
// Package not defined
message Person {
required string name = 1 ;
required int32 id = 2 ;
optional string email = 3 ;
}
```
## Installation
```sh
pip install pbd
```
or
```sh
python setup.py install
```
## Usage
### API
```python
import pbd
input_file_name = 'test.protoc'
proto = Pbd(input_file_name)
proto.disassemble()
proto.dump()
```
For multiple files with imports:
```python
import os
import pbd
input_dir = 'input\\' # Input directory with serialized descriptors
output_dir = 'output\\' # Output direcotry for proto files
input_files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
proto = []
for f in files:
p = Pbd(f)
p.disassemble()
proto.append(p)
for p in proto:
p.find_imports(proto)
p.dump(output_dir)
```
### Standalone module
Check help for available options:
```sh
python -m pbd -h
```
Disasm single file.
```sh
python -m pbd -f test.ser
```
Disasm all files in given directory and fix imports.
```sh
python -m pbd -i input_dir\ -o output_dir\
```
## License
Code is released under [MIT license](https://github.com/rsc-dev/loophole/blob/master/LICENSE.md) © [Radoslaw '[rsc]' Matusiak](https://rm2084.blogspot.com/).