dissect.cstruct 4.8.dev8__py3-none-any.whl → 4.8.dev9__py3-none-any.whl
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.
- dissect/cstruct/cstruct.py +29 -0
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/METADATA +1 -1
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/RECORD +10 -8
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/WHEEL +1 -1
- dissect_cstruct-4.8.dev9.dist-info/scm_file_list.json +76 -0
- dissect_cstruct-4.8.dev9.dist-info/scm_version.json +8 -0
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/entry_points.txt +0 -0
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/licenses/COPYRIGHT +0 -0
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/licenses/LICENSE +0 -0
- {dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/top_level.txt +0 -0
dissect/cstruct/cstruct.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import copy
|
|
3
4
|
import ctypes as _ctypes
|
|
4
5
|
import struct
|
|
5
6
|
import sys
|
|
@@ -25,6 +26,7 @@ from dissect.cstruct.types import (
|
|
|
25
26
|
Void,
|
|
26
27
|
Wchar,
|
|
27
28
|
)
|
|
29
|
+
from dissect.cstruct.types.base import MetaType
|
|
28
30
|
|
|
29
31
|
if TYPE_CHECKING:
|
|
30
32
|
from collections.abc import Iterable
|
|
@@ -206,6 +208,25 @@ class cstruct:
|
|
|
206
208
|
|
|
207
209
|
raise AttributeError(f"Invalid attribute: {attr}")
|
|
208
210
|
|
|
211
|
+
def __copy__(self) -> cstruct:
|
|
212
|
+
cs = cstruct(endian=self.endian, pointer=self.pointer.__name__)
|
|
213
|
+
cs._anonymous_count = self._anonymous_count
|
|
214
|
+
cs.consts = self.consts.copy()
|
|
215
|
+
cs.lookups = self.lookups.copy()
|
|
216
|
+
cs.includes = self.includes.copy()
|
|
217
|
+
|
|
218
|
+
# Update typedefs to point to the new cstruct instance
|
|
219
|
+
for name, type in self.typedefs.items():
|
|
220
|
+
if name in cs.typedefs:
|
|
221
|
+
continue
|
|
222
|
+
|
|
223
|
+
if isinstance(type, MetaType):
|
|
224
|
+
new_type = copy.copy(type)
|
|
225
|
+
new_type.cs = cs
|
|
226
|
+
cs.typedefs[name] = new_type
|
|
227
|
+
|
|
228
|
+
return cs
|
|
229
|
+
|
|
209
230
|
def _next_anonymous(self) -> str:
|
|
210
231
|
name = f"__anonymous_{self._anonymous_count}__"
|
|
211
232
|
self._anonymous_count += 1
|
|
@@ -328,6 +349,14 @@ class cstruct:
|
|
|
328
349
|
|
|
329
350
|
raise ResolveError(f"Recursion limit exceeded while resolving type {name}")
|
|
330
351
|
|
|
352
|
+
def copy(self) -> cstruct:
|
|
353
|
+
"""Create a copy of this cstruct instance.
|
|
354
|
+
|
|
355
|
+
Returns:
|
|
356
|
+
A new cstruct instance with the same types and settings as this one.
|
|
357
|
+
"""
|
|
358
|
+
return copy.copy(self)
|
|
359
|
+
|
|
331
360
|
def _make_type(
|
|
332
361
|
self,
|
|
333
362
|
name: str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 4.8.
|
|
3
|
+
Version: 4.8.dev9
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
dissect/cstruct/__init__.py,sha256=Z47dU_PpbZyc2ZSyu-ww-ncX6igaTw0ItVHzVgiaiKI,1380
|
|
2
2
|
dissect/cstruct/bitbuffer.py,sha256=bid_N4ZsaTeC3x5Fzs8viUrldT863dMPtEDih20Nt6k,2644
|
|
3
3
|
dissect/cstruct/compiler.py,sha256=uOjteLdoUIVNSX71TsBAusW8U085RRH9dXkbK3dp1vY,14203
|
|
4
|
-
dissect/cstruct/cstruct.py,sha256
|
|
4
|
+
dissect/cstruct/cstruct.py,sha256=-qTwlvlhFME2WKlweJ8RfIOnxyevoF64N0fuE4okvzM,20409
|
|
5
5
|
dissect/cstruct/exceptions.py,sha256=SX05-_HqQn8lYC7SBHv5OrYEepYRMNmRiIzVPW8bvMQ,330
|
|
6
6
|
dissect/cstruct/expression.py,sha256=mf5GFGLAn_2Tz3QK86Yqoi317l8cjMcffBKzP2STE6M,10841
|
|
7
7
|
dissect/cstruct/parser.py,sha256=Mk8QbkDov_xfauZnp2MqUmFGOPZlp7O2rSLYbB9S3g4,24550
|
|
@@ -20,10 +20,12 @@ dissect/cstruct/types/pointer.py,sha256=PqeJOoNBUfMd5uO2kpF6OHeW7Q6R1N1W1V4q1Mak
|
|
|
20
20
|
dissect/cstruct/types/structure.py,sha256=I9LVeZ81rNE5GDT6wxpUL-PqMO31Ae6TVLLzTGyd6mM,33012
|
|
21
21
|
dissect/cstruct/types/void.py,sha256=Gvh0HqI6jQSj2uesdo3J8-G41brWCz8pmP16l8xTBxE,1074
|
|
22
22
|
dissect/cstruct/types/wchar.py,sha256=N9Y_XX2_hZEe2DwepJjxsB6xuRJ6zINRalcUofR59kY,2608
|
|
23
|
-
dissect_cstruct-4.8.
|
|
24
|
-
dissect_cstruct-4.8.
|
|
25
|
-
dissect_cstruct-4.8.
|
|
26
|
-
dissect_cstruct-4.8.
|
|
27
|
-
dissect_cstruct-4.8.
|
|
28
|
-
dissect_cstruct-4.8.
|
|
29
|
-
dissect_cstruct-4.8.
|
|
23
|
+
dissect_cstruct-4.8.dev9.dist-info/licenses/COPYRIGHT,sha256=H-18RXfshdH9AdHwW2eO1Xa-5s6tY5eipHh5c0whDu4,316
|
|
24
|
+
dissect_cstruct-4.8.dev9.dist-info/licenses/LICENSE,sha256=PhUqiw6jAh2KbBdVRPBq_hfAvfcTBin7nZ3CK7NQbTM,11341
|
|
25
|
+
dissect_cstruct-4.8.dev9.dist-info/METADATA,sha256=fJPIx_vU4eO86goKEZQiuzMkhAXnMz74hkZPo2SCFTA,9255
|
|
26
|
+
dissect_cstruct-4.8.dev9.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
27
|
+
dissect_cstruct-4.8.dev9.dist-info/entry_points.txt,sha256=z53zqZqwD2OLrAkRwrP4wTeiU9CQe7xrMly0T2c0_wQ,71
|
|
28
|
+
dissect_cstruct-4.8.dev9.dist-info/scm_file_list.json,sha256=7uE9QF1ctA5UjFpM9_OWmXeCn_A_osGyUh-6w4MJV_A,2249
|
|
29
|
+
dissect_cstruct-4.8.dev9.dist-info/scm_version.json,sha256=h58edttPGk9dM9JAByXJVawy7O8spyqIVLgUpKibp5c,157
|
|
30
|
+
dissect_cstruct-4.8.dev9.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
|
31
|
+
dissect_cstruct-4.8.dev9.dist-info/RECORD,,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
"README.md",
|
|
4
|
+
"tox.ini",
|
|
5
|
+
"LICENSE",
|
|
6
|
+
"pyproject.toml",
|
|
7
|
+
"COPYRIGHT",
|
|
8
|
+
"CHANGELOG.md",
|
|
9
|
+
".git-blame-ignore-revs",
|
|
10
|
+
".gitattributes",
|
|
11
|
+
"MANIFEST.in",
|
|
12
|
+
".gitignore",
|
|
13
|
+
"dissect/cstruct/cstruct.py",
|
|
14
|
+
"dissect/cstruct/__init__.py",
|
|
15
|
+
"dissect/cstruct/exceptions.py",
|
|
16
|
+
"dissect/cstruct/compiler.py",
|
|
17
|
+
"dissect/cstruct/expression.py",
|
|
18
|
+
"dissect/cstruct/utils.py",
|
|
19
|
+
"dissect/cstruct/parser.py",
|
|
20
|
+
"dissect/cstruct/bitbuffer.py",
|
|
21
|
+
"dissect/cstruct/types/int.py",
|
|
22
|
+
"dissect/cstruct/types/__init__.py",
|
|
23
|
+
"dissect/cstruct/types/leb128.py",
|
|
24
|
+
"dissect/cstruct/types/flag.py",
|
|
25
|
+
"dissect/cstruct/types/void.py",
|
|
26
|
+
"dissect/cstruct/types/char.py",
|
|
27
|
+
"dissect/cstruct/types/pointer.py",
|
|
28
|
+
"dissect/cstruct/types/structure.py",
|
|
29
|
+
"dissect/cstruct/types/enum.py",
|
|
30
|
+
"dissect/cstruct/types/base.py",
|
|
31
|
+
"dissect/cstruct/types/wchar.py",
|
|
32
|
+
"dissect/cstruct/types/packed.py",
|
|
33
|
+
"dissect/cstruct/tools/__init__.py",
|
|
34
|
+
"dissect/cstruct/tools/stubgen.py",
|
|
35
|
+
"tests/test_types_char.py",
|
|
36
|
+
"tests/test_ctypes.py",
|
|
37
|
+
"tests/test_types_custom.py",
|
|
38
|
+
"tests/__init__.py",
|
|
39
|
+
"tests/test_types_leb128.py",
|
|
40
|
+
"tests/test_types_union.py",
|
|
41
|
+
"tests/test_tools_stubgen.py",
|
|
42
|
+
"tests/test_basic.py",
|
|
43
|
+
"tests/test_types_int.py",
|
|
44
|
+
"tests/test_expression.py",
|
|
45
|
+
"tests/utils.py",
|
|
46
|
+
"tests/test_align.py",
|
|
47
|
+
"tests/test_utils.py",
|
|
48
|
+
"tests/test_compiler.py",
|
|
49
|
+
"tests/test_types_enum.py",
|
|
50
|
+
"tests/test_types_wchar.py",
|
|
51
|
+
"tests/test_bitfield.py",
|
|
52
|
+
"tests/test_types_structure.py",
|
|
53
|
+
"tests/test_parser.py",
|
|
54
|
+
"tests/test_annotations.py",
|
|
55
|
+
"tests/conftest.py",
|
|
56
|
+
"tests/test_types_void.py",
|
|
57
|
+
"tests/test_types_flag.py",
|
|
58
|
+
"tests/test_benchmark.py",
|
|
59
|
+
"tests/test_types_pointer.py",
|
|
60
|
+
"tests/test_types_packed.py",
|
|
61
|
+
"tests/test_types_base.py",
|
|
62
|
+
"tests/test_bitbuffer.py",
|
|
63
|
+
"tests/_data/testdef.txt",
|
|
64
|
+
"tests/_docs/__init__.py",
|
|
65
|
+
"tests/_docs/Makefile",
|
|
66
|
+
"tests/_docs/index.rst",
|
|
67
|
+
"tests/_docs/conf.py",
|
|
68
|
+
"examples/secdesc.py",
|
|
69
|
+
"examples/disk.py",
|
|
70
|
+
"examples/pe.py",
|
|
71
|
+
"examples/mirai.py",
|
|
72
|
+
"examples/protobuf.py",
|
|
73
|
+
".github/pull_request_template.md",
|
|
74
|
+
".github/workflows/dissect-ci.yml"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
File without changes
|
{dissect_cstruct-4.8.dev8.dist-info → dissect_cstruct-4.8.dev9.dist-info}/licenses/COPYRIGHT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|