Skip to content

About

A library for parsing the Rust fmt::Arguments format string encoding representation, present in Rust binaries produced after Rust 1.93.0.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Rust Format String Parser

A library for parsing the Rust fmt::Arguments format string encoding representation, present in Rust binaries produced after Rust 1.93.0.

See rust-lang/rust: New format_args!() and fmt::Arguments implementation - #148789 for more details on this representation.

This library is a work in progress. For now, a basic CLI tool is provided in cli/cli.py.

Install with:

$ python -m pip install -e .[cli]

Usage:

$ python cli/cli.py --help
Usage: cli.py [OPTIONS] HEX_BYTES

Positional arguments:
  HEX_BYTES  Hex-encoded bytes to parse

Options:
  --help  Show this message and exit.
$ python cli/cli.py 246164645f7061727361626c655f6365727469666963617465732070726f63657373656420c00b2076616c696420616e6420c00e20696e76616c696420636572747300
ListContainer: 
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.StringLiteral
            literal_data = Container: 
                len = 36
                bytes = b'add_parsable_certificates processed ' (total 36)
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.Placeholder
            field_flags = Container: 
                placeholder_signature = 3
                precision_indirect = False
                width_indirect = False
                arg_index_present = False
                precision_present = False
                width_present = False
                flags_present = False
            flags = None
            width = None
            precision = None
            arg_index = 0
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.StringLiteral
            literal_data = Container: 
                len = 11
                bytes = b' valid and ' (total 11)
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.Placeholder
            field_flags = Container: 
                placeholder_signature = 3
                precision_indirect = False
                width_indirect = False
                arg_index_present = False
                precision_present = False
                width_present = False
                flags_present = False
            flags = None
            width = None
            precision = None
            arg_index = 1
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.StringLiteral
            literal_data = Container: 
                len = 14
                bytes = b' invalid certs' (total 14)
    Container: 
        template_piece = Container: 
            template_piece_type = TemplatePieceType.EndIndicator

About

A library for parsing the Rust fmt::Arguments format string encoding representation, present in Rust binaries produced after Rust 1.93.0.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages