dissect.target 3.20.dev57__py3-none-any.whl → 3.20.dev59__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ import math
2
3
  import stat
3
4
  from typing import BinaryIO, Iterator, Optional, Union
4
5
 
@@ -100,16 +101,21 @@ class FatFilesystemEntry(FilesystemEntry):
100
101
  def lstat(self) -> fsutil.stat_result:
101
102
  """Return the stat information of the given path, without resolving links."""
102
103
  # mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime
103
- st_info = [
104
- (stat.S_IFDIR if self.is_dir() else stat.S_IFREG) | 0o777,
105
- self.entry.cluster,
106
- id(self.fs),
107
- 1,
108
- 0,
109
- 0,
110
- self.entry.size,
111
- self.entry.atime.replace(tzinfo=self.fs.tzinfo).timestamp(),
112
- self.entry.mtime.replace(tzinfo=self.fs.tzinfo).timestamp(),
113
- self.entry.ctime.replace(tzinfo=self.fs.tzinfo).timestamp(),
114
- ]
115
- return fsutil.stat_result(st_info)
104
+ st_info = fsutil.stat_result(
105
+ [
106
+ (stat.S_IFDIR if self.is_dir() else stat.S_IFREG) | 0o777,
107
+ self.entry.cluster,
108
+ id(self.fs),
109
+ 1,
110
+ 0,
111
+ 0,
112
+ self.entry.size,
113
+ self.entry.atime.replace(tzinfo=self.fs.tzinfo).timestamp(),
114
+ self.entry.mtime.replace(tzinfo=self.fs.tzinfo).timestamp(),
115
+ self.entry.ctime.replace(tzinfo=self.fs.tzinfo).timestamp(),
116
+ ]
117
+ )
118
+
119
+ st_info.st_blocks = math.ceil(self.entry.size / self.entry.fs.cluster_size)
120
+ st_info.st_blksize = self.entry.fs.cluster_size
121
+ return st_info
@@ -277,6 +277,11 @@ def get_optional(value: str, to_type: Callable) -> Any | None:
277
277
  return None
278
278
 
279
279
 
280
+ # Sometimes stringy None is inserted by external tools like Ansible
281
+ def int_or_none(value: str) -> int | None:
282
+ return int(value) if value and value != "None" else None
283
+
284
+
280
285
  class JournalFile:
281
286
  """Parse Systemd Journal file format.
282
287
 
@@ -427,30 +432,30 @@ class JournalPlugin(Plugin):
427
432
  ts=entry.get("ts"),
428
433
  message=entry.get("message"),
429
434
  message_id=entry.get("message_id"),
430
- priority=get_optional(entry.get("priority"), int),
435
+ priority=int_or_none(entry.get("priority")),
431
436
  code_file=get_optional(entry.get("code_file"), path_function),
432
- code_line=get_optional(entry.get("code_line"), int),
437
+ code_line=int_or_none(entry.get("code_line")),
433
438
  code_func=entry.get("code_func"),
434
- errno=get_optional(entry.get("errno"), int),
439
+ errno=int_or_none(entry.get("errno")),
435
440
  invocation_id=entry.get("invocation_id"),
436
441
  user_invocation_id=entry.get("user_invocation_id"),
437
442
  syslog_facility=entry.get("syslog_facility"),
438
443
  syslog_identifier=entry.get("syslog_identifier"),
439
- syslog_pid=get_optional(entry.get("syslog_pid"), int),
444
+ syslog_pid=int_or_none(entry.get("syslog_pid")),
440
445
  syslog_raw=entry.get("syslog_raw"),
441
446
  documentation=entry.get("documentation"),
442
- tid=get_optional(entry.get("tid"), int),
447
+ tid=int_or_none(entry.get("tid")),
443
448
  unit=entry.get("unit"),
444
449
  user_unit=entry.get("user_unit"),
445
- pid=get_optional(entry.get("pid"), int),
446
- uid=get_optional(entry.get("uid"), int),
447
- gid=get_optional(entry.get("gid"), int),
450
+ pid=int_or_none(entry.get("pid")),
451
+ uid=int_or_none(entry.get("uid")),
452
+ gid=int_or_none(entry.get("gid")),
448
453
  comm=entry.get("comm"),
449
454
  exe=get_optional(entry.get("exe"), path_function),
450
455
  cmdline=entry.get("cmdline"),
451
456
  cap_effective=entry.get("cap_effective"),
452
- audit_session=get_optional(entry.get("audit_session"), int),
453
- audit_loginuid=get_optional(entry.get("audit_loginuid"), int),
457
+ audit_session=int_or_none(entry.get("audit_session")),
458
+ audit_loginuid=int_or_none(entry.get("audit_loginuid")),
454
459
  systemd_cgroup=get_optional(entry.get("systemd_cgroup"), path_function),
455
460
  systemd_slice=entry.get("systemd_slice"),
456
461
  systemd_unit=entry.get("systemd_unit"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.target
3
- Version: 3.20.dev57
3
+ Version: 3.20.dev59
4
4
  Summary: This module ties all other Dissect modules together, it provides a programming API and command line tools which allow easy access to various data sources inside disk images or file collections (a.k.a. targets)
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -30,7 +30,7 @@ dissect/target/filesystems/cpio.py,sha256=ssVCjkAtLn2FqmNxeo6U5boyUdSYFxLWfXpytH
30
30
  dissect/target/filesystems/dir.py,sha256=rKEreX3A7CI6a3pMssrO9F-9i5pkxCn_Ucs_dMtHxxA,4574
31
31
  dissect/target/filesystems/exfat.py,sha256=PRkZPUVN5NlgB1VetFtywdNgF6Yj5OBtF5a25t-fFvw,5917
32
32
  dissect/target/filesystems/extfs.py,sha256=LVdB94lUI2DRHW0xUPx8lwuY-NKVeSwFGZiLOpZ8-Lk,4827
33
- dissect/target/filesystems/fat.py,sha256=cCIiUAY0-5dL76Zhvji1QbwlMVX7YqKWp-NmUdqz8yA,4605
33
+ dissect/target/filesystems/fat.py,sha256=bqpN4kVSz-0cz3P4QLk1ouJFw1xH1atCynW_ehXJAJE,4824
34
34
  dissect/target/filesystems/ffs.py,sha256=ry7aPb_AQeApTuhVQVioQPn4Q795_Ak5XloEtd-0bww,4950
35
35
  dissect/target/filesystems/itunes.py,sha256=w2lcWv6jlBPm84tsGZehxKBMXXyuW3KlmwVTF4ssQec,6395
36
36
  dissect/target/filesystems/jffs.py,sha256=fw25gM-Cx26VuTBmbaVNP1hKw73APkZ4RhI8MGY7-cQ,4207
@@ -269,7 +269,7 @@ dissect/target/plugins/os/unix/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
269
269
  dissect/target/plugins/os/unix/log/atop.py,sha256=zjG5eKS-X0mpBXs-Sg2f7RfQvtjt0T8JcteNd9DB_ok,16361
270
270
  dissect/target/plugins/os/unix/log/audit.py,sha256=rZwxC90Q0FOB5BZxplTJwCTIp0hdVpaps1e3C1fRYaM,3754
271
271
  dissect/target/plugins/os/unix/log/auth.py,sha256=9NJvlo7Vbsp_ENJFpKd04PH_sUuOy6ueSBwQqY0MtKo,14546
272
- dissect/target/plugins/os/unix/log/journal.py,sha256=xe8p8MM_95uYjFNzNSP5IsoIthJtxwFEDicYR42RYAI,17681
272
+ dissect/target/plugins/os/unix/log/journal.py,sha256=hhsvKs78BPv0vJN360fKVHqyBCdLUWxdv6ZUa4tqpD8,17795
273
273
  dissect/target/plugins/os/unix/log/lastlog.py,sha256=Wr3-2n1-GwckN9mSx-yM55N6_L0PQyx6TGHoEvuc6c0,2515
274
274
  dissect/target/plugins/os/unix/log/messages.py,sha256=XtjZ0a2budgQm_K5JT3fMf7JcjuD0AelcD3zOFN2xpI,5732
275
275
  dissect/target/plugins/os/unix/log/utmp.py,sha256=k2A69s2qUT2JunJrH8GO6nQ0zMDotXMTaj8OzQ7ljj8,7336
@@ -378,10 +378,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
378
378
  dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
379
379
  dissect/target/volumes/md.py,sha256=7ShPtusuLGaIv27SvEETtgsuoQyAa4iAAeOR1NEaajI,1689
380
380
  dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
381
- dissect.target-3.20.dev57.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
382
- dissect.target-3.20.dev57.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
383
- dissect.target-3.20.dev57.dist-info/METADATA,sha256=6Sf6uGhjSx0idsxYz-GPwrPZBOFzZQ4f0oZsPlHjFhE,13025
384
- dissect.target-3.20.dev57.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
385
- dissect.target-3.20.dev57.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
386
- dissect.target-3.20.dev57.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
387
- dissect.target-3.20.dev57.dist-info/RECORD,,
381
+ dissect.target-3.20.dev59.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
382
+ dissect.target-3.20.dev59.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
383
+ dissect.target-3.20.dev59.dist-info/METADATA,sha256=jkede6QAkD-RIMxW9TfSPDOO8cQxqBbjazWLI3vudys,13025
384
+ dissect.target-3.20.dev59.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
385
+ dissect.target-3.20.dev59.dist-info/entry_points.txt,sha256=BWuxAb_6AvUAQpIQOQU0IMTlaF6TDht2AIZK8bHd-zE,492
386
+ dissect.target-3.20.dev59.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
387
+ dissect.target-3.20.dev59.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5