Skip to content

Commit

Permalink
version v0.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cuhsat committed Jun 7, 2024
1 parent 423ba8c commit d29da75
Show file tree
Hide file tree
Showing 15 changed files with 714 additions and 60 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Forensic Artifacts Collecting Toolkit.
## Tools
- [fmount](docs/fmount.md)
- [fmount.dd](docs/fmount.dd.md)
- [fmount.vmdk](docs/fmount.vmdk.md)
- [fkey](docs/fkey.md)
- [ffind](docs/ffind.md)
- [flog](docs/flog.md)
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## FMount
- [x] Support for [BitLocker](https://learn.microsoft.com/en-us/windows/security/operating-system-security/data-protection/bitlocker/) partitions
- [ ] Support for [VMDK](https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc) images
- [x] Support for [VMDK](https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc) images


## FFind
Expand Down
127 changes: 127 additions & 0 deletions cmd/fmount.vmdk/main.go
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)
}
}
7 changes: 5 additions & 2 deletions cmd/fmount/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Usage:
//
// fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD] [-D DIR] IMAGE
// fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD|VMDK] [-D DIR] IMAGE
//
// The flags are:
//
Expand Down Expand Up @@ -43,6 +43,7 @@ import (
"github.com/cuhsat/fact/internal/sys"
"github.com/cuhsat/fact/pkg/fmount"
"github.com/cuhsat/fact/pkg/fmount/dd"
"github.com/cuhsat/fact/pkg/fmount/vmdk"
)

func main() {
Expand All @@ -68,7 +69,7 @@ func main() {
}

if *h || len(img) == 0 {
sys.Usage("fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD] [-D DIR] IMAGE")
sys.Usage("fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD|VMDK] [-D DIR] IMAGE")
}

it, err := fmount.DetectType(img, *T)
Expand Down Expand Up @@ -114,6 +115,8 @@ func main() {
args = append(args, img)

switch it {
case vmdk.VMDK:
fmount.Forward("fmount.vmdk", args...)
case dd.RAW, dd.DD:
fmount.Forward("fmount.dd", args...)
default:
Expand Down
3 changes: 2 additions & 1 deletion docs/fmount.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Mount forensic disk images for read-only processing.

```sh
# fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD] [-D DIR] IMAGE
# fmount [-suzqhv] [-H CRC32|MD5|SHA1|SHA256] [-V SUM] [-B KEY] [-T RAW|DD|VMDK] [-D DIR] IMAGE
```

Available options:
Expand All @@ -21,6 +21,7 @@ Available options:

Supported disk formats:

- [VMDK](https://forensics.wiki/vmware_virtual_disk_format_%28vmdk%29/)
- [DD (Raw)](https://forensics.wiki/raw_image_format/)

---
Expand Down
31 changes: 31 additions & 0 deletions docs/fmount.vmdk.md
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).
Loading

0 comments on commit d29da75

Please sign in to comment.