d0c-s4vage / pfp

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"
)

About

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

License:MIT License


Languages

Language:Python 99.9%Language:Shell 0.1%