Skip to content

v1.1.9

Choose a tag to compare

@selfup selfup released this 04 Mar 13:47
· 7 commits to master since this release
019962c

Thoughts

New mode: -m fff File Fingerprint Finder: search by SHA2-256 hash!

Example use:

$ known_hash="de4f51f97fa690026e225798ff294cd182b93847aaa46fe1e32b848eb9e985bd"
$ go run main.go -m fff -d $HOME/Documents -k $known_hash
/home/selfup/Documents//dotfiles/mac/.bash_profile

SHA2-256 seems pretty standard and collisions shouldn't be an issue for quite some time.

Caveat will always be that I skip files that cannot be read with current user permissions. I will not throw an error. This is by design. You should know your permissions and which files are going to be in scope.

Test on a decent amount of files

Some of the files in this directory are quite large so this "test" is not the best for speed but can be a good indicator of running sha256 on large files.

Out of the 48,588 files:

  • 133 are 10MB or more
  • 11 of the 133 are 100MB or more
scnnr (file-fingerprint-finder) $ go run main.go -m fsf -s 10MB -d $HOME/Documents/ | wc -l
133
scnnr (file-fingerprint-finder) $ go run main.go -m fsf -s 100MB -d $HOME/Documents/ | wc -l
11

Here's the fff run using time

scnnr (file-fingerprint-finder) $ go run main.go -d $HOME/Documents | wc -l
48588
scnnr (file-fingerprint-finder) $ time go run main.go -m fff -k de4f51f97fa690026e225798ff294cd182b93847aaa46fe1e32b848eb9e985bd -d $HOME/Documents/                                    
/home/selfup/Documents//dotfiles/mac/.bash_profile

real    0m24.897s
user    0m26.849s
sys     0m7.355s

Test on a large amount of files

Running this on a $HOME with 240k+ files:

scnnr (file-fingerprint-finder) $ go run main.go -d $HOME | wc -l
242948
scnnr (file-fingerprint-finder) $ go run main.go -m fsf -s 10MB -d $HOME | wc -l
227
scnnr (file-fingerprint-finder) $ go run main.go -m fsf -s 100MB -d $HOME | wc -l
20

Here is the result:

scnnr (file-fingerprint-finder) $ time go run main.go -m fff -k 93a2f45f1a1f2ebdc0cca3019d42aae9631c016b65e553c041865ff0c6692858 -d $HOME
/home/selfup/.tmux.conf

real    0m36.652s
user    1m6.782s
sys     0m17.100s

Scan multiple scoped dirs (instead of blasting from root (which you can do)) for filenames with fuzzy word search

scnnr -m fnf -f DEFCON,Finance,Tax,Return -p /tmp,/usr,/etc,$HOME/Documents

Scan for files above a certain size

scnnr -m fsf -s 100MB -d E:/LotsOfStuff

Scan for certain file extensions and scan each file for keywords inside the files

scnnr -d ./node_modules -e .js,.md,.ts -k password,token,auth,stuff,things,wow,lol,omg

Install

If you have Go

go install github.com/selfup/scnnr@latest

or build from source with a bash script:

./scripts/bins.sh

or build from source with go:

go run cmd/pack/main.go

If you do not have Go

Release Binaries

I have a GitLab Release Repo that builds the needed artifacts using GitLabCI

Direct Download Link

https://gitlab.com/selfup/scnnr/-/jobs/artifacts/master/download?job=release

cURL

curl -L https://gitlab.com/selfup/scnnr/-/jobs/artifacts/master/download?job=release > artifacts.zip

wget

wget https://gitlab.com/selfup/scnnr/-/jobs/artifacts/master/download?job=release -O artifacts.zip

the sha256 sum is provided in the artifact zip of the scnnr_bins.zip

you can also verify the provided sum matches the output in CI (output for verification)

  1. Unzip artifacts.zip
  2. Unzip scnnr_bins.zip

From here pick your arch (mac/windows/linux) and appropriate binary and move to needed path!

scnnr_bins/linux/intel:
scnnr

scnnr_bins/linux/arm:
scnnr

scnnr_bins/mac/intel:
scnnr

scnnr_bins/mac/arm:
scnnr

scnnr_bins/windows:
scnnr.exe

Docker

  1. Clone repo: git clone https://github.com/selfup/scnnr

  2. cd into repo

    • Shell: ./scripts/dind.build.sh
    • Powershell: ./scripts/dind.build.ps1
  3. Unzip scnnr_bins.zip

From here pick your arch (mac/windows/linux) and appropriate binary and move to needed path!

scnnr_bins/linux/intel:
scnnr

scnnr_bins/linux/arm:
scnnr

scnnr_bins/mac/intel:
scnnr

scnnr_bins/mac/arm:
scnnr

scnnr_bins/windows:
scnnr.exe