[
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n"
  },
  {
    "path": ".gitignore",
    "content": "\n.vs/vmdk/v15/.suo\n*.lock\n*.ide\n*.ide-shm\n*.ide-wal\nvmdk/obj/Debug/vmdk.csproj.CoreCompileInputs.cache\nvmdk/obj/Debug/vmdk.csproj.FileListAbsolute.txt\nvmdk/obj/Debug/vmdk.csprojAssemblyReference.cache\nvmdk/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache\nvmdk/obj/Release/vmdk.csproj.CopyComplete\nvmdk/obj/Release/vmdk.csproj.CoreCompileInputs.cache\nvmdk/obj/Release/vmdk.csproj.FileListAbsolute.txt\nvmdk/obj/Release/vmdk.csprojAssemblyReference.cache\nvmdk/obj/Release/vmdk.exe\nvmdk/obj/Release/vmdk.pdb\n"
  },
  {
    "path": "README.md",
    "content": "# vmdkReader\n.Net 4.0 Console App to read and extract files from vmdk images\n\nUses https://github.com/DiscUtils/DiscUtils lib to parse the vmdk images.\n\nUseful in cases where the vmdk is on the network and you only want to copy a single file instead of GBs (e.g ntds.dit), since it does not transfer the whole disk over the network.\n\n**Project uses:**\n* Quamotion.DiscUtils.Core\n* Quamotion.DiscUtils.Ntfs\n* Quamotion.DiscUtils.Streams\n* Quamotion.DiscUtils.Vmdk\n\nand ILMerge 3.0.29 & ILMerge.MSBuild.Task to bundle the required dlls. Generated file < 1024kb\n\n**Commands:**\n\ndir \n\n--source: The source of the vmdk drive. It can also accept SMB paths\n\n--directory: The directory you want to list from the vmdk disk. If not provided will default to root path\n\ncp - Will copy a file from the vmdk to the destination provided\n\n--source: The source of the vmdk drive. It can also accept SMB paths\n\n--file2copy: The file you want to copy from the vmdk disk\n\n--destination: The destination where to save the file\n\n\n**Examples:**\n\nvmdk.exe --command dir --source \\\\backupserver\\dc01\\dc01.vmdk --directory \\Windows\\System32\")\n\nvmdk.exe --command cp --source \\\\backupserver\\dc01\\dc01.vmdk --file2copy \\Windows\\System32\\calc.exe --destination C:\\users\\user\\Desktop\\calc.exe\n\n            \n**WARNING - tested only with specific vmdk/vhd images and network latencies. Use at your own risk!**\n\n**TODO**\n\nAdd support for filesystem detection\n\nAdd support for nfs / iSCSI\n"
  },
  {
    "path": "packages/ILMerge.3.0.29/build/ILMerge.props",
    "content": "﻿<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\n  <PropertyGroup>\n    <ILMergeConsolePath>$(MSBuildThisFileDirectory)..\\tools\\net452\\ILMerge.exe</ILMergeConsolePath>\n  </PropertyGroup>\n\n</Project>\n"
  },
  {
    "path": "packages/ILMerge.3.0.29/docs/ilmerge-manual.md",
    "content": "# ILMerge\n\nMichael Barnett<br/>\nResearch in Software Engineering (RiSE)<br/>\nMicrosoft Research<br/>\nCopyright &copy; Microsoft Corporation. All rights reserved.\n\n# 1. Introduction\n\nThis document describes the ILMerge utility which merges multiple .NET assemblies into a single assembly. However, some .NET assemblies may not be able to be merged because they may contain features such as unmanaged code. I would highly recommend using peverify (the .NET Framework SDK tool) on the output of ILMerge to guarantee that the output is verifiable and will load in the .NET runtime.\n\nILMerge is packaged as a console application. But all of its functionality is also accessible programmatically. Note that Visual Studio **does** allow one to add an executable as a reference, so you can write a client that uses ILMerge as a library.\n\nILMerge takes a set of _input assemblies_ and merges them into one _target assembly_. The first assembly in the list of input assemblies is the _primary assembly_. When the primary assembly is an executable, then the target assembly is created as an executable with the same entry point as the primary assembly. Also, if the primary assembly has a strong name, and a .snk file is provided, then the target assembly is re-signed with the specified key so that it also has a strong name.\n\nNote that anything that depended upon any of the names of the input assemblies, e.g., configuration files, must be updated to refer instead to the name of the target assembly.\n\nAny Win32 Resources in the primary assembly are copied over into the target assembly.\n\nThere are many options that control the behavior of ILMerge. These are described in the next section.\n\n# 2. Public Interface\n\nThe public interface for ILMerge is defined in the ILMerging namespace as the class ILMerge.\n\n```csharp\nnamespace ILMerging\n{\n    public class ILMerge { }\n}\n```\n\nTo use this class programmatically, just create an instance using the default (nullary) constructor. There are several properties and methods which are used to affect the behavior of the merging. The method `Merge()` is called to actually perform the merging.\n\n## 2.1 AllowDuplicateType\n\n```csharp\npublic void AllowDuplicateType(string typeName);\n```\n\nThe normal behavior of ILMerge is to not allow there to be more than one public type with the same name. If such a duplicate is found, then an exception is thrown. However, ILMerge can just rename the type so that it no longer causes a conflict. For private types, this is not a problem since no outside client can see it anyway, so ILMerge just does the renaming by default. For public types, it is not often a useful feature to have it renamed. However, there are situations where it is needed. In particular, for obfuscated assemblies, it seems that the obfuscator defines an attribute and creates an assembly-level attribute for the obfuscated assembly using that attribute. This would mean that obfuscated assemblies cannot be merged.\n\nSo this option allows the user to either allow all public types to be renamed when they are duplicates, or to specify it for arbitrary type names. On the command line, there can be as many options as desired, if followed by a colon and a type name, otherwise just specify it alone with no colon (and type name) to allow all duplicates.\n\nWhen used through the API, an argument of &quot;null&quot; means to allow all public types to be renamed.\n\n**Default:** no duplicates of public types allowed\n\n**Command line option:** `[/allowDup[:typeName]]*`\n\n## 2.2 AllowMultipleAssemblyLevelAttributes\n\n```csharp\npublic bool AllowMultipleAssemblyLevelAttributes { get; set; }\n```\n\nWhen this is set before calling Merge, then if the CopyAttributes property (Section 2.7) is also set, any assembly-level attributes names that have the same type are copied over into the target directory as long as the definition of the attribute type specifies that &quot;AllowMultiple&quot; is true.\n\n**Default:** `false`\n\n**Command line option:** `/allowMultiple`\n\n## 2.3 AllowWildCards\n\n```csharp\npublic bool AllowWildCards { get; set; }\n```\n\nWhen this is set before calling Merge, any wild cards in file names are expanded and all matching files will be used as input. Note that because the wild card matching is done by a call to Directory.GetFiles, it does not allow the characters &quot;..&quot; to appear in a file name. So if you want to specify a relative path containing &quot;..&quot; to move up a directory, you will have to use it with the &quot;/lib&quot; option (Section 2.20). That option does allow the use of &quot;..&quot; to move up directories.\n\n**Default:** `false`\n\n**Command line option:** `/wildcards`\n\n## 2.4 AllowZeroPeKind\n\n```csharp\npublic bool AllowZeroPeKind { get; set; }\n```\n\nWhen this is set before calling Merge, then if an assembly&#39;s PeKind flag (this is the value of the field listed as .corflags in the Manifest) is zero it will be treated as if it was ILonly. This can be used to allow C++ assemblies to be merged; it does not appear that the C++ compiler writes the value as ILonly. However, if such an assembly has any non-IL features, then they will probably not be copied over into the target assembly correctly. So please use this option with caution.\n\n**Default:** `false`\n\n**Command line option:** `/zeroPeKind`\n\n## 2.5 AttributeFile\n\n```csharp\npublic string AttributeFile { get; set; }\n```\n\nIf this is set before calling Merge, then it specifies the path and filename to an _atttribute assembly_, an assembly that will be used to get all of the assembly-level attributes such as Culture, Version, etc. It will also be used to get the Win32 Resources from. It is mutually exclusive with the CopyAttributes property (Section 2.7). When it is not specified, then the Win32 Resources from the primary assembly are copied over into the target assembly. If it is not a full path, then the current directory is used.\n\n**Default:** `null`\n\n**Command line option:** `/attr:filename`\n\n## 2.6 Closed\n\n```csharp\npublic bool Closed { get; set; }\n```\n\nWhen this is set before calling Merge, then the &quot;transitive closure&quot; of the input assemblies is computed and added to the list of input assemblies. An assembly is considered part of the transitive closure if it is referenced, either directly or indirectly, from one of the originally specified input assemblies and it has an external reference to one of the input assemblies, or one of the assemblies that has such a reference. Complicated, but that is life...\n\n**Default:** `false`\n\n**Command line option:** `/closed`\n\n## 2.7 CopyAttributes\n\n```csharp\npublic bool CopyAttributes { get; set; }\n```\n\nWhen this is set before calling Merge, then the assembly level attributes of each input assembly are copied over into the target assembly. Any duplicate attribute overwrites a previously copied attribute. If you want to allow duplicates (for those attributes whose type specifies &quot;AllowMultiple&quot; in their definition), then you can also set the AllowMultipleAssemblyLevelAttributes (Section 2.2). The input assemblies are processed in the order they are specified. This option is mutually exclusive with specifying an attribute assembly, i.e., the property AttributeFile (Section 2.5). When an attribute assembly is specified, then no assembly-level attributes are copied over from the input assemblies.\n\n**Default:** `false`\n\n**Command line option:** `/copyattrs`\n\n## 2.8 DebugInfo\n\n```csharp\npublic bool DebugInfo { get; set; }\n```\n\nWhen this is set to true, ILMerge creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies.  If you do not want a .pdb file created for the output assembly, either set this property to false or else specify the /ndebug option at the command line.\n\n**Default:** `true`\n\n**Command line option:** `/ndebug`\n\n## 2.9 DelaySign\n\n```csharp\npublic bool DelaySign { get; set; }\n```\n\nWhen this is set before calling Merge, then the target assembly will be delay signed. This can be set only in conjunction with the `/keyfile` option (Section 2.13).\n\n**Default:** `false`\n\n## 2.10 ExcludeFile\n\n```csharp\npublic string ExcludeFile { get; set; }\n```\n\nThis property is used only in conjunction with the Internalize property (Section 2.12). When this is set before calling Merge, it indicates the path and filename that will be used to identify types that are not to have their visibility modified. If Internalize is true, but ExcludeFile is &quot;&quot;, then all types in any assembly other than the primary assembly are made non-public. Setting this property implicitly sets Internalize to true.\n\nThe contents of the file should be one regular expression per line. The syntax is that defined in the .NET namespace System.Text.RegularExpressions for regular expressions. The regular expressions are matched against each type&#39;s full name, e.g., &quot;System.Collections.IList&quot;. If the match fails, it is tried again with the assembly name (surrounded by square brackets) prepended to the type name. Thus, the pattern &quot;\\\\[A\\\\].\\\\\\*&quot; excludes all types in assembly A from being made non-public. (The backslashes are required because the string is treated as a regular expression.) The pattern &quot;N.T&quot; will match all types named T in the namespace named N no matter what assembly they are defined in.\n\nIt is important to note that the regular expressions are _not_ anchored to the beginning of the string; if this is desired, use the appropriate regular expression operator characters to do so.\n\n**Default:** &quot;&quot;\n\n**Command line option:** `/internalize[:excludeFile]`\n\n## 2.11 FileAlignment\n\n```csharp\npublic int FileAlignment { get; set; }\n```\n\nThis controls the file alignment used for the target assembly. The setter sets the value to the largest power of two that is no larger than the supplied argument, and is at least 512.\n\n**Default:** `512`\n\n**Command line option:** `/align:n`\n\n## 2.12 Internalize\n\n```csharp\npublic bool Internalize { get; set; }\n```\n\nThis controls whether types in assemblies _other than_ the primary assembly have their visibility modified. When it is true, then all non-exempt types that are visible outside of their assembly have their visibility modified so that they are not visible from outside of the merged assembly. A type is exempt if its _full name_ matches a line from the ExcludeFile (Section 2.10) using the .NET regular expression engine.\n\n**Default:** `false`\n\n**Command line option:** `/internalize[:excludeFile]`\n\n## 2.13 KeyFile\n\n```csharp\npublic string KeyFile { get; set; }\n```\n\nWhen this is set before calling Merge, it specifies the path and filename to a .snk file. The target assembly will be signed with its contents and will then have a strong name. It can be used with the DelaySign property (Section 2.9) to have the target assembly delay signed. This can be done even if the primary assembly was fully signed.\n\n**Default:** `null`\n\n**Command line option:** `/keyfile:filename`\n\n## 2.14 Log\n\n```csharp\npublic bool Log { get; set; }\n```\n\nWhen this is set before calling Merge, then log messages are written. It is used in conjunction with the LogFile property. If Log is true, but LogFile is null, then log messages are written to Console.Out. To specify this behavior on the command line, the option &quot;/log&quot; can be given without a log file.\n\n**Default:** `false`\n\n**Command line option:** `/log[:logfile]`\n\n## 2.15 LogFile\n\n```csharp\npublic string LogFile { get; set; }\n```\n\nWhen this is set before calling Merge, it indicates the path and filename that log messages are written to. If Log is true, but LogFile is null, then log messages are written to Console.Out.\n\n**Default:** `null`\n\n**Command line option:** `/log[:logfile]`\n\n## 2.16 Merge\n\n```csharp\npublic void Merge();\n```\n\nOnce all desired options are set, this method performs the actual merging.\n\n## 2.17 OutputFile\n\n```csharp\npublic string OutputFile { get; set; }\n```\n\nThis must be set before calling Merge. It specifies the path and filename that the target assembly will be written to.\n\n**Default:** `null`\n\n**Command line option:** `/out:filename`\n\n## 2.18 PublicKeyTokens\n\n```csharp\npublic bool PublicKeyTokens { get; set; }\n```\n\nThis must be set before calling Merge. It indicates whether external assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true).\n\n**Default:** `true`\n\n**Command line option:** `/useFullPublicKeyForReferences`\n\n## 2.19 SetInputAssemblies\n\n```csharp\npublic void SetInputAssemblies(string[] assems);\n```\n\nWhen used programmatically, each element of the array should contain the path and filename of an input assembly. The first element of the array is considered to be the primary assembly.\n\n## 2.20 SetSearchDirectories\n\n```csharp\npublic void SetSearchDirectories(string[] dirs);\n```\n\nIf specified, this sets the directories to be used to search for input assemblies. When used programmatically, each element of the array should contain a directory name. When specified on the command line, use a separate &quot;/lib&quot; option for each directory.\n\n**Command line option:** `/lib:directory`\n\n## 2.21 SetTargetPlatform\n\n```csharp\npublic void SetTargetPlatform(string platform, string dir);\n```\n\nThis method sets the .NET Framework for the target assembly to be the one specified by platform. Valid strings for the first argument are `v1`, `v1.1`, `v2`, and `v4`;. The `v` is case insensitive and is also optional. This way ILMerge can be used to &quot;cross-compile&quot;, i.e., it can run in one version of the framework and generate the target assembly so it will run under a different assembly. The second argument is the directory in which `mscorlib.dll` is to be found.\n\n**Command line option:** `/targetplatform:version,platformdirectory`\n\n## 2.22 StrongNameLost\n\n```csharp\npublic bool StrongNameLost { get; }\n```\n\nOnce merging is complete, this property is true if and only if the primary assembly had a strong name, but the target assembly does not. This can occur when an .snk file is not specified, or if something goes wrong trying to read its contents.\n\n## 2.23 TargetKind\n\n```csharp\npublic ILMerge.Kind { get; set; }\n```\n\nThis controls whether the target assembly is created as a library, a console application or as a Windows application. When it is not specified, then the target assembly will be the same kind as that of the primary assembly. (In that case, the file extensions found on the specified target assembly and the primary assembly must match.) When it is specified, then the file extension of the target assembly must match the specification.\n\nThe possible values are `ILMerge.Kind.{Dll, Exe, WinExe}`\n\n**Default:** `ILMerge.Kind.SameAsPrimaryAssembly`\n\n**Command line option:** `/target:(library|exe|winexe)`\n\n## 2.24 UnionMerge\n\n```csharp\npublic bool { get; set; }\n```\n\nWhen this is true, then types with the same name are all merged into a single type in the target assembly. The single type is the union of all of the individual types in the input assemblies: it contains all of the members from each of the corresponding types in the input assemblies. It cannot be specified at the same time as `/allowDup`.\n\n**Default:** `false`\n\n**Command line option:** `/union`\n\n## 2.25 Version\n\n```csharp\npublic System.Version Version { get; set; }\n```\n\nWhen this has a non-null value, then the target assembly will be given its value as the version number of the assembly. When specified on the command line, the version is read in as a string and should look like &quot;6.2.1.3&quot; (but without the quote marks). The version must be a valid assembly version as defined by the attribute AssemblyVersion in the System.Reflection namespace.\n\n**Default:** `null`\n\n**Command line option:** `/ver:version`\n\n## 2.26 XmlDocumentation\n\n```csharp\npublic bool XmlDocumentation { get; set; }\n```\n\nThis property controls whether XML documentation files are merged to produce an XML documentation file for the target assembly.\n\n**Default:** `false`\n\n**Command line option:** `/xmldocs`\n\n# 3 Command Line Usage\n\nThe full command line for ILMerge is:\n\n```\nilmerge [/lib:directory]* [/log[:filename]] [/keyfile:filename [/delaysign]] [/internalize[:filename]]\n[/t[arget]:(library|exe|winexe)] [/closed] [/ndebug] [/ver:version] [/copyattrs [/allowMultiple]]\n[/xmldocs] [/attr:filename] ([/targetplatform:<version>[,<platformdir>]]|v1|v1.1|v2|v4)\n[/useFullPublicKeyForReferences] [/zeroPeKind] [/wildcards] [/allowDup[:typename]]*\n[/allowDuplicateResources] [/union] [/align:n]\n/out:filename <primary assembly> [<other assemblies>...]\n```\n\n All options that take arguments can use either `:` or `=` as a separator. Options can be in any order, but all of the options must precede the list of input assemblies.\n\n# 4 Troubleshooting\n\n## 4.1 Input assembly not merged in correctly\n\nA common problem is that after merging some assemblies, you get an error message stating that an input assembly was not merged in correctly because it is still listed as an external reference in the merged assembly. The most common cause of this problem is that one of the input assemblies, B, has an external reference to the incorrectly merged assembly, A, and also an external reference to another assembly, C, that itself has an external reference to A. Suppose the reference to C is to a method that takes an argument whose type is defined in A. Then the type signature of the method call to the method in C still refers to the type from A even in the merged assembly. After all, ILMerge cannot go and modify the assembly C so that it now depends on the type as it is defined in the output assembly after it has been merged!\n\nThe solution is to use the closed option (Section 2.6) to have ILMerge compute the transitive closure of the input assemblies to prevent this kind of &quot;dangling reference&quot;. In the example, that would result in all three assemblies A, B, and C, being merged. There is no way to merge just A and B without there still being an external reference to A.\n\n## 4.2 Merged assembly causes a runtime error (not present in the unmerged assemblies)\n\nThe most frequent cause of problems when executing the target assembly is that ILMerge has no way to merge resources. Therefore resources are just copied over from the input assemblies into the target assembly. If these resources encode references to types defined in the input assemblies, then at runtime your program may fail because the type returned from the resource does not match the type as it is defined in the target assembly. You may even see a message that &quot;type &#39;T&#39; cannot be converted to type &#39;T&#39;&quot;. This looks confusing because the messages do not show the assembly that each type is defined in. The actual error is that one type is defined in the input assembly while the other is defined in the target assembly.\n\nI do not know of any way to have ILMerge do the right thing in such cases. There is no general way to decode resources and change any type references they contain.\n\n# 5 Dependencies\n\nILMerge is a stand-alone assembly dependent only on the v4.0 .NET Framework. (It actually uses two other assemblies: the assembly that makes up CCI itself, `System.Compiler.dll`, and `AssemblyResolver.dll`, which provides a small component for finding and loading assemblies when requested by the CCI Reader. But those assemblies have been merged into ILMerge using ILMerge before it is distributed.)\n\n# 6 Acknowledgements\n\nWithout [Herman Venter](https://github.com/hermanventer), this tool could not have been written. Not only because it completely depends on CCI to provide the underlying functionality for reading, transforming, and writing IL, but because of all of his help and support.\n"
  },
  {
    "path": "packages/ILMerge.MSBuild.Task.1.0.7/build/ILMerge.MSBuild.Task.targets",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\n  <UsingTask AssemblyFile=\"$(MSBuildThisFileDirectory)..\\tools\\ILMerge.MsBuild.Task.dll\" TaskName=\"MergeTask\" />\n\n  <Target Name=\"MergeAssembly\" AfterTargets=\"CopyFilesToOutputDirectory\">\n\n    <ItemGroup>\n      <CopyLocalReferences Include=\"@(ReferencePath)\" Condition=\" '%(CopyLocal)' == 'true' \"/>\n      <DoNotCopyReferences Include=\"@(ReferencePath)\" Condition=\" '%(CopyLocal)' == 'false' \" />\n    </ItemGroup>\n\n    <MergeTask\n      SolutionDir=\"$(SolutionDir)\"\n      SolutionPath=\"$(SolutionPath)\"\n      ProjectDir=\"$(ProjectDir)\"\n      ProjectFileName=\"$(ProjectFileName)\"\n      ProjectPath=\"$(ProjectPath)\"\n      TargetDir=\"$(TargetDir)\"\n      TargetPath=\"$(TargetPath)\"\n      TargetFileName=\"$(TargetFileName)\"\n      InputAssemblies=\"@(CopyLocalReferences)\"\n      AdditionalLocations=\"@(DoNotCopyReferences->'%(rootdir)%(directory)')\"\n      TargetFrameworkVersion=\"$(TargetFrameworkVersion)\"\n      TargetArchitecture=\"$(Platform)\"\n      ILMergeConsolePath=\"$(ILMergeConsolePath)\"\n      KeyFile=\"$(AssemblyOriginatorKeyFile)\"      \n      ConfigurationFilePath=\"$(ProjectDir)ILMergeConfig.json\"\n      />\n\n  </Target>\n\n</Project>\n"
  },
  {
    "path": "vmdk/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.0\"/>\n    </startup>\n</configuration>\n"
  },
  {
    "path": "vmdk/Program.cs",
    "content": "﻿using System;\nusing System.IO;\nusing DiscUtils;\nusing DiscUtils.Ntfs;\nusing DiscUtils.Setup;\nusing System.Collections.Generic;\nusing System.Linq;\nusing DiscUtils.Vhd;\n\n\n\nnamespace vmdk\n{\n    class Program\n    {\n        public static string GetArgument(IEnumerable<string> args, string option)\n            => args.SkipWhile(i => i != option).Skip(1).Take(1).FirstOrDefault();\n        \n        static void Main(string[] args)\n        {\n            SetupHelper.RegisterAssembly(typeof(NtfsFileSystem).Assembly);\n            SetupHelper.RegisterAssembly(typeof(DiscUtils.Vmdk.Disk).Assembly);\n            SetupHelper.RegisterAssembly(typeof(VirtualDiskManager).Assembly);\n            SetupHelper.RegisterAssembly(typeof(VirtualDisk).Assembly);\n            SetupHelper.RegisterAssembly((typeof(DiscUtils.Vhd.Disk).Assembly));\n            \n            if (args.Length != 0 && !string.IsNullOrEmpty(GetArgument(args, \"--command\")))\n            {\n               \n                string command = GetArgument(args, \"--command\");\n                if (command.ToLower() == \"dir\" && GetArgument(args, \"--source\") != null)\n                {\n                    var diskimagepath = GetArgument(args, \"--source\");\n                    var directorypath = GetArgument(args, \"--directory\");\n                    try\n                    {\n                        GetDirListing(diskimagepath, directorypath);\n                    }\n                    catch (Exception ex)\n                    {\n                        Console.WriteLine(\"\\r\\n [!] An exception occured: {0}\", ex);\n                        throw;\n                    }\n\n                }\n                else if (command.ToLower() == \"cp\" && GetArgument(args, \"--source\") != null &&\n                         GetArgument(args, \"--file2copy\") != null && GetArgument(args, \"--destination\") != null)\n                {\n                    var diskimagepath = GetArgument(args, \"--source\");\n                    var filepath = GetArgument(args, \"--file2copy\");\n                    var destination = GetArgument(args, \"--destination\");\n\n                    try\n                    {\n                        GetFile(diskimagepath, filepath, destination);\n                    }\n                    catch (Exception ex)\n                    {\n                        Console.WriteLine(\"\\r\\n [!] An exception occured: {0}\", ex);\n                        throw;\n                    }\n                }\n                else\n                {\n                    GetHelp();\n                }\n            }\n            else\n            {\n                GetHelp();\n            }\n        }\n\n        public static void GetHelp()\n        {\n            Console.WriteLine(\"\\r\\nvVvVvVvVmMmMmMmMdDdDdDdDkKkKkKkK\");\n            Console.WriteLine(\"K   Virtual Disk mounter v0.1  K\");\n            Console.WriteLine(\"vVvVvVvVmMmMmMmMdDdDdDdDkKkKkKkK\");\n            Console.WriteLine(\"\\r\\n Usage:\");\n            Console.WriteLine(\"\\r\\n vmdkmounter.exe --command [command] [command arguments]:\");\n            Console.WriteLine(\"\\r\\n [?] Command: dir - Will output a dirlisting of the provided folder\\n\");\n            Console.WriteLine(\" --source: The source of the virtual disk. It can also accept SMB paths\");\n            Console.WriteLine(\n                \" --directory: The directory you want to list from the virtual disk. If not provided will default to root path\");\n            Console.WriteLine(\"\\r\\n [?] Command: cp - Will copy a file from the virtual disk to the destination provided\\n\");\n            Console.WriteLine(\"--source: The source of the virtual disk drive. It can also accept SMB paths\");\n            Console.WriteLine(\"--file2copy: The file you want to copy from the virtual disk \");\n            Console.WriteLine(\"--destination: The destination where to save the file\");\n            Console.WriteLine(\"\\r\\n [?] Examples:\\r\\n\");\n            Console.WriteLine(\n                \"vmdk.exe --command dir --source \\\\\\\\backupserver\\\\dc01\\\\dc01.vmdk --directory \\\\Windows\\\\System32\");\n            Console.WriteLine(\n                \"vmdk.exe --command cp --source \\\\\\\\backupserver\\\\dc01\\\\dc01.vmdk --file2copy \\\\Windows\\\\System32\\\\calc.exe --destination C:\\\\users\\\\user\\\\Desktop\\\\calc.exe\");\n\n        }\n\n        public static void GetDirListing(string DiskPath, string directory)\n        {\n            if (File.Exists(DiskPath))\n            {\n                try\n                {\n                    VolumeManager volMgr = new VolumeManager();\n                    VirtualDisk vhdx = VirtualDisk.OpenDisk(DiskPath, FileAccess.Read);\n                    volMgr.AddDisk(vhdx);\n                    VolumeInfo volInfo = null;\n                    if (vhdx.Partitions.Count > 1)\n                    {\n                        Console.WriteLine(\"\\r\\n[*] Target has more than one partition\\r\\n\");\n                        foreach (var physVol in volMgr.GetPhysicalVolumes())\n                        {\n                            Console.WriteLine(\"      Identity: \" + physVol.Identity);\n                            Console.WriteLine(\"          Type: \" + physVol.VolumeType);\n                            Console.WriteLine(\"       Disk Id: \" + physVol.DiskIdentity);\n                            Console.WriteLine(\"      Disk Sig: \" + physVol.DiskSignature.ToString(\"X8\"));\n                            Console.WriteLine(\"       Part Id: \" + physVol.PartitionIdentity);\n                            Console.WriteLine(\"        Length: \" + physVol.Length + \" bytes\");\n                            Console.WriteLine(\" Disk Geometry: \" + physVol.PhysicalGeometry);\n                            Console.WriteLine(\"  First Sector: \" + physVol.PhysicalStartSector);\n                            Console.WriteLine();\n                            if (!string.IsNullOrEmpty(physVol.Identity))\n                            {\n                                volInfo = volMgr.GetVolume(physVol.Identity);\n                            }\n\n                            using (NtfsFileSystem vhdbNtfs = new NtfsFileSystem(physVol.Partition.Open()))\n                            {\n                                if (vhdbNtfs.DirectoryExists(\"\\\\\\\\\" + directory))\n                                {\n                                    string[] filelist = vhdbNtfs.GetFiles(vhdbNtfs.Root.FullName + directory);\n                                    string[] dirlist = vhdbNtfs.GetDirectories(vhdbNtfs.Root.FullName + directory);\n\n                                    foreach (var file in filelist)\n                                    {\n                                        Console.WriteLine(\"[F] {0}  {1}\", file, vhdbNtfs.GetFileLength(file));\n                                    }\n\n                                    foreach (var dir in dirlist)\n                                    {\n                                        Console.WriteLine(\"[D] {0}\", dir);\n                                    }\n                                }\n                                else\n                                {\n                                    Console.WriteLine(\"\\r\\n[*] Directory does not exist in partition {0}\\r\\n\",\n                                        physVol.Identity);\n                                }\n                            }\n                        }\n                    }\n                    else //No partitions\n                    {\n                        Console.WriteLine(\"\\r\\n[*] Found only one partition\\r\\n\");\n                        Console.WriteLine(\"LOGICAL VOLUMES\");\n                        foreach (var logVol in volMgr.GetLogicalVolumes())\n                        {\n                            Console.WriteLine(\"      Identity: \" + logVol.Identity);\n                            Console.WriteLine(\"        Length: \" + logVol.Length + \" bytes\");\n                            Console.WriteLine(\" Disk Geometry: \" + logVol.PhysicalGeometry);\n                            Console.WriteLine(\"  First Sector: \" + logVol.PhysicalStartSector);\n                            Console.WriteLine();\n                        }\n\n                        using (NtfsFileSystem vhdbNtfs = new NtfsFileSystem(vhdx.Partitions[0].Open()))\n                        {\n                            if (vhdbNtfs.DirectoryExists(\"\\\\\\\\\" + directory))\n                            {\n                                string[] filelist = vhdbNtfs.GetFiles(vhdbNtfs.Root.FullName + directory);\n                                string[] dirlist = vhdbNtfs.GetDirectories(vhdbNtfs.Root.FullName + directory);\n\n\n                                foreach (var file in filelist)\n                                {\n                                    Console.WriteLine(\"[F] {0}  {1}\", file, vhdbNtfs.GetFileLength(file));\n                                }\n\n                                foreach (var dir in dirlist)\n                                {\n                                    Console.WriteLine(\"[D] {0}\", dir);\n                                }\n                            }\n                            else\n                            {\n                                Console.WriteLine(\"\\r\\n[*] Directory does not exist\");\n                            }\n                        }\n                    }\n                }\n                catch (Exception ex)\n                {\n                    Console.WriteLine(\"Exception {0}\", ex);\n                }\n            }\n        }\n\n     \n        public static void GetFile(string DiskPath, string FilePath, string DestinationFile)\n        {\n            if (File.Exists(DiskPath) && Directory.Exists(Path.GetDirectoryName(DestinationFile)))\n            {\n                if (Path.GetFileName(DestinationFile) == \"\")\n                {\n                    DestinationFile += Path.GetFileName(FilePath);\n                }\n\n                VolumeManager volMgr = new VolumeManager();\n                VirtualDisk disk = VirtualDisk.OpenDisk(DiskPath, FileAccess.Read);\n                volMgr.AddDisk(disk);\n                VolumeInfo volInfo = null;\n                if (disk.Partitions.Count > 1)\n                {\n                    Console.WriteLine(\"\\r\\n[*] Target has more than one partition\\r\\n\");\n                    foreach (var physVol in volMgr.GetPhysicalVolumes())\n                    {\n                        Console.WriteLine(\"      Identity: \" + physVol.Identity);\n                        Console.WriteLine(\"          Type: \" + physVol.VolumeType);\n                        Console.WriteLine(\"       Disk Id: \" + physVol.DiskIdentity);\n                        Console.WriteLine(\"      Disk Sig: \" + physVol.DiskSignature.ToString(\"X8\"));\n                        Console.WriteLine(\"       Part Id: \" + physVol.PartitionIdentity);\n                        Console.WriteLine(\"        Length: \" + physVol.Length + \" bytes\");\n                        Console.WriteLine(\" Disk Geometry: \" + physVol.PhysicalGeometry);\n                        Console.WriteLine(\"  First Sector: \" + physVol.PhysicalStartSector);\n                        Console.WriteLine();\n                        if (!string.IsNullOrEmpty(physVol.Identity))\n                        {\n                            volInfo = volMgr.GetVolume(physVol.Identity);\n                        }\n                        DiscUtils.FileSystemInfo fsInfo = FileSystemManager.DetectFileSystems(volInfo)[0];\n                        using (NtfsFileSystem diskntfs = new NtfsFileSystem(physVol.Partition.Open()))\n                        {\n                            if (diskntfs.FileExists(\"\\\\\\\\\" + FilePath))\n                            {\n                                long fileLength = diskntfs.GetFileLength(\"\\\\\\\\\" + FilePath);\n                                using (Stream bootStream = diskntfs.OpenFile(\"\\\\\\\\\" + FilePath, FileMode.Open,\n                                    FileAccess.Read))\n                                {\n                                    byte[] file = new byte[bootStream.Length];\n                                    int totalRead = 0;\n                                    while (totalRead < file.Length)\n                                    {\n                                        totalRead += bootStream.Read(file, totalRead, file.Length - totalRead);\n                                        FileStream fileStream =\n                                            File.Create(DestinationFile, (int) bootStream.Length);\n                                        bootStream.CopyTo(fileStream);\n                                        fileStream.Write(file, 0, (int) bootStream.Length);\n                                    }\n\n                                    long destinationLength = new FileInfo(DestinationFile).Length;\n                                    if (fileLength != destinationLength)\n                                    {\n                                        Console.WriteLine(\n                                            \"[!] Something went wrong. Source file has size {0} and destination file has size {1}\",\n                                            fileLength, destinationLength);\n                                    }\n                                    else\n                                    {\n                                        Console.WriteLine(\"\\r\\n[*] File {0} was successfully copied to {1}\",\n                                            FilePath, DestinationFile);\n                                    }\n                                }\n                            }\n                            else\n                            {\n                                Console.WriteLine(\"\\r\\n [!] File {0} can not be found\", FilePath);\n                            }\n                        }\n                    }\n                }\n                else\n                {\n                    foreach (var physVol in volMgr.GetPhysicalVolumes())\n                    {\n                        Console.WriteLine(\"      Identity: \" + physVol.Identity);\n                        Console.WriteLine(\"          Type: \" + physVol.VolumeType);\n                        Console.WriteLine(\"       Disk Id: \" + physVol.DiskIdentity);\n                        Console.WriteLine(\"      Disk Sig: \" + physVol.DiskSignature.ToString(\"X8\"));\n                        Console.WriteLine(\"       Part Id: \" + physVol.PartitionIdentity);\n                        Console.WriteLine(\"        Length: \" + physVol.Length + \" bytes\");\n                        Console.WriteLine(\" Disk Geometry: \" + physVol.PhysicalGeometry);\n                        Console.WriteLine(\"  First Sector: \" + physVol.PhysicalStartSector);\n                        Console.WriteLine();\n                        NtfsFileSystem diskntfs = new NtfsFileSystem(disk.Partitions[0].Open());\n                        if (diskntfs.FileExists(\"\\\\\\\\\" + FilePath))\n                        {\n                            long fileLength = diskntfs.GetFileLength(\"\\\\\\\\\" + FilePath);\n                            using (Stream bootStream =\n                                diskntfs.OpenFile(\"\\\\\\\\\" + FilePath, FileMode.Open, FileAccess.Read))\n                            {\n                                byte[] file = new byte[bootStream.Length];\n                                int totalRead = 0;\n                                while (totalRead < file.Length)\n                                {\n                                    totalRead += bootStream.Read(file, totalRead, file.Length - totalRead);\n                                    FileStream fileStream = File.Create(DestinationFile, (int) bootStream.Length);\n                                    bootStream.CopyTo(fileStream);\n                                    fileStream.Write(file, 0, (int) bootStream.Length);\n                                }\n                            }\n\n                            long destinationLength = new FileInfo(DestinationFile).Length;\n                            if (fileLength != destinationLength)\n                            {\n                                Console.WriteLine(\n                                    \"[!] Something went wrong. Source file has size {0} and destination file has size {1}\",\n                                    fileLength, destinationLength);\n                            }\n                            else\n                            {\n                                Console.WriteLine(\"\\r\\n[*] File {0} was successfully copied to {1}\", FilePath,\n                                    DestinationFile);\n                            }\n                        }\n                        else\n                        {\n                            Console.WriteLine(\"\\r\\n [!] File {0} can not be found\", FilePath);\n                        }\n                    }\n                }\n            }\n            else\n            {\n                Console.WriteLine(\n                    \"\\r\\n [!] The provided VMDK image does not exist / can not be accessed or the destination folder does not exist\");\n            }\n        }\n    }\n}\n\n\n   "
  },
  {
    "path": "vmdk/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"vmdk\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"vmdk\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2020\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible\n// to COM components.  If you need to access a type in this assembly from\n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"cb091f3a-bef5-4141-8729-3d69ea375203\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version\n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers\n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "vmdk/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"ILMerge\" version=\"3.0.29\" targetFramework=\"net40\" />\n  <package id=\"ILMerge.MSBuild.Task\" version=\"1.0.7\" targetFramework=\"net40\" />\n  <package id=\"Quamotion.DiscUtils.Core\" version=\"0.15.4\" targetFramework=\"net40\" />\n  <package id=\"Quamotion.DiscUtils.Ntfs\" version=\"0.15.4\" targetFramework=\"net40\" />\n  <package id=\"Quamotion.DiscUtils.Streams\" version=\"0.15.4\" targetFramework=\"net40\" />\n  <package id=\"Quamotion.DiscUtils.Vhd\" version=\"0.15.4\" targetFramework=\"net40\" />\n  <package id=\"Quamotion.DiscUtils.Vmdk\" version=\"0.15.4\" targetFramework=\"net40\" />\n</packages>"
  },
  {
    "path": "vmdk/vmdk.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"..\\packages\\ILMerge.3.0.29\\build\\ILMerge.props\" Condition=\"Exists('..\\packages\\ILMerge.3.0.29\\build\\ILMerge.props')\" />\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{CB091F3A-BEF5-4141-8729-3D69EA375203}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <RootNamespace>vmdk</RootNamespace>\n    <AssemblyName>vmdk</AssemblyName>\n    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\n    <Deterministic>true</Deterministic>\n    <NuGetPackageImportStamp>\n    </NuGetPackageImportStamp>\n    <TargetFrameworkProfile />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"DiscUtils.Core, Version=0.15.0.0, Culture=neutral, PublicKeyToken=5fa5b410cc9c6289, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Quamotion.DiscUtils.Core.0.15.4\\lib\\net40\\DiscUtils.Core.dll</HintPath>\n    </Reference>\n    <Reference Include=\"DiscUtils.Ntfs, Version=0.15.0.0, Culture=neutral, PublicKeyToken=5fa5b410cc9c6289, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Quamotion.DiscUtils.Ntfs.0.15.4\\lib\\net40\\DiscUtils.Ntfs.dll</HintPath>\n    </Reference>\n    <Reference Include=\"DiscUtils.Streams, Version=0.15.0.0, Culture=neutral, PublicKeyToken=5fa5b410cc9c6289, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Quamotion.DiscUtils.Streams.0.15.4\\lib\\net40\\DiscUtils.Streams.dll</HintPath>\n    </Reference>\n    <Reference Include=\"DiscUtils.Vhd, Version=0.15.0.0, Culture=neutral, PublicKeyToken=5fa5b410cc9c6289, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Quamotion.DiscUtils.Vhd.0.15.4\\lib\\net40\\DiscUtils.Vhd.dll</HintPath>\n    </Reference>\n    <Reference Include=\"DiscUtils.Vmdk, Version=0.15.0.0, Culture=neutral, PublicKeyToken=5fa5b410cc9c6289, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Quamotion.DiscUtils.Vmdk.0.15.4\\lib\\net40\\DiscUtils.Vmdk.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Program.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\" />\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\packages\\ILMerge.3.0.29\\build\\ILMerge.props')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\ILMerge.3.0.29\\build\\ILMerge.props'))\" />\n    <Error Condition=\"!Exists('..\\packages\\ILMerge.MSBuild.Task.1.0.7\\build\\ILMerge.MSBuild.Task.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\ILMerge.MSBuild.Task.1.0.7\\build\\ILMerge.MSBuild.Task.targets'))\" />\n  </Target>\n  <Import Project=\"..\\packages\\ILMerge.MSBuild.Task.1.0.7\\build\\ILMerge.MSBuild.Task.targets\" Condition=\"Exists('..\\packages\\ILMerge.MSBuild.Task.1.0.7\\build\\ILMerge.MSBuild.Task.targets')\" />\n</Project>"
  },
  {
    "path": "vmdk.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.902\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"vmdk\", \"vmdk\\vmdk.csproj\", \"{CB091F3A-BEF5-4141-8729-3D69EA375203}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{CB091F3A-BEF5-4141-8729-3D69EA375203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CB091F3A-BEF5-4141-8729-3D69EA375203}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CB091F3A-BEF5-4141-8729-3D69EA375203}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CB091F3A-BEF5-4141-8729-3D69EA375203}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {0FCB51A1-A1C2-4893-96EB-007D655CDD05}\n\tEndGlobalSection\nEndGlobal\n"
  }
]