Skip to content
/ pfp Public

pfp - Python Format Parser - a python-based 010 Editor template interpreter

License

Notifications You must be signed in to change notification settings

d0c-s4vage/pfp

Repository files navigation

Master Build Status PyPI Statistics Latest Release Documentation Status Coverage Status

Twitter Follow

pfp

pfp is a python-based interpreter for 010 template scripts.

See the main documentation on Read the Docs

Contributing

See CONTRIBUTING.md

Installation

Install pfp with

pip install --upgrade pfp

Tl;DR

CLI

pfp -t path/to/template input_file

All available options for the pfp CLI:

usage: pfp [-h] -t TEMPLATE [--show-offsets] [-k] input

Run pfp on input data using a specified 010 Editor template for parsing

positional arguments:
  input                 The input data stream or file to parse. Use '-' for
                        piped data

optional arguments:
  -h, --help            show this help message and exit
  -t TEMPLATE, --template TEMPLATE
                        The template to parse with
  --show-offsets        Show offsets in the parsed data of parsed fields
  -k, --keep            Keep successfully parsed data on error

Python Library

This should get you started parsing something using 010 templates:

import pfp

dom = pfp.parse(
	data_file="~/Desktop/image.png",
	template_file="~/Desktop/PNGTemplate.bt"
)