Welcome to py-fpff’s documentation!

Provides operations for working with FPFF.

class py_fpff.FPFF(file: Optional[BinaryIO] = None, author: str = '')[source]

FPFF file.

version

FPFF version number. Only accepts 1.

Type

int

timestamp

UNIX timestamp indicating time of creation.

Type

int

author

Author name.

Type

str

nsects

Number of sections in the FPFF.

Type

int

stypes

List of section types indexed by section.

Type

List[SectionType]

svalues

List of section values indexed by section.

Type

List[Any]

append(obj_type: py_fpff.SectionType, obj_data: Any)[source]

Appends section.

Parameters
  • obj_type (int) – Section type of new section.

  • obj_data (Any) – Section value of new section.

Example

>>> fpff.append(SectionType.ASCII, 'Hello, world!')
export(output_path: str)[source]

Exports FPFF sections to directory.

Parameters

output_path (str) – Path to export directory.

Example

>>> with open('./input.fpff') as f:
>>>     fpff = FPFF(f)
>>>     fpff.export('./exported')
insert(section_idx: int, obj_type: py_fpff.SectionType, obj_data: Any)[source]

Inserts section before indicated index.

Parameters
  • section_idx (int) – Section index to insert in front of.

  • obj_type (int) – Section type of new section.

  • obj_data (Any) – Section value of new section.

Raises

TypeError – Object data not valid for object type.

Example

>>> fpff.insert(0, SectionType.ASCII, 'Hello, world!')
read(file: BinaryIO)[source]

Reads in FPFF from byte stream.

Parameters

file (BinaryIO) – FPFF input byte stream.

Raises
  • ValueError – Magic did not match FPFF magic.

  • ValueError – Unsupported version. Only version 1 is supported.

  • ValueError – Section length must be greater than 0.

  • ValueError – Improper section length.

  • ValueError – Reference value is out of bounds.

  • ValueError – File contained an unsupported type.

Example

>>> with open('./input.fpff', 'rb') as f:
>>>     fpff = FPFF()
>>>     fpff.read(f)
remove(section_idx: int)[source]

Removes section at index.

Parameters

section_idx (int) – Index of section to remove.

Example

>>> fpff.remove(0)
write(file: BinaryIO)[source]

Writes FPFF to byte stream.

Parameters

file (BinaryIO) – FPFF output byte stream.

Raises
  • ValueError – Word needs to be 4 bytes.

  • ValueError – DWord needs to be 8 bytes.

Example

>>> with open('./output.fpff', 'wb') as out_f:
>>>     fpff = FPFF()
>>>     fpff.append(SectionType.ASCII, 'Hello, world!')
>>>     fpff.write(out_f)
class py_fpff.SectionType(value)[source]

Enum types for FPFF section types.

Example

>>> t = SectionType.ASCII

Indices and tables