-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
714 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
// Mount forensic VMDK disk images for read-only processing. | ||
// | ||
// Usage: | ||
// | ||
// fmount.vmdk [-fsuzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-D DIR] IMAGE | ||
// | ||
// The flags are: | ||
// | ||
// -D directory | ||
// The mount point directory. | ||
// -B key | ||
// The BitLocker key. | ||
// -H algorithm | ||
// The hash algorithm to use. | ||
// -V sum | ||
// The hash sum to verify. | ||
// -f | ||
// Force type (bypass check). | ||
// -s | ||
// System partition only. | ||
// -u | ||
// Unmount image. | ||
// -z | ||
// Unzip image. | ||
// -q | ||
// Quiet mode. | ||
// -h | ||
// Show usage. | ||
// -v | ||
// Show version. | ||
// | ||
// The arguments are: | ||
// | ||
// image | ||
// The disk images filename. | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"io" | ||
|
||
"github.com/cuhsat/fact/internal/fact" | ||
"github.com/cuhsat/fact/internal/sys" | ||
"github.com/cuhsat/fact/pkg/fmount" | ||
"github.com/cuhsat/fact/pkg/fmount/vmdk" | ||
) | ||
|
||
func main() { | ||
D := flag.String("D", "", "Mount point") | ||
B := flag.String("B", "", "BitLocker key") | ||
H := flag.String("H", "", "Hash algorithm") | ||
V := flag.String("V", "", "Hash sum") | ||
f := flag.Bool("f", false, "Force mounting") | ||
s := flag.Bool("s", false, "System partition only") | ||
u := flag.Bool("u", false, "Unmount image") | ||
z := flag.Bool("z", false, "Unzip image") | ||
q := flag.Bool("q", false, "Quiet mode") | ||
h := flag.Bool("h", false, "Show usage") | ||
v := flag.Bool("v", false, "Show version") | ||
|
||
flag.CommandLine.SetOutput(io.Discard) | ||
flag.Parse() | ||
|
||
img := sys.Arg() | ||
|
||
if *v { | ||
sys.Final("fmount.vmdk", fact.Version) | ||
} | ||
|
||
if *h || len(img) == 0 { | ||
sys.Usage("fmount.vmdk [-fsuzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-D DIR] IMAGE") | ||
} | ||
|
||
if *q { | ||
sys.Progress = nil | ||
} | ||
|
||
if *z { | ||
ex, err := fmount.Extract(img) | ||
|
||
if err != nil { | ||
sys.Fatal(err) | ||
} else { | ||
img = ex | ||
} | ||
} | ||
|
||
if (len(*H) == 0) != (len(*V) == 0) { | ||
sys.Fatal("hash algorithm and sum are required") | ||
} | ||
|
||
if len(*H) > 0 && len(*V) > 0 { | ||
ok, err := fmount.Verify(img, *H, *V) | ||
|
||
if err != nil { | ||
sys.Fatal(err) | ||
} | ||
|
||
if !ok { | ||
sys.Fatal("hash sum does not match") | ||
} | ||
} | ||
|
||
if !*f { | ||
is, err := vmdk.Is(img) | ||
|
||
if err != nil { | ||
sys.Fatal(err) | ||
} | ||
|
||
if !is { | ||
sys.Fatal("image type not supported") | ||
} | ||
} | ||
|
||
var err error | ||
|
||
if *u { | ||
err = vmdk.Unmount(img) | ||
} else { | ||
_, err = vmdk.Mount(img, *D, *B, *s) | ||
} | ||
|
||
if err != nil { | ||
sys.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# fmount.vmdk | ||
Mount forensic [VMDK](https://forensics.wiki/vmware_virtual_disk_format_%28vmdk%29/) disk images for read-only processing. | ||
|
||
```sh | ||
# fmount.vmdk [-fsuzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-D DIR] IMAGE | ||
``` | ||
|
||
Available options: | ||
|
||
- `-D` Mount point | ||
- `-B` BitLocker key | ||
- `-H` Hash algorithm | ||
- `-V` Verify hash sum | ||
- `-f` Force type | ||
- `-s` System partition only | ||
- `-u` Unmount image | ||
- `-z` Unzip image | ||
- `-q` Quiet mode | ||
- `-h` Show usage | ||
- `-v` Show version | ||
|
||
Required system commands: | ||
|
||
- [dislocker](https://github.com/Aorimn/dislocker) | ||
- [qemu-nbd](https://www.qemu.org/docs/master/tools/qemu-nbd.html) | ||
- [lsblk](https://man7.org/linux/man-pages/man8/lsblk.8.html) | ||
- [mount](https://man7.org/linux/man-pages/man8/mount.8.html) | ||
- [umount](https://man7.org/linux/man-pages/man8/umount.8.html) | ||
|
||
--- | ||
Part of the [Forensic Artifacts Collecting Toolkit](../README.md). |
Oops, something went wrong.