cryptostalker icon indicating copy to clipboard operation
cryptostalker copied to clipboard

Trying to Diagnose Error on Raspberry Pi Centos 7

Open eilifmRS opened this issue 7 years ago • 3 comments

[root@rpi3-01 ~]# $GOBIN/cryptostalker --path=/tmp/ --count 1
panic: runtime error: index out of range

goroutine 38 [running]:
github.com/unixist/randumb.Skewness.func2(0x104f6068, 0x17c50c, 0x0, 0x0, 0x104f6080)
        /root/workspace.29729/src/github.com/unixist/randumb/entropy.go:39 +0x64
created by github.com/unixist/randumb.Skewness
        /root/workspace.29729/src/github.com/unixist/randumb/entropy.go:41 +0x24c

eilifmRS avatar Jun 22 '18 23:06 eilifmRS

Thanks for the bug report, Eilif! I haven't tested cryptostalker on a Raspberry Pi.

It's possible that the file is empty because it's not populated or it's truncated, causing the data read to be zero-bytes long. https://github.com/unixist/cryptostalker/blob/master/cryptostalker.go#L85

There should probably be a sanity check that []data is not empty: https://github.com/unixist/randumb/blob/master/entropy.go#L59. This should be fixed either way.

Can you try adding this as the first few lines in entropy.go:IsRandom?

if len(data) == 0 {
    return false
}

If that fixes your problem, we can move on to see whether the tool works on an RPI.

unixist avatar Jun 29 '18 23:06 unixist

I had a similar issue on a NAS:

# ./cryptostalker --path /share/Public
panic: runtime error: index out of range [-1]

goroutine 23 [running]:
github.com/unixist/randumb.median(...)
        /home/user/go/src/github.com/unixist/randumb/util.go:29
github.com/unixist/randumb.Skewness.func2(0x82182d8, 0x0, 0x0, 0x85dc030, 0x85dc040)
        /home/user/go/src/github.com/unixist/randumb/entropy.go:39 +0x5c
created by github.com/unixist/randumb.Skewness
        /home/user/go/src/github.com/unixist/randumb/entropy.go:38 +0x23f

and adding the check to entropy.go fixed it.

virtualdj avatar Nov 08 '21 19:11 virtualdj

Good to hear! Would you mind sending a PR?

unixist avatar Nov 08 '21 21:11 unixist