dissect.cstruct 4.8.dev3__tar.gz → 4.8.dev4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/PKG-INFO +21 -1
  2. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/README.md +20 -0
  3. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/PKG-INFO +21 -1
  4. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/.git-blame-ignore-revs +0 -0
  5. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/.gitattributes +0 -0
  6. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/CHANGELOG.md +0 -0
  7. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/COPYRIGHT +0 -0
  8. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/LICENSE +0 -0
  9. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/MANIFEST.in +0 -0
  10. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/__init__.py +0 -0
  11. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/bitbuffer.py +0 -0
  12. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/compiler.py +0 -0
  13. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/cstruct.py +0 -0
  14. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/exceptions.py +0 -0
  15. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/expression.py +0 -0
  16. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/parser.py +0 -0
  17. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/tools/__init__.py +0 -0
  18. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/tools/stubgen.py +0 -0
  19. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/__init__.py +0 -0
  20. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/base.py +0 -0
  21. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/char.py +0 -0
  22. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/enum.py +0 -0
  23. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/flag.py +0 -0
  24. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/int.py +0 -0
  25. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/leb128.py +0 -0
  26. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/packed.py +0 -0
  27. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/pointer.py +0 -0
  28. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/structure.py +0 -0
  29. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/void.py +0 -0
  30. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/types/wchar.py +0 -0
  31. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect/cstruct/utils.py +0 -0
  32. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/SOURCES.txt +0 -0
  33. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/dependency_links.txt +0 -0
  34. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/entry_points.txt +0 -0
  35. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/requires.txt +0 -0
  36. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/dissect.cstruct.egg-info/top_level.txt +0 -0
  37. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/examples/disk.py +0 -0
  38. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/examples/mirai.py +0 -0
  39. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/examples/pe.py +0 -0
  40. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/examples/protobuf.py +0 -0
  41. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/examples/secdesc.py +0 -0
  42. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/pyproject.toml +0 -0
  43. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/setup.cfg +0 -0
  44. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/__init__.py +0 -0
  45. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/_data/testdef.txt +0 -0
  46. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/_docs/Makefile +0 -0
  47. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/_docs/__init__.py +0 -0
  48. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/_docs/conf.py +0 -0
  49. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/_docs/index.rst +0 -0
  50. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/conftest.py +0 -0
  51. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_align.py +0 -0
  52. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_annotations.py +0 -0
  53. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_basic.py +0 -0
  54. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_benchmark.py +0 -0
  55. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_bitbuffer.py +0 -0
  56. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_bitfield.py +0 -0
  57. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_compiler.py +0 -0
  58. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_ctypes.py +0 -0
  59. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_expression.py +0 -0
  60. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_parser.py +0 -0
  61. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_tools_stubgen.py +0 -0
  62. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_base.py +0 -0
  63. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_char.py +0 -0
  64. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_custom.py +0 -0
  65. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_enum.py +0 -0
  66. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_flag.py +0 -0
  67. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_int.py +0 -0
  68. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_leb128.py +0 -0
  69. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_packed.py +0 -0
  70. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_pointer.py +0 -0
  71. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_structure.py +0 -0
  72. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_union.py +0 -0
  73. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_void.py +0 -0
  74. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_types_wchar.py +0 -0
  75. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/test_utils.py +0 -0
  76. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tests/utils.py +0 -0
  77. {dissect_cstruct-4.8.dev3 → dissect_cstruct-4.8.dev4}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 4.8.dev3
3
+ Version: 4.8.dev4
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -238,6 +238,26 @@ The API to access enum and flag members and their values in the same way as the
238
238
  ### Custom types
239
239
  You can implement your own types by subclassing `BaseType`, and adding them to your cstruct instance with `add_custom_type(name, type, size, alignment, ...)`
240
240
 
241
+ ### Dynamic length fields
242
+ To read all remaining data in the provided buffer/stream, you can use the magic `EOF` size variable. This will automatically expand until the end of the stream has been reached and works for any field type. For example:
243
+
244
+ ```python
245
+ from dissect.cstruct import cstruct
246
+
247
+ eof_def = """
248
+ struct example {
249
+ uint32 magic;
250
+ char data[EOF];
251
+ };
252
+ """
253
+
254
+ c_eof = cstruct().load(eof_def)
255
+
256
+ example = c_eof.example(b"9\x05\x00\x00arbitrary length data")
257
+ assert example.magic == 1337
258
+ assert example.data == b"arbitrary length data"
259
+ ```
260
+
241
261
  ### Custom definition parsers
242
262
  Don't like the C-like definition syntax? Write your own syntax parser!
243
263
 
@@ -210,6 +210,26 @@ The API to access enum and flag members and their values in the same way as the
210
210
  ### Custom types
211
211
  You can implement your own types by subclassing `BaseType`, and adding them to your cstruct instance with `add_custom_type(name, type, size, alignment, ...)`
212
212
 
213
+ ### Dynamic length fields
214
+ To read all remaining data in the provided buffer/stream, you can use the magic `EOF` size variable. This will automatically expand until the end of the stream has been reached and works for any field type. For example:
215
+
216
+ ```python
217
+ from dissect.cstruct import cstruct
218
+
219
+ eof_def = """
220
+ struct example {
221
+ uint32 magic;
222
+ char data[EOF];
223
+ };
224
+ """
225
+
226
+ c_eof = cstruct().load(eof_def)
227
+
228
+ example = c_eof.example(b"9\x05\x00\x00arbitrary length data")
229
+ assert example.magic == 1337
230
+ assert example.data == b"arbitrary length data"
231
+ ```
232
+
213
233
  ### Custom definition parsers
214
234
  Don't like the C-like definition syntax? Write your own syntax parser!
215
235
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 4.8.dev3
3
+ Version: 4.8.dev4
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -238,6 +238,26 @@ The API to access enum and flag members and their values in the same way as the
238
238
  ### Custom types
239
239
  You can implement your own types by subclassing `BaseType`, and adding them to your cstruct instance with `add_custom_type(name, type, size, alignment, ...)`
240
240
 
241
+ ### Dynamic length fields
242
+ To read all remaining data in the provided buffer/stream, you can use the magic `EOF` size variable. This will automatically expand until the end of the stream has been reached and works for any field type. For example:
243
+
244
+ ```python
245
+ from dissect.cstruct import cstruct
246
+
247
+ eof_def = """
248
+ struct example {
249
+ uint32 magic;
250
+ char data[EOF];
251
+ };
252
+ """
253
+
254
+ c_eof = cstruct().load(eof_def)
255
+
256
+ example = c_eof.example(b"9\x05\x00\x00arbitrary length data")
257
+ assert example.magic == 1337
258
+ assert example.data == b"arbitrary length data"
259
+ ```
260
+
241
261
  ### Custom definition parsers
242
262
  Don't like the C-like definition syntax? Write your own syntax parser!
243
263