Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan vhd #243

Merged
merged 13 commits into from
Dec 15, 2022
Merged

Scan vhd #243

merged 13 commits into from
Dec 15, 2022

Conversation

ryanohoro
Copy link
Collaborator

@ryanohoro ryanohoro commented Dec 13, 2022

Describe the change

Adds the ability to extract files and metadata from VHD and VHDX files.

Closes #242

Describe testing procedures

New test coverage for ScanVhd is passing using fixtures test.vhd and test.vhdx included in the commit.

~/strelka/build$ docker-compose build

...

Successfully built eb41de1cb4d4
Successfully tagged build_frontend:latest
~/strelka/src/python/strelka$ python -m pytest tests/
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.10.7, pytest-7.2.0, pluggy-1.0.0
rootdir: ~/strelka/src/python
plugins: mock-3.10.0
collected 11 items                                                                                                                                                                                        

tests/test_scan_footer.py .
tests/test_scan_gif.py .
tests/test_scan_iso.py .
tests/test_scan_msi.py .
tests/test_scan_url.py .....
tests/test_scan_vhd.py ..

=========================================================================================== 11 passed in 0.37s ============================================================================================

Sample output

ScanVhd event for test.vhd

{
    "elapsed": 0.0215,
    "flags": [],
    "total": {
        "files": 3,
        "extracted": 3
    },
    "files": [
        {
            "filename": "System Volume Information/WPSettings.dat",
            "size": "12",
            "datetime": "2022-12-11 21:21:48"
        },
        {
            "filename": "lorem.txt",
            "size": "4015",
            "datetime": "2022-12-11 21:12:55"
        },
        {
            "filename": "$RECYCLE.BIN/S-1-5-21-3712961497-200595429-3248382696-1000/desktop.ini",
            "size": "129",
            "datetime": "2022-12-11 21:22:04"
        }
    ],
    "hidden_dirs": [
        "System Volume Information",
        "$RECYCLE.BIN",
        "$RECYCLE.BIN/S-1-5-21-3712961497-200595429-3248382696-1000"
    ],
    "meta": {
        "7zip_version": "21.07",
        "partitions": [
            {
                "path": "/tmp/tmp401bahlv",
                "type": "VHDX",
                "creator_application": "Microsoft Windows 10.0.19044.0"
            },
            {
                "path": "tmp401bahlv~.gpt",
                "type": "GPT"
            },
            {
                "path": "0.Basic data partition.img",
                "file_system": "Windows BDP"
            },
            {
                "path": "0.Basic data partition.img",
                "type": "NTFS",
                "label": "New Volume",
                "file_system": "NTFS 3.1",
                "created": "2022-12-11 21:21:47.4094722"
            }
        ]
    }
}

ScanVhd event for test.vhdx

{
    "elapsed": 0.0215,
    "flags": [],
    "total": {
        "files": 3,
        "extracted": 3
    },
    "files": [
        {
            "filename": "System Volume Information/WPSettings.dat",
            "size": "12",
            "datetime": "2022-12-11 21:21:48"
        },
        {
            "filename": "lorem.txt",
            "size": "4015",
            "datetime": "2022-12-11 21:12:55"
        },
        {
            "filename": "$RECYCLE.BIN/S-1-5-21-3712961497-200595429-3248382696-1000/desktop.ini",
            "size": "129",
            "datetime": "2022-12-11 21:22:04"
        }
    ],
    "hidden_dirs": [
        "System Volume Information",
        "$RECYCLE.BIN",
        "$RECYCLE.BIN/S-1-5-21-3712961497-200595429-3248382696-1000"
    ],
    "meta": {
        "7zip_version": "21.07",
        "partitions": [
            {
                "path": "/tmp/tmp401bahlv",
                "type": "VHDX",
                "creator_application": "Microsoft Windows 10.0.19044.0"
            },
            {
                "path": "tmp401bahlv~.gpt",
                "type": "GPT"
            },
            {
                "path": "0.Basic data partition.img",
                "file_system": "Windows BDP"
            },
            {
                "path": "0.Basic data partition.img",
                "type": "NTFS",
                "label": "New Volume",
                "file_system": "NTFS 3.1",
                "created": "2022-12-11 21:21:47.4094722"
            }
        ]
    }
}

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of and tested my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@phutelmyer
Copy link
Contributor

Looks great, thank you @ryanohoro 👍

@phutelmyer phutelmyer merged commit 97a9eb0 into target:master Dec 15, 2022
@ryanohoro ryanohoro deleted the scan_vhd branch January 19, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add VHD/VHDX Scanner
2 participants