diff --git a/go.mod b/go.mod index 8d53cc5..7cf457e 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.23.2 toolchain go1.23.3 require ( + github.com/billgraziano/dpapi v0.5.0 github.com/getlantern/systray v1.2.2 github.com/kardianos/service v1.2.2 github.com/mattn/go-sqlite3 v1.14.24 @@ -15,7 +16,7 @@ require ( ) require ( - github.com/billgraziano/dpapi v0.5.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect @@ -27,5 +28,6 @@ require ( github.com/kr/fs v0.1.0 // indirect github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/stretchr/testify v1.9.0 // indirect ) diff --git a/go.sum b/go.sum index c7dccf2..c54ff0a 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,9 @@ github.com/billgraziano/dpapi v0.5.0 h1:pcxA17vyjbDqYuxCFZbgL9tYIk2xgbRZjRaIbATwh+8= github.com/billgraziano/dpapi v0.5.0/go.mod h1:lmEcZjRfLCSbUTsRu8V2ti6Q17MvnKn3N9gQqzDdTh0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4= github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY= @@ -38,8 +39,9 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM= github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= diff --git a/internal/agent/sftp/filter.go b/internal/agent/sftp/filter.go index b4ff49d..12ba5bc 100644 --- a/internal/agent/sftp/filter.go +++ b/internal/agent/sftp/filter.go @@ -84,7 +84,6 @@ func compileExcludedPaths() []*regexp.Regexp { `AppData\Local\Microsoft\Windows\WebCache`, `AppData\Local\Microsoft\Windows Store`, `AppData\Local\Packages`, - `AppData\Local\Veritas`, `Application Data\Apple Computer\Mobile Sync`, `Application Data\Application Data**`, `Dropbox\Dropbox.exe.log`, @@ -95,7 +94,12 @@ func compileExcludedPaths() []*regexp.Regexp { `Google\Chrome\**LOCK**`, `Google\Chrome\**Current**`, `Google\Chrome\Safe Browsing**`, - `BraveSoftware\Brave-Browser`, + `BraveSoftware\Brave-Browser\User Data\Default\Cache`, + `BraveSoftware\Brave-Browser\User Data\Default\Cookies`, + `BraveSoftware\Brave-Browser\User Data\Default\Cookies-journal`, + `BraveSoftware\Brave-Browser\**LOCK**`, + `BraveSoftware\Brave-Browser\**Current**`, + `BraveSoftware\Brave-Browser\Safe Browsing**`, `iPhoto Library\iPod Photo Cache`, `cookies.sqlite-**`, `permissions.sqlite-**`, @@ -138,10 +142,5 @@ func (h *SftpHandler) skipFile(path string) bool { return true } - probablyLocked, err := inconsistentSize(path) - if err != nil || probablyLocked { - return true - } - return false } diff --git a/internal/agent/sftp/windows.go b/internal/agent/sftp/windows.go index 821f0f9..4a82512 100644 --- a/internal/agent/sftp/windows.go +++ b/internal/agent/sftp/windows.go @@ -58,28 +58,3 @@ func invalidAttributes(path string) (bool, error) { return false, nil } - -func inconsistentSize(path string) (bool, error) { - file, err := os.Open(path) - if err != nil { - return true, err - } - defer file.Close() - - si := &FileStandardInfo{} - err = windows.GetFileInformationByHandleEx(windows.Handle(file.Fd()), windows.FileStandardInfo, (*byte)(unsafe.Pointer(si)), uint32(unsafe.Sizeof(*si))) - if err != nil { - return true, err - } - - stat, err := os.Lstat(path) - if err != nil { - return true, err - } - - if si.EndOfFile == stat.Size() { - return false, nil - } - - return true, nil -} diff --git a/internal/backend/mount/mount.go b/internal/backend/mount/mount.go index 901dca9..0891b5d 100644 --- a/internal/backend/mount/mount.go +++ b/internal/backend/mount/mount.go @@ -51,6 +51,7 @@ func Mount(target *store.Target) (*AgentMount, error) { "mount", "--daemon", "--vfs-cache-mode", "minimal", + "--no-seek", "--read-only", "--uid", "0", "--gid", "0",