mirror of
https://github.com/Velocidex/velociraptor.git
synced 2026-10-12 02:09:59 +00:00
Refactor code to pass OSPath into VQL functions. Fixed bug in escaping the paths in the collector accessor.
28 lines
622 B
Go
28 lines
622 B
Go
package accessors
|
|
|
|
import "fmt"
|
|
|
|
func ParsePath(path, path_type string) (res *OSPath, err error) {
|
|
switch path_type {
|
|
case "linux":
|
|
res, err = NewLinuxOSPath(path)
|
|
case "windows":
|
|
res, err = NewWindowsOSPath(path)
|
|
case "registry":
|
|
res, err = NewWindowsRegistryPath(path)
|
|
case "ntfs":
|
|
res, err = NewWindowsNTFSPath(path)
|
|
case "", "generic":
|
|
res, err = NewGenericOSPath(path)
|
|
case "pathspec":
|
|
res, err = NewPathspecOSPath(path)
|
|
|
|
case "zip":
|
|
res, err = NewZipFilePath(path)
|
|
|
|
default:
|
|
err = fmt.Errorf("Unknown path type: %v (should be one of windows,linux,generic)", path_type)
|
|
}
|
|
return res, err
|
|
}
|