dissect.ole 3.8.dev2__tar.gz → 3.9.dev1__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 (21) hide show
  1. {dissect.ole-3.8.dev2/dissect.ole.egg-info → dissect_ole-3.9.dev1}/PKG-INFO +6 -3
  2. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect/ole/c_ole.py +2 -3
  3. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect/ole/ole.py +27 -19
  4. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1/dissect.ole.egg-info}/PKG-INFO +6 -3
  5. dissect_ole-3.9.dev1/dissect.ole.egg-info/requires.txt +6 -0
  6. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/pyproject.toml +8 -2
  7. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/tox.ini +1 -0
  8. dissect.ole-3.8.dev2/dissect.ole.egg-info/requires.txt +0 -2
  9. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/COPYRIGHT +0 -0
  10. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/LICENSE +0 -0
  11. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/MANIFEST.in +0 -0
  12. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/README.md +0 -0
  13. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect/ole/__init__.py +0 -0
  14. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect/ole/exceptions.py +0 -0
  15. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect.ole.egg-info/SOURCES.txt +0 -0
  16. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect.ole.egg-info/dependency_links.txt +0 -0
  17. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/dissect.ole.egg-info/top_level.txt +0 -0
  18. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/setup.cfg +0 -0
  19. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/tests/docs/Makefile +0 -0
  20. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/tests/docs/conf.py +0 -0
  21. {dissect.ole-3.8.dev2 → dissect_ole-3.9.dev1}/tests/docs/index.rst +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.ole
3
- Version: 3.8.dev2
3
+ Version: 3.9.dev1
4
4
  Summary: A Dissect module implementing a parser for the Object Linking & Embedding (OLE) format, commonly used by document editors on Windows operating systems
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -22,8 +22,11 @@ Requires-Python: ~=3.9
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  License-File: COPYRIGHT
25
- Requires-Dist: dissect.cstruct<4.0.dev,>=3.0.dev
26
- Requires-Dist: dissect.util<4.0.dev,>=3.0.dev
25
+ Requires-Dist: dissect.cstruct<5,>=4.dev
26
+ Requires-Dist: dissect.util<4,>=3
27
+ Provides-Extra: dev
28
+ Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
29
+ Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
27
30
 
28
31
  # dissect.ole
29
32
 
@@ -1,4 +1,4 @@
1
- from dissect import cstruct
1
+ from dissect.cstruct import cstruct
2
2
 
3
3
  ole_def = """
4
4
  typedef short OFFSET;
@@ -81,8 +81,7 @@ struct StructuredStorageDirectoryEntry { // [offset from start in bytes, leng
81
81
  DFPROPTYPE _dptPropType; // [07CH,02] Reserved for future use. Must be zero.
82
82
  };
83
83
  """
84
- c_ole = cstruct.cstruct()
85
- c_ole.load(ole_def)
84
+ c_ole = cstruct().load(ole_def)
86
85
 
87
86
  SIGNATURE = b"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1"
88
87
  SIGNATURE_BETA = b"\x0e\x11\xfc\x0d\xd0\xcf\x11\xe0"
@@ -28,7 +28,6 @@ class OLE:
28
28
  self._difatcache = {}
29
29
  self._chaincache = {}
30
30
  self._minichaincache = {}
31
- self._dirlist = {}
32
31
 
33
32
  minifat_buf = self.chain(self.header._sectMiniFatStart).open().read()
