dissect.evidence 3.9.dev5__py3-none-any.whl → 3.10.dev2__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/evidence/ad1.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import zlib
2
2
 
3
- from dissect import cstruct
3
+ from dissect.cstruct import cstruct
4
4
  from dissect.util.stream import AlignedStream, RelativeStream
5
5
 
6
6
  ad1_def = """
@@ -84,8 +84,7 @@ typedef struct {
84
84
  char data[len];
85
85
  } FileMeta;
86
86
  """
87
- c_ad1 = cstruct.cstruct()
88
- c_ad1.load(ad1_def)
87
+ c_ad1 = cstruct().load(ad1_def)
89
88
 
90
89
  EntryType = c_ad1.EntryType
91
90
  MetaType = c_ad1.MetaType
@@ -101,7 +100,7 @@ class AD1:
101
100
  self.root = self.logical_image
102
101
 
103
102
  def __getattr__(self, k):
104
- if k in self.header:
103
+ if k in self.header.__class__.fields:
105
104
  return getattr(self.header, k)
106
105
 
107
106
  return super().__getattr__(k)
@@ -152,7 +151,7 @@ class LogicalImage:
152
151
  return f"<LogicalImage name={self.header.name}>"
153
152
 
154
153
  def __getattr__(self, k):
155
- if k in self.header:
154
+ if k in self.header.__class__.fields:
156
155
  return getattr(self.header, k)
157
156
 
158
157
  return object.__getattribute__(self, k)
@@ -190,7 +189,7 @@ class FileEntry:
190
189
  return f"<{file_type} name={self.entry.name}>"
191
190
 
192
191
  def __getattr__(self, k):
193
- if k in self.entry:
192
+ if k in self.entry.__class__.fields:
194
193
  return getattr(self.entry, k)
195
194
 
196
195
  return object.__getattribute__(self, k)
@@ -217,7 +216,7 @@ class FileMeta:
217
216
  return f"<Meta category={self.entry.category} type={self.entry.type} data={self.entry.data}>"
218
217
 
219
218
  def __getattr__(self, k):
220
- if k in self.entry:
219
+ if k in self.entry.__class__.fields:
221
220
  return getattr(self.entry, k)
222
221
 
223
222
  return object.__getattribute__(self, k)
@@ -11,7 +11,7 @@ from bisect import bisect_right
11
11
  from collections import defaultdict
12
12
  from typing import BinaryIO, Callable, Iterator, Optional
13
13
 
14
- from dissect import cstruct
14
+ from dissect.cstruct import cstruct
15
15
  from dissect.util import ts
16
16
  from dissect.util.stream import AlignedStream, RangeStream
17
17
 
@@ -84,8 +84,7 @@ struct footer {
84
84
  char sha256[32]; // SHA256 of this file up until this hash
85
85
  };
86
86
  """
87
- c_asdf = cstruct.cstruct()
88
- c_asdf.load(asdf_def)
87
+ c_asdf = cstruct().load(asdf_def)
89
88
 
90
89
 
91
90
  class AsdfWriter(io.RawIOBase):
@@ -147,11 +146,11 @@ class AsdfWriter(io.RawIOBase):
147
146
  info.uname = "root"
148
147
  info.gname = "root"
149
148
 
150
- if not size:
149
+ if size is None and fh.seekable():
151
150
  fh.seek(0, io.SEEK_END)
152
151
  size = fh.tell()
153
152
 
154
- info.size = size
153
+ info.size = size or 0
155
154
 
156
155
  fh.seek(0)
157
156
  self._meta_tar.addfile(info, fh)
@@ -586,7 +585,7 @@ class AsdfStream(AlignedStream):
586
585
  return b"".join(result)
587
586
 
588
587
 
589
- def scrape_blocks(fh: BinaryIO, buffer_size: int = io.DEFAULT_BUFFER_SIZE) -> Iterator[cstruct.Instance, int]:
588
+ def scrape_blocks(fh: BinaryIO, buffer_size: int = io.DEFAULT_BUFFER_SIZE) -> Iterator[c_asdf.block, int]:
590
589
  """Scrape for block headers in ``fh`` and yield parsed block headers and their offset.
591
590
 
592
591
  Args:
@@ -616,7 +615,7 @@ def scrape_blocks(fh: BinaryIO, buffer_size: int = io.DEFAULT_BUFFER_SIZE) -> It
616
615
  block_buf = fh.read(len(c_asdf.block))
617
616
 
618
617
  # Some sanity checks that this is actually a block header
619
- if block_buf[4] not in c_asdf.BLOCK_FLAG.reverse:
618
+ if block_buf[4] not in c_asdf.BLOCK_FLAG:
620
619
  continue
621
620
 
622
621
  if block_buf[6:8] != b"\x00\x00":
dissect/evidence/ewf.py CHANGED
@@ -100,8 +100,7 @@ typedef struct {
100
100
  } EWFTableSection;
