dissect.cstruct 4.8.dev4__py3-none-any.whl → 4.8.dev5__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/__init__.py +2 -0
- dissect/cstruct/compiler.py +3 -1
- dissect/cstruct/cstruct.py +5 -2
- dissect/cstruct/exceptions.py +3 -0
- dissect/cstruct/expression.py +0 -1
- dissect/cstruct/parser.py +6 -5
- dissect/cstruct/types/__init__.py +2 -0
- dissect/cstruct/types/enum.py +2 -1
- dissect/cstruct/types/structure.py +3 -3
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/METADATA +1 -1
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/RECORD +16 -16
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/WHEEL +0 -0
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/entry_points.txt +0 -0
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/licenses/COPYRIGHT +0 -0
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/licenses/LICENSE +0 -0
- {dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/top_level.txt +0 -0
dissect/cstruct/__init__.py
CHANGED
dissect/cstruct/compiler.py
CHANGED
|
@@ -11,7 +11,6 @@ from typing import TYPE_CHECKING
|
|
|
11
11
|
from dissect.cstruct.bitbuffer import BitBuffer
|
|
12
12
|
from dissect.cstruct.types import (
|
|
13
13
|
Array,
|
|
14
|
-
BaseType,
|
|
15
14
|
Char,
|
|
16
15
|
CharArray,
|
|
17
16
|
Flag,
|
|
@@ -34,6 +33,9 @@ if TYPE_CHECKING:
|
|
|
34
33
|
from types import MethodType
|
|
35
34
|
|
|
36
35
|
from dissect.cstruct.cstruct import cstruct
|
|
36
|
+
from dissect.cstruct.types import (
|
|
37
|
+
BaseType,
|
|
38
|
+
)
|
|
37
39
|
from dissect.cstruct.types.structure import Field
|
|
38
40
|
|
|
39
41
|
SUPPORTED_TYPES = (
|
dissect/cstruct/cstruct.py
CHANGED
|
@@ -12,12 +12,10 @@ from dissect.cstruct.expression import Expression
|
|
|
12
12
|
from dissect.cstruct.parser import CStyleParser, TokenParser
|
|
13
13
|
from dissect.cstruct.types import (
|
|
14
14
|
LEB128,
|
|
15
|
-
Array,
|
|
16
15
|
BaseArray,
|
|
17
16
|
BaseType,
|
|
18
17
|
Char,
|
|
19
18
|
Enum,
|
|
20
|
-
Field,
|
|
21
19
|
Flag,
|
|
22
20
|
Int,
|
|
23
21
|
Packed,
|
|
@@ -32,6 +30,11 @@ if TYPE_CHECKING:
|
|
|
32
30
|
from collections.abc import Iterable
|
|
33
31
|
from typing import TypeAlias
|
|
34
32
|
|
|
33
|
+
from dissect.cstruct.types import (
|
|
34
|
+
Array,
|
|
35
|
+
Field,
|
|
36
|
+
)
|
|
37
|
+
|
|
35
38
|
|
|
36
39
|
T = TypeVar("T", bound=BaseType)
|
|
37
40
|
|
dissect/cstruct/exceptions.py
CHANGED
dissect/cstruct/expression.py
CHANGED
|
@@ -225,7 +225,6 @@ class Expression:
|
|
|
225
225
|
|
|
226
226
|
def evaluate(self, cs: cstruct, context: dict[str, int] | None = None) -> int:
|
|
227
227
|
"""Evaluates an expression using a Shunting-Yard implementation."""
|
|
228
|
-
|
|
229
228
|
self.stack = []
|
|
230
229
|
self.queue = []
|
|
231
230
|
operators = set(self.binary_operators.keys()) | set(self.unary_operators.keys())
|
dissect/cstruct/parser.py
CHANGED
|
@@ -11,10 +11,11 @@ from dissect.cstruct.exceptions import (
|
|
|
11
11
|
ParserError,
|
|
12
12
|
)
|
|
13
13
|
from dissect.cstruct.expression import Expression
|
|
14
|
-
from dissect.cstruct.types import BaseArray,
|
|
14
|
+
from dissect.cstruct.types import BaseArray, Field, Structure
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
17
|
from dissect.cstruct import cstruct
|
|
18
|
+
from dissect.cstruct.types import BaseType
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class Parser:
|
|
@@ -37,7 +38,8 @@ class Parser:
|
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
class TokenParser(Parser):
|
|
40
|
-
"""
|
|
41
|
+
"""Definition parser for C-like structure syntax.
|
|
42
|
+
|
|
41
43
|
Args:
|
|
42
44
|
cs: An instance of cstruct.
|
|
43
45
|
compiled: Whether structs should be compiled or not.
|
|
@@ -421,8 +423,7 @@ class TokenParser(Parser):
|
|
|
421
423
|
|
|
422
424
|
@staticmethod
|
|
423
425
|
def _lineno(tok: Token) -> int:
|
|
424
|
-
"""Quick and dirty line number calculator"""
|
|
425
|
-
|
|
426
|
+
"""Quick and dirty line number calculator."""
|
|
426
427
|
match = tok.match
|
|
427
428
|
return match.string.count("\n", 0, match.start()) + 1
|
|
428
429
|
|
|
@@ -474,7 +475,7 @@ class TokenParser(Parser):
|
|
|
474
475
|
|
|
475
476
|
|
|
476
477
|
class CStyleParser(Parser):
|
|
477
|
-
"""Definition parser for C-like structure syntax.
|
|
478
|
+
"""Definition parser for C-like structure syntax (legacy parser).
|
|
478
479
|
|
|
479
480
|
Args:
|
|
480
481
|
cs: An instance of cstruct
|
dissect/cstruct/types/enum.py
CHANGED
|
@@ -5,12 +5,13 @@ from enum import Enum as _Enum
|
|
|
5
5
|
from enum import EnumMeta, IntEnum, IntFlag
|
|
6
6
|
from typing import TYPE_CHECKING, Any, BinaryIO, TypeVar, overload
|
|
7
7
|
|
|
8
|
-
from dissect.cstruct.types.base import
|
|
8
|
+
from dissect.cstruct.types.base import BaseType, MetaType
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
13
13
|
from dissect.cstruct.cstruct import cstruct
|
|
14
|
+
from dissect.cstruct.types.base import Array
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
PY_311 = sys.version_info >= (3, 11, 0)
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import io
|
|
4
4
|
from collections import ChainMap
|
|
5
|
-
from collections.abc import
|
|
5
|
+
from collections.abc import MutableMapping
|
|
6
6
|
from contextlib import contextmanager
|
|
7
7
|
from enum import Enum
|
|
8
8
|
from functools import lru_cache
|
|
@@ -23,7 +23,7 @@ from dissect.cstruct.types.enum import EnumMetaType
|
|
|
23
23
|
from dissect.cstruct.types.pointer import Pointer
|
|
24
24
|
|
|
25
25
|
if TYPE_CHECKING:
|
|
26
|
-
from collections.abc import Iterator, Mapping
|
|
26
|
+
from collections.abc import Callable, Iterator, Mapping
|
|
27
27
|
from types import FunctionType
|
|
28
28
|
|
|
29
29
|
from typing_extensions import Self
|
|
@@ -139,7 +139,7 @@ class StructureMetaType(MetaType):
|
|
|
139
139
|
|
|
140
140
|
if cls.__compiled__:
|
|
141
141
|
# If the previous class was compiled try to compile this too
|
|
142
|
-
from dissect.cstruct import compiler
|
|
142
|
+
from dissect.cstruct import compiler
|
|
143
143
|
|
|
144
144
|
try:
|
|
145
145
|
classdict["_read"] = compiler.Compiler(cls.cs).compile_read(fields, cls.__name__, align=cls.__align__)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 4.8.
|
|
3
|
+
Version: 4.8.dev5
|
|
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,29 +1,29 @@
|
|
|
1
|
-
dissect/cstruct/__init__.py,sha256=
|
|
1
|
+
dissect/cstruct/__init__.py,sha256=Z47dU_PpbZyc2ZSyu-ww-ncX6igaTw0ItVHzVgiaiKI,1380
|
|
2
2
|
dissect/cstruct/bitbuffer.py,sha256=bid_N4ZsaTeC3x5Fzs8viUrldT863dMPtEDih20Nt6k,2644
|
|
3
|
-
dissect/cstruct/compiler.py,sha256=
|
|
4
|
-
dissect/cstruct/cstruct.py,sha256=
|
|
5
|
-
dissect/cstruct/exceptions.py,sha256=
|
|
6
|
-
dissect/cstruct/expression.py,sha256=
|
|
7
|
-
dissect/cstruct/parser.py,sha256=
|
|
3
|
+
dissect/cstruct/compiler.py,sha256=uOjteLdoUIVNSX71TsBAusW8U085RRH9dXkbK3dp1vY,14203
|
|
4
|
+
dissect/cstruct/cstruct.py,sha256=1lHbxZwj5x2EmmXLR0sJlp-wQqaTtd_ht1lvwit0KtQ,19483
|
|
5
|
+
dissect/cstruct/exceptions.py,sha256=SX05-_HqQn8lYC7SBHv5OrYEepYRMNmRiIzVPW8bvMQ,330
|
|
6
|
+
dissect/cstruct/expression.py,sha256=mf5GFGLAn_2Tz3QK86Yqoi317l8cjMcffBKzP2STE6M,10841
|
|
7
|
+
dissect/cstruct/parser.py,sha256=Mk8QbkDov_xfauZnp2MqUmFGOPZlp7O2rSLYbB9S3g4,24550
|
|
8
8
|
dissect/cstruct/utils.py,sha256=6cU1QHTZnHXQaPoxMH93ELkwIIUgYw-TtxieEcVvYvw,10537
|
|
9
9
|
dissect/cstruct/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
dissect/cstruct/tools/stubgen.py,sha256=wvl07h3VnJZWe9ygX4QMxjEH1ZcWaI_6_pSdAJoOEXk,7820
|
|
11
|
-
dissect/cstruct/types/__init__.py,sha256=
|
|
11
|
+
dissect/cstruct/types/__init__.py,sha256=6P71Pu94Dv7RNjZpDZ19pqzx-G0QzmQw4q0-3zWALso,911
|
|
12
12
|
dissect/cstruct/types/base.py,sha256=-NYmoX4vEfaFsnAIwQ0nZCz8X2qKEomgpnef2jB4klQ,9708
|
|
13
13
|
dissect/cstruct/types/char.py,sha256=9XYCjCF0D_5o3EYnmIcjev-5GI2NzxOhd1ct1xF6SAM,2457
|
|
14
|
-
dissect/cstruct/types/enum.py,sha256=
|
|
14
|
+
dissect/cstruct/types/enum.py,sha256=vOsD99P7VLhj6vcH_ow1jmyipLP63FmqUQ9GLZ1L8Pc,7565
|
|
15
15
|
dissect/cstruct/types/flag.py,sha256=7xxQjFEDPHSQOxBHgcc75WzPiAxflOquwr7Z7c3erLE,2347
|
|
16
16
|
dissect/cstruct/types/int.py,sha256=MGsdUxJt-lj3nl9wzAgGX8cb_vJOtGLiCHwYZs1j_IA,1156
|
|
17
17
|
dissect/cstruct/types/leb128.py,sha256=kDmsWGXX6vr1bm4uJcilsrQ7JABdQRio16rBZV21pno,2243
|
|
18
18
|
dissect/cstruct/types/packed.py,sha256=tpZpb8tiSMXr1np6p0-nZqT4sY7zieO-4E16lmMmqJA,2128
|
|
19
19
|
dissect/cstruct/types/pointer.py,sha256=PqeJOoNBUfMd5uO2kpF6OHeW7Q6R1N1W1V4q1MakN4I,3912
|
|
20
|
-
dissect/cstruct/types/structure.py,sha256=
|
|
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.dev5.dist-info/licenses/COPYRIGHT,sha256=H-18RXfshdH9AdHwW2eO1Xa-5s6tY5eipHh5c0whDu4,316
|
|
24
|
+
dissect_cstruct-4.8.dev5.dist-info/licenses/LICENSE,sha256=PhUqiw6jAh2KbBdVRPBq_hfAvfcTBin7nZ3CK7NQbTM,11341
|
|
25
|
+
dissect_cstruct-4.8.dev5.dist-info/METADATA,sha256=OgahqdcaXxySN7jBort-kTeB45TFVQqdefYl68Wi9T8,9255
|
|
26
|
+
dissect_cstruct-4.8.dev5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
27
|
+
dissect_cstruct-4.8.dev5.dist-info/entry_points.txt,sha256=z53zqZqwD2OLrAkRwrP4wTeiU9CQe7xrMly0T2c0_wQ,71
|
|
28
|
+
dissect_cstruct-4.8.dev5.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
|
29
|
+
dissect_cstruct-4.8.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{dissect_cstruct-4.8.dev4.dist-info → dissect_cstruct-4.8.dev5.dist-info}/licenses/COPYRIGHT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|