dissect.cstruct 3.11.dev0__tar.gz → 3.11.dev2__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.
- {dissect.cstruct-3.11.dev0/dissect.cstruct.egg-info → dissect.cstruct-3.11.dev2}/PKG-INFO +1 -1
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/cstruct.py +4 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/utils.py +4 -1
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2/dissect.cstruct.egg-info}/PKG-INFO +1 -1
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_util.py +36 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/COPYRIGHT +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/LICENSE +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/MANIFEST.in +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/README.md +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/__init__.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/bitbuffer.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/compiler.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/exceptions.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/expression.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/parser.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/__init__.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/base.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/bytesinteger.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/chartype.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/enum.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/flag.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/instance.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/packedtype.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/pointer.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/structure.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/voidtype.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/wchartype.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect.cstruct.egg-info/SOURCES.txt +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect.cstruct.egg-info/dependency_links.txt +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect.cstruct.egg-info/top_level.txt +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/examples/disk.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/examples/mirai.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/examples/pe.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/examples/secdesc.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/pyproject.toml +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/setup.cfg +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/__init__.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/conftest.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/data/testdef.txt +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/docs/Makefile +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/docs/conf.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/docs/index.rst +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_align.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_basic.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_bitbuffer.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_bitfield.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_bytesinteger.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_ctypes_type.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_enum.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_expression.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_flag.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_packedtype.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_parser.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_pointer.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_struct.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_union.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/test_utils.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tests/utils.py +0 -0
- {dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 3.11.
|
|
3
|
+
Version: 3.11.dev2
|
|
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: Apache License 2.0
|
|
@@ -139,6 +139,10 @@ class cstruct:
|
|
|
139
139
|
"u4": "uint32",
|
|
140
140
|
"u8": "uint64",
|
|
141
141
|
"u16": "uint128",
|
|
142
|
+
"__u8": "uint8",
|
|
143
|
+
"__u16": "uint16",
|
|
144
|
+
"__u32": "uint32",
|
|
145
|
+
"__u64": "uint64",
|
|
142
146
|
"uchar": "uint8",
|
|
143
147
|
"ushort": "unsigned short",
|
|
144
148
|
"uint": "unsigned int",
|
|
@@ -135,7 +135,10 @@ def _dumpstruct(
|
|
|
135
135
|
ci = 0
|
|
136
136
|
out = [f"struct {structure.name}:"]
|
|
137
137
|
foreground, background = None, None
|
|
138
|
-
for field in instance._type.
|
|
138
|
+
for field in instance._type.lookup.values():
|
|
139
|
+
if getattr(field.type, "anonymous", False):
|
|
140
|
+
continue
|
|
141
|
+
|
|
139
142
|
if color:
|
|
140
143
|
foreground, background = colors[ci % len(colors)]
|
|
141
144
|
palette.append((instance._size(field.name), background))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 3.11.
|
|
3
|
+
Version: 3.11.dev2
|
|
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: Apache License 2.0
|
|
@@ -28,6 +28,42 @@ def test_dumpstruct(capsys, compiled):
|
|
|
28
28
|
uint32 testval;
|
|
29
29
|
};
|
|
30
30
|
"""
|
|
31
|
+
|
|
32
|
+
cs = cstruct.cstruct()
|
|
33
|
+
cs.load(cdef, compiled=compiled)
|
|
34
|
+
|
|
35
|
+
assert verify_compiled(cs.test, compiled)
|
|
36
|
+
|
|
37
|
+
buf = b"\x39\x05\x00\x00"
|
|
38
|
+
obj = cs.test(buf)
|
|
39
|
+
|
|
40
|
+
dumpstruct(cs.test, buf)
|
|
41
|
+
captured_1 = capsys.readouterr()
|
|
42
|
+
|
|
43
|
+
dumpstruct(obj)
|
|
44
|
+
captured_2 = capsys.readouterr()
|
|
45
|
+
|
|
46
|
+
assert captured_1.out == captured_2.out
|
|
47
|
+
|
|
48
|
+
out_1 = dumpstruct(cs.test, buf, output="string")
|
|
49
|
+
out_2 = dumpstruct(obj, output="string")
|
|
50
|
+
|
|
51
|
+
assert out_1 == out_2
|
|
52
|
+
|
|
53
|
+
with pytest.raises(ValueError) as excinfo:
|
|
54
|
+
dumpstruct(obj, output="generator")
|
|
55
|
+
assert str(excinfo.value) == "Invalid output argument: 'generator' (should be 'print' or 'string')."
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_dumpstruct_anonymous(capsys, compiled):
|
|
59
|
+
cdef = """
|
|
60
|
+
struct test {
|
|
61
|
+
struct {
|
|
62
|
+
uint32 testval;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
"""
|
|
66
|
+
|
|
31
67
|
cs = cstruct.cstruct()
|
|
32
68
|
cs.load(cdef, compiled=compiled)
|
|
33
69
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect/cstruct/types/bytesinteger.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect.cstruct.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev0 → dissect.cstruct-3.11.dev2}/dissect.cstruct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|