> For the complete documentation index, see [llms.txt](https://d3ndr1t30x.gitbook.io/breaking-things-a-junior-pentesters-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://d3ndr1t30x.gitbook.io/breaking-things-a-junior-pentesters-guide/enumeration/reading-vhd-files.md).

# Reading VHD files

### Using guestmount

```
guestmount --add 9b9cfbc4-369e-11e9-a17c-806e6f6e6963.vhd --inspector --ro -v /mnt/vhd
```

Here's a generic version of the `guestmount` command you provided, along with a breakdown:

```bash
guestmount --add <VHD_FILE> --inspector --ro -v <MOUNT_POINT>
```

* `guestmount`: The main command for mounting a disk image.
* `--add <VHD_FILE>`: The `--add` option followed by the path to the VHD file you want to mount. Replace `<VHD_FILE>` with the actual path to your VHD file.
* `--inspector`: Specifies the use of an inspector for automatic filesystem detection. It helps determine the filesystem type on the mounted image.
* `--ro`: Indicates that the VHD file should be mounted in read-only mode. This prevents any modifications to the mounted image and ensures data integrity.
* `-v`: This is an optional option that increases the verbosity of the command, providing more detailed output or debugging information.
* `<MOUNT_POINT>`: Specifies the directory where the VHD file will be mounted. Replace `<MOUNT_POINT>` with the actual path to your desired mount point.

### Using 7zip

**Install 7-Zip if not already installed**: If you don't have 7-Zip installed on your Kali Linux system, you can install it using the following command:

* ```bash
  sudo apt-get update
  sudo apt-get install p7zip-full
  ```
* **List Contents of the VHD File**: You can use 7-Zip to list the contents of a VHD file without extracting it. Open a terminal and navigate to the directory containing the VHD file.
* **List Contents of the VHD File**: Run the following command to list the contents of the VHD file:
* ```bash
  7z l YourVHDFile.vhd
  ```

  Replace `YourVHDFile.vhd` with the actual name of your VHD file.

  This command will display a list of files and directories contained within the VHD file.
* **Extract Files from the VHD File** (if needed): If you want to extract specific files or directories from the VHD file, you can use the following command:

```bash
7z x YourVHDFile.vhd -oOutputDirectory
```

Replace `YourVHDFile.vhd` with the VHD file's name and `OutputDirectory` with the directory where you want to extract the files.

For example, to extract the contents of the VHD to the current directory, you can use:

```bash
7z x YourVHDFile.vhd
```

This command will extract the files and directories from the VHD to the current working directory.