34
33
  self._minifat = c_ole.uint32[len(minifat_buf) // 4](minifat_buf)
@@ -38,21 +37,24 @@ class OLE:
38
37
  self.root = self.directory(0)
39
38
  self.ministream = self.root.open()
40
39
 
41
- def get(self, name):
42
- dirlist = self.listdir()
43
- try:
44
- return dirlist[name]
45
- except KeyError:
46
- return NotFoundError(name)
40
+ def get(self, path, root=None):
41
+ root = root or self.root
47
42
 
48
- def listdir(self):
49
- if not self._dirlist:
50
- for entry in self.root.walk():
51
- self._dirlist[entry.name] = entry
43
+ search_path = path.replace("\\", "/")
44
+ node = root
52
45
 
53
- return self._dirlist
46
+ for part in search_path.split("/"):
47
+ if not part:
48
+ continue
49
+
50
+ for child in node.walk():
51
+ if child.name == part:
52
+ node = child
53
+ break
54
+ else:
55
+ raise NotFoundError(path)
54
56
 
55
- dirlist = listdir
57
+ return node
56
58
 
57
59
  def directory(self, sid):
58
60
  try:
@@ -148,29 +150,35 @@ class DirectoryEntry:
148
150
  else:
149
151
  self.chain = ole.chain(self.start, self.size)
150
152
 
153
+ self._dirlist = {}
154
+
151
155
  def __repr__(self):
152
156
  return "<DirectoryEntry sid={} name={} type={} size=0x{:x}>".format(self.sid, self.name, self.type, self.size)
153
157
 
154
158
  def open(self):
155
159
  return self.chain.open()
156
160
 
161
+ def listdir(self):
162
+ if not self._dirlist:
163
+ for entry in self.walk():
164
+ self._dirlist[entry.name] = entry
165
+
166
+ return self._dirlist
167
+
157
168
  def walk(self):
158
169
  if self.has_left_sibling:
159
170
  yield self.left_sibling
160
- for child in self.left_sibling.walk():
161
- yield child
171
+ yield from self.left_sibling.walk()
162
172
 
163
173
  if self.has_child:
164
174
  yield self.child
165
175
 
166
176
  if self.has_right_sibling:
167
177
  yield self.right_sibling
168
- for child in self.right_sibling.walk():
169
- yield child
178
+ yield from self.right_sibling.walk()
170
179
 
171
180
  if self.has_child:
172
- for child in self.child.walk():
173
- yield child
181
+ yield from self.child.walk()
174
182
 
175
183
  @property
176
184
  def child(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.ole
3
- Version: 3.8.dev2
3
+ Version: 3.9.dev1
4
4
  Summary: A Dissect module implementing a parser for the Object Linking & Embedding (OLE) format, commonly used by document editors on Windows operating systems
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -22,8 +22,11 @@ Requires-Python: ~=3.9
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  License-File: COPYRIGHT
25
- Requires-Dist: dissect.cstruct<4.0.dev,>=3.0.dev
26
- Requires-Dist: dissect.util<4.0.dev,>=3.0.dev
25
+ Requires-Dist: dissect.cstruct<5,>=4.dev
26
+ Requires-Dist: dissect.util<4,>=3
27
+ Provides-Extra: dev
28
+ Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
29
+ Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
27
30
 
28
31
  # dissect.ole
29
32
 
@@ -0,0 +1,6 @@
1
+ dissect.cstruct<5,>=4.dev
2
+ dissect.util<4,>=3
3
+
4
+ [dev]
5
+ dissect.cstruct<5.0.dev,>=4.0.dev
6
+ dissect.util<4.0.dev,>=3.0.dev
@@ -25,8 +25,8 @@ classifiers = [
25
25
  "Topic :: Utilities",
26
26
  ]
27
27
  dependencies = [
28
- "dissect.cstruct>=3.0.dev,<4.0.dev",
29
- "dissect.util>=3.0.dev,<4.0.dev",
28
+ "dissect.cstruct>=4.dev,<5",
29
+ "dissect.util>=3,<4",
30
30
  ]
31
31
  dynamic = ["version"]
32
32
 
@@ -35,6 +35,12 @@ homepage = "https://dissect.tools"
35
35
  documentation = "https://docs.dissect.tools/en/latest/projects/dissect.ole"
36
36
  repository = "https://github.com/fox-it/dissect.ole"
37
37
 
38
+ [project.optional-dependencies]
39
+ dev = [
40
+ "dissect.cstruct>=4.0.dev,<5.0.dev",
41
+ "dissect.util>=3.0.dev,<4.0.dev",
42
+ ]
43
+
38
44
  [tool.black]
39
45
  line-length = 120
40
46
 
@@ -11,6 +11,7 @@ minversion = 4.4.3
11
11
  requires = virtualenv>=20.16.6
12
12
 
13
13
  [testenv]
14
+ extras = dev
14
15
  deps =
15
16
  pytest
16
17
  pytest-cov
@@ -1,2 +0,0 @@
1
- dissect.cstruct<4.0.dev,>=3.0.dev
2
- dissect.util<4.0.dev,>=3.0.dev
File without changes
File without changes
File without changes
File without changes