101
101
  """
102
102
 
103
- c_ewf = cstruct()
104
- c_ewf.load(ewf_def)
103
+ c_ewf = cstruct().load(ewf_def)
105
104
 
106
105
  MAX_OPEN_SEGMENTS = 128
107
106
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.evidence
3
- Version: 3.9.dev5
3
+ Version: 3.10.dev2
4
4
  Summary: A Dissect module implementing a parsers for various forensic evidence file containers, currently: AD1, ASDF and EWF
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.evidence
29
32
 
@@ -0,0 +1,20 @@
1
+ dissect/evidence/__init__.py,sha256=B0s7NJEWXtn2MvJkv1g1V68inFxHQp-YwJ9xRenka64,165
2
+ dissect/evidence/ad1.py,sha256=VWnDkISbZ8aSUMToponE6bd1LQy0bl18p-6vHxGiHF8,6622
3
+ dissect/evidence/ewf.py,sha256=egCAGRIGM_W9yTildgCApG-VNpIHKduTlg_8aBNzO4w,14751
4
+ dissect/evidence/exceptions.py,sha256=xFvnTpdkL7GhwV57dkI0t-63FxuBv_rjjP7VJ_zrL6Y,538
5
+ dissect/evidence/asdf/__init__.py,sha256=yZxcpk-dYWkSqJ923fgh5x2l6GwXq2rJfmIrh5rZT68,177
6
+ dissect/evidence/asdf/asdf.py,sha256=A0LM3Qk1WsCoj0Cl6Fe-x70Z976at0ncQ4XzJ_EVzFM,23854
7
+ dissect/evidence/asdf/streams.py,sha256=5VBq4az6c10r5qQaHgR8g0a7j5nAcgQuat3yyp-Eua8,2601
8
+ dissect/evidence/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ dissect/evidence/tools/asdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ dissect/evidence/tools/asdf/dd.py,sha256=ldyjyUIQhRaIxLhCbnvNK8d2sCvOw2PCVal3kCegERo,2975
11
+ dissect/evidence/tools/asdf/meta.py,sha256=Dqfs34wWU2lV2JPTdrwhPfZ3Dm-fETlA20yZDhQGmo4,2417
12
+ dissect/evidence/tools/asdf/repair.py,sha256=5XQRQ33-SOcFes55vyY-j9tHrmrbSB8Q-ijspQnMD3U,2893
13
+ dissect/evidence/tools/asdf/verify.py,sha256=DLYMXzsUtkimkhqUN_NHxnpamy8HHnL3rcp_aoL5-FI,3871
14
+ dissect.evidence-3.10.dev2.dist-info/COPYRIGHT,sha256=yExUrJwFMdmpUCxPrUiBR1pPQ_pGrr6hf3p231U6VnQ,303
15
+ dissect.evidence-3.10.dev2.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
16
+ dissect.evidence-3.10.dev2.dist-info/METADATA,sha256=cDDZbRMdca5F8MLWt89RzqxTHg4GOYwlMhVtc-XD49k,3294
17
+ dissect.evidence-3.10.dev2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
18
+ dissect.evidence-3.10.dev2.dist-info/entry_points.txt,sha256=rz4YeIbMkl-wjryDbFnh25eK5qK4asKQvZoMJ8hM_eo,222
19
+ dissect.evidence-3.10.dev2.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
20
+ dissect.evidence-3.10.dev2.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- dissect/evidence/__init__.py,sha256=B0s7NJEWXtn2MvJkv1g1V68inFxHQp-YwJ9xRenka64,165
2
- dissect/evidence/ad1.py,sha256=5iO9d051D5e3w57psOUevbx8aotNIehoGQFOugZEIu0,6560
3
- dissect/evidence/ewf.py,sha256=aAM1nT-9rM85X2xu7iFDgQr0R92_hlZ3PRVut2-zCi0,14757
4
- dissect/evidence/exceptions.py,sha256=xFvnTpdkL7GhwV57dkI0t-63FxuBv_rjjP7VJ_zrL6Y,538
5
- dissect/evidence/asdf/__init__.py,sha256=yZxcpk-dYWkSqJ923fgh5x2l6GwXq2rJfmIrh5rZT68,177
6
- dissect/evidence/asdf/asdf.py,sha256=86d2eENSEInTfCoq963qtybmK0HrW7ie8j1CQczJRrs,23846
7
- dissect/evidence/asdf/streams.py,sha256=5VBq4az6c10r5qQaHgR8g0a7j5nAcgQuat3yyp-Eua8,2601
8
- dissect/evidence/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- dissect/evidence/tools/asdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- dissect/evidence/tools/asdf/dd.py,sha256=ldyjyUIQhRaIxLhCbnvNK8d2sCvOw2PCVal3kCegERo,2975
11
- dissect/evidence/tools/asdf/meta.py,sha256=Dqfs34wWU2lV2JPTdrwhPfZ3Dm-fETlA20yZDhQGmo4,2417
12
- dissect/evidence/tools/asdf/repair.py,sha256=5XQRQ33-SOcFes55vyY-j9tHrmrbSB8Q-ijspQnMD3U,2893
13
- dissect/evidence/tools/asdf/verify.py,sha256=DLYMXzsUtkimkhqUN_NHxnpamy8HHnL3rcp_aoL5-FI,3871
14
- dissect.evidence-3.9.dev5.dist-info/COPYRIGHT,sha256=yExUrJwFMdmpUCxPrUiBR1pPQ_pGrr6hf3p231U6VnQ,303
15
- dissect.evidence-3.9.dev5.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
16
- dissect.evidence-3.9.dev5.dist-info/METADATA,sha256=hgREOHLm8bIMbswu1ygwl--L1bA3HMwIDfI5vnv3bds,3162
17
- dissect.evidence-3.9.dev5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
18
- dissect.evidence-3.9.dev5.dist-info/entry_points.txt,sha256=rz4YeIbMkl-wjryDbFnh25eK5qK4asKQvZoMJ8hM_eo,222
19
- dissect.evidence-3.9.dev5.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
20
- dissect.evidence-3.9.dev5.dist-info/RECORD,,