vstruct2 ( Mark II )
===================
Vivisect Structure Definition/Parsing Library
|Build Status|
Installing
==========
.. code::
python3.4 -m pip install vstruct2
vstruct2 can now be installed via pip!
Additionally, a repository of existing structure definitions
is available as a seperate package named fracture.
Examples
========
Basic Parsing
-------------
Simple vstruct2 byte parsing:
.. code:: python
from vstruct2.types import *
class Foo(VStruct):
def __init__(self):
VStruct.__init__(self)
self.bar = uint32()
self.baz = vbytes(20)
foo = Foo()
# read in byts from somewhere...
foo.vsParse(byts)
# access struct fields by name
if foo.bar == 30:
print('bar == 30!')
# assign fields by name
foo.bar = 90
# emit modified bytes back out
byts = bytes(foo) # same as foo.vsEmit()
Parser Callbacks
----------------
WriteBack Bytes/Files
---------------------
vstruct2 supports "writeback" functionality for both files and mutable
bytearray types, allowing field assignments to change the underlying file
or bytearray immediately.
.. code:: python
class Foo(VStruct):
def __init__(self):
VStruct.__init__(self)
self.bar = uint32()
self.baz = uint32()
foo = Foo()
# ba is a bytearray
foo.vsParse(ba, writeback=True)
# if bar is 30, set baz to 99
if foo.bar == 30:
foo.baz = 99
# ba bytearray has now been modified
Enum Types
----------
.. |Build Status| image:: https://travis-ci.org/vivisect/vstruct2.svg
:target: https://travis-ci.org/vivisect/vstruct2
===================
Vivisect Structure Definition/Parsing Library
|Build Status|
Installing
==========
.. code::
python3.4 -m pip install vstruct2
vstruct2 can now be installed via pip!
Additionally, a repository of existing structure definitions
is available as a seperate package named fracture.
Examples
========
Basic Parsing
-------------
Simple vstruct2 byte parsing:
.. code:: python
from vstruct2.types import *
class Foo(VStruct):
def __init__(self):
VStruct.__init__(self)
self.bar = uint32()
self.baz = vbytes(20)
foo = Foo()
# read in byts from somewhere...
foo.vsParse(byts)
# access struct fields by name
if foo.bar == 30:
print('bar == 30!')
# assign fields by name
foo.bar = 90
# emit modified bytes back out
byts = bytes(foo) # same as foo.vsEmit()
Parser Callbacks
----------------
WriteBack Bytes/Files
---------------------
vstruct2 supports "writeback" functionality for both files and mutable
bytearray types, allowing field assignments to change the underlying file
or bytearray immediately.
.. code:: python
class Foo(VStruct):
def __init__(self):
VStruct.__init__(self)
self.bar = uint32()
self.baz = uint32()
foo = Foo()
# ba is a bytearray
foo.vsParse(ba, writeback=True)
# if bar is 30, set baz to 99
if foo.bar == 30:
foo.baz = 99
# ba bytearray has now been modified
Enum Types
----------
.. |Build Status| image:: https://travis-ci.org/vivisect/vstruct2.svg
:target: https://travis-ci.org/vivisect/vstruct2
Release files for vstruct2 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vstruct2-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
| vstruct2-2.0.2-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 19.1 kB
Release files / vstruct2-2.0.2-py3-none-any.whl
| Download URL | vstruct2-2.0.2-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8045ca13eda143177a883e1b62100782356d30e70085e5527e3062d28cb08096
|
|
BLAKE2b-256 checksum How to use checksums |
7935b9bced7b73f2e8992e8d07f622353c45e981d32b9b10d18449b471fe27df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / vstruct2-2.0.2-py2-none-any.whl
| Download URL | vstruct2-2.0.2-py2-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
420ae2f24f151f0a6f5d4e1de1d0e5b2f36a65a264dcae12b4f91d19c9abe33d
|
|
BLAKE2b-256 checksum How to use checksums |
72cfbb858f783dcbe7d3efeed409fa8ad4828a553853fc9af79f3794d1298b1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |