diff --git a/dissect/hypervisor/__init__.py b/dissect/hypervisor/__init__.py index ad035e4..c872697 100644 --- a/dissect/hypervisor/__init__.py +++ b/dissect/hypervisor/__init__.py @@ -1,9 +1,8 @@ from dissect.hypervisor.backup import vma, wim, xva +from dissect.hypervisor.descriptor import hyperv, ovf, vbox, vmx from dissect.hypervisor.disk import qcow2, vdi, vhd, vhdx, vmdk -from dissect.hypervisor.descriptor import hyperv, ovf, vmx, vbox from dissect.hypervisor.util import envelope, vmtar - __all__ = [ "envelope", "hyperv", diff --git a/dissect/hypervisor/backup/c_vma.py b/dissect/hypervisor/backup/c_vma.py index a4d122d..b0ae542 100644 --- a/dissect/hypervisor/backup/c_vma.py +++ b/dissect/hypervisor/backup/c_vma.py @@ -1,6 +1,5 @@ from dissect import cstruct - vma_def = """ #define VMA_BLOCK_BITS 12 #define VMA_BLOCK_SIZE (1 << VMA_BLOCK_BITS) diff --git a/dissect/hypervisor/backup/c_wim.py b/dissect/hypervisor/backup/c_wim.py index bca0772..c810201 100644 --- a/dissect/hypervisor/backup/c_wim.py +++ b/dissect/hypervisor/backup/c_wim.py @@ -1,6 +1,5 @@ from dissect import cstruct - wim_def = """ typedef char[16] GUID; typedef uint64 LARGE_INTEGER; diff --git a/dissect/hypervisor/backup/vma.py b/dissect/hypervisor/backup/vma.py index 38b9bb8..150b022 100644 --- a/dissect/hypervisor/backup/vma.py +++ b/dissect/hypervisor/backup/vma.py @@ -11,7 +11,7 @@ from dissect.util import ts from dissect.util.stream import AlignedStream -from dissect.hypervisor.backup.c_vma import c_vma, VMA_MAGIC, VMA_EXTENT_MAGIC +from dissect.hypervisor.backup.c_vma import VMA_EXTENT_MAGIC, VMA_MAGIC, c_vma from dissect.hypervisor.exceptions import InvalidHeaderError diff --git a/dissect/hypervisor/backup/wim.py b/dissect/hypervisor/backup/wim.py index c5171ff..ee2a3b9 100644 --- a/dissect/hypervisor/backup/wim.py +++ b/dissect/hypervisor/backup/wim.py @@ -1,4 +1,4 @@ -from dissect.hypervisor.backup.c_wim import c_wim, WIM_IMAGE_TAG +from dissect.hypervisor.backup.c_wim import WIM_IMAGE_TAG, c_wim from dissect.hypervisor.exceptions import InvalidHeaderError diff --git a/dissect/hypervisor/descriptor/c_hyperv.py b/dissect/hypervisor/descriptor/c_hyperv.py index cb70883..daefa3e 100644 --- a/dissect/hypervisor/descriptor/c_hyperv.py +++ b/dissect/hypervisor/descriptor/c_hyperv.py @@ -1,6 +1,5 @@ from dissect import cstruct - hyperv_def = """ /* ======== File header ======== */ diff --git a/dissect/hypervisor/descriptor/hyperv.py b/dissect/hypervisor/descriptor/hyperv.py index b3d8bc6..6b22e11 100644 --- a/dissect/hypervisor/descriptor/hyperv.py +++ b/dissect/hypervisor/descriptor/hyperv.py @@ -5,7 +5,12 @@ from dissect.util.stream import RangeStream -from dissect.hypervisor.descriptor.c_hyperv import KeyDataFlag, KeyDataType, ObjectEntryType, c_hyperv +from dissect.hypervisor.descriptor.c_hyperv import ( + KeyDataFlag, + KeyDataType, + ObjectEntryType, + c_hyperv, +) from dissect.hypervisor.exceptions import InvalidSignature diff --git a/dissect/hypervisor/descriptor/vmx.py b/dissect/hypervisor/descriptor/vmx.py index d2e785a..987a9b0 100644 --- a/dissect/hypervisor/descriptor/vmx.py +++ b/dissect/hypervisor/descriptor/vmx.py @@ -10,7 +10,6 @@ from typing import Dict, List from urllib.parse import unquote - try: import _pystandalone diff --git a/dissect/hypervisor/disk/c_qcow2.py b/dissect/hypervisor/disk/c_qcow2.py index ac9dfc3..af33817 100644 --- a/dissect/hypervisor/disk/c_qcow2.py +++ b/dissect/hypervisor/disk/c_qcow2.py @@ -1,6 +1,5 @@ from dissect import cstruct - qcow2_def = """ #define MIN_CLUSTER_BITS 9 #define MAX_CLUSTER_BITS 21 diff --git a/dissect/hypervisor/disk/c_vdi.py b/dissect/hypervisor/disk/c_vdi.py index 38c25ed..07d2f03 100644 --- a/dissect/hypervisor/disk/c_vdi.py +++ b/dissect/hypervisor/disk/c_vdi.py @@ -1,6 +1,5 @@ from dissect import cstruct - # https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Storage/VDICore.h # https://forums.virtualbox.org/viewtopic.php?t=8046 # 0000 3C 3C 3C 20 53 75 6E 20 78 56 4D 20 56 69 72 74 <<< Sun xVM Virt diff --git a/dissect/hypervisor/disk/c_vhd.py b/dissect/hypervisor/disk/c_vhd.py index a9f9420..bf9f817 100644 --- a/dissect/hypervisor/disk/c_vhd.py +++ b/dissect/hypervisor/disk/c_vhd.py @@ -1,6 +1,5 @@ from dissect import cstruct - vhd_def = """ struct footer { char cookie[8]; diff --git a/dissect/hypervisor/disk/c_vhdx.py b/dissect/hypervisor/disk/c_vhdx.py index bfe62b6..afbe960 100644 --- a/dissect/hypervisor/disk/c_vhdx.py +++ b/dissect/hypervisor/disk/c_vhdx.py @@ -2,7 +2,6 @@ from dissect import cstruct - vhdx_def = """ #define PAYLOAD_BLOCK_NOT_PRESENT 0 #define PAYLOAD_BLOCK_UNDEFINED 1 diff --git a/dissect/hypervisor/disk/c_vmdk.py b/dissect/hypervisor/disk/c_vmdk.py index 86e6428..75623ef 100644 --- a/dissect/hypervisor/disk/c_vmdk.py +++ b/dissect/hypervisor/disk/c_vmdk.py @@ -1,6 +1,6 @@ import struct -from dissect import cstruct +from dissect import cstruct vmdk_def = """ typedef struct { diff --git a/dissect/hypervisor/tools/vma.py b/dissect/hypervisor/tools/vma.py index f283cfd..55b8ca9 100644 --- a/dissect/hypervisor/tools/vma.py +++ b/dissect/hypervisor/tools/vma.py @@ -3,12 +3,19 @@ import sys from pathlib import Path -from dissect.hypervisor.backup.vma import VMA, _iter_mask from dissect.hypervisor.backup.c_vma import c_vma +from dissect.hypervisor.backup.vma import VMA, _iter_mask try: from rich.logging import RichHandler - from rich.progress import BarColumn, DownloadColumn, Progress, TextColumn, TimeRemainingColumn, TransferSpeedColumn + from rich.progress import ( + BarColumn, + DownloadColumn, + Progress, + TextColumn, + TimeRemainingColumn, + TransferSpeedColumn, + ) progress = Progress( TextColumn("[bold blue]{task.fields[filename]}", justify="right"), diff --git a/dissect/hypervisor/util/envelope.py b/dissect/hypervisor/util/envelope.py index 3ff5af1..4ddf216 100644 --- a/dissect/hypervisor/util/envelope.py +++ b/dissect/hypervisor/util/envelope.py @@ -28,7 +28,6 @@ from dissect import cstruct from dissect.util.stream import RangeStream - c_def = """ struct EnvelopeFileHeader { char magic[21]; diff --git a/setup.py b/setup.py index 92cafc5..c050c00 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup setup( name="dissect.hypervisor", diff --git a/tests/conftest.py b/tests/conftest.py index 7d1aacc..982f427 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,5 @@ -import os import gzip +import os import pytest diff --git a/tests/test_envelope.py b/tests/test_envelope.py index 1ce0717..01e4db5 100644 --- a/tests/test_envelope.py +++ b/tests/test_envelope.py @@ -2,7 +2,12 @@ import pytest -from dissect.hypervisor.util.envelope import Envelope, KeyStore, HAS_PYCRYPTODOME, HAS_PYSTANDALONE +from dissect.hypervisor.util.envelope import ( + HAS_PYCRYPTODOME, + HAS_PYSTANDALONE, + Envelope, + KeyStore, +) def test_envelope_keystore(keystore): diff --git a/tests/test_vhd.py b/tests/test_vhd.py index 758fa13..fe68d93 100644 --- a/tests/test_vhd.py +++ b/tests/test_vhd.py @@ -1,4 +1,4 @@ -from dissect.hypervisor.disk.vhd import VHD, FixedDisk, DynamicDisk +from dissect.hypervisor.disk.vhd import VHD, DynamicDisk, FixedDisk def test_vhd_fixed(fixed_vhd): diff --git a/tests/test_vhdx.py b/tests/test_vhdx.py index 1d59560..4c853c7 100644 --- a/tests/test_vhdx.py +++ b/tests/test_vhdx.py @@ -2,7 +2,7 @@ import pytest -from dissect.hypervisor.disk.vhdx import VHDX, c_vhdx, _iter_partial_runs +from dissect.hypervisor.disk.vhdx import VHDX, _iter_partial_runs, c_vhdx def test_vhdx_fixed(fixed_vhdx): diff --git a/tests/test_vmdk.py b/tests/test_vmdk.py index f827370..de99aaa 100644 --- a/tests/test_vmdk.py +++ b/tests/test_vmdk.py @@ -1,5 +1,5 @@ -from dissect.hypervisor.disk.vmdk import VMDK from dissect.hypervisor.disk.c_vmdk import c_vmdk +from dissect.hypervisor.disk.vmdk import VMDK def test_vmdk_sesparse(sesparse_vmdk): diff --git a/tests/test_vmx.py b/tests/test_vmx.py index 235091c..3894e40 100644 --- a/tests/test_vmx.py +++ b/tests/test_vmx.py @@ -1,6 +1,6 @@ import pytest -from dissect.hypervisor.descriptor.vmx import VMX, HAS_PYCRYPTODOME, HAS_PYSTANDALONE +from dissect.hypervisor.descriptor.vmx import HAS_PYCRYPTODOME, HAS_PYSTANDALONE, VMX def test_vmx(): diff --git a/tox.ini b/tox.ini index 53c865f..89744a4 100644 --- a/tox.ini +++ b/tox.ini @@ -40,6 +40,7 @@ deps = black==23.1.0 flake8 flake8-black + flake8-isort vermin commands = flake8 dissect tests setup.py