go-vss
This projects adds bindings for libvshadow for Go for macos, linux and windows systems.
go-vss parses a raw VSS file into a NTFS file system.
Usage
In general, there are different ways to load a raw vss filesystem:
- Using a go reader object
- Using a file descriptor
- Using a path
Make sure, you have installed the package:
go get github.com/forensicanalysis/go-vss
Using a go reader object
package main
import (
"fmt"
"os"
"github.com/forensicanalysis/go-vss"
)
func main() {
reader, err := os.Open("vss.raw")
stores, err := vss.NewByReader(reader)
for _, fs := range stores {
root, _ := fs.Open("/")
filenames, _ := root.Readdirnames(0)
fmt.Println(filenames)
}
}
Using a file descriptor
package main
import (
"fmt"
"syscall"
"github.com/forensicanalysis/go-vss"
)
func main() {
fd, err := syscall.Open(path, syscall.O_RDONLY|syscall.O_CLOEXEC, 755)
stores, err := vss.NewByFd(fd)
for _, fs := range stores {
root, _ := fs.Open("/")
filenames, _ := root.Readdirnames(0)
fmt.Println(filenames)
}
}
Using a path
package main
import (
"fmt"
"github.com/forensicanalysis/go-vss"
)
func main() {
path := "vss.raw"
stores, err := vss.NewByPath(path)
for _, fs := range stores {
root, _ := fs.Open("/")
filenames, _ := root.Readdirnames(0)
fmt.Println(filenames)
}
}
Updating libvshadow
This project builds upon the libvshadow created by Joachim Metz. The prebuild static libraries of libvshadow are placed in the subfolders libvshadow_prebuild\windows, libvshadow_prebuild\darwin and libvshadow_prebuild\linux.
The current version used in the project is: 20191221
If you need to update the library use the following instructions to build new static libraries:
- Download the required
libvshadow-[new-version].tar.gz from the relases.
- Remove the current
libvshadow-[old-version].tar.gz and place the new libvshadow-[new-version].tar.gz into the root directory of the repository.
- Adjust the
Makefile and .github/workflows: Make sure to update the version numbers in order to use the updated libvshadow-[new-version].tar.gz.
- Commit and push the directory. Github actions creates artifacts containing the static libraries. Once all actions succeeded, you can download the static libvshadow libraries for each operating system: macos, linux and windows.
- Extract the static libs (all of them are called libvshadow.a) to the correct destination:
- libvshadow_windows ->
libvshadow_prebuild\windows
- libvshadow_macos ->
libvshadow_prebuild\macos
- libvshadow_linux ->
libvshadow_prebuild\linux