s-rah / onionscan

OnionScan is a free and open source tool for investigating the Dark Web.
https://twitter.com/OnionScan
Other
2.89k stars 599 forks source link

Cannot access Correlation Lab's Web UI unless `onionscan` is run from specific directory #138

Open fabacab opened 7 years ago

fabacab commented 7 years ago

I wanted to try the Correlation Lab for the first time today so I fired up OnionScan and was met with a "Connection reset" page in my browser when I attempted to load its pages. Turns out this happens because, at least on my (macOS 10.10.x) system, the Go routines couldn't find the HTML template files. Details:

Steps to reproduce:

port install go # I'm using MacPorts's Go.
go version # go1.8.3 darwin/amd64
go get github.com/s-rah/onionscan
cd ~/go/bin/ # This is where the `onionscan` binary is installed.
# Perform some scans so that `./onionscandb` is created.
# Later, when I wanted to try out the Correlation Lab:
cd ~/go/bin
./onionscan & # This starts the Web UI, no errors.
# But! Sending an HTTP request for the Correlation Lab's Web UI fails:
curl localhost:8080 # <-- This produces error output.

The error output is:

2017/08/22 23:38:12 http: panic serving 127.0.0.1:63158: open templates/index.html: no such file or directory
goroutine 6 [running]:
net/http.(*conn).serve.func1(0xc4200d9180)
        /opt/local/lib/go/src/net/http/server.go:1721 +0xd0
panic(0x142f800, 0xc42001d260)
        /opt/local/lib/go/src/runtime/panic.go:489 +0x2cf
html/template.Must(0x0, 0x169e8e0, 0xc42001d260, 0x0)
        /opt/local/lib/go/src/html/template/template.go:360 +0x54
github.com/s-rah/onionscan/webui.(*WebUI).Index(0xc42012e900, 0x16a3920, 0xc42011a0e0, 0xc42000a900)
        /Users/demouser/go/src/github.com/s-rah/onionscan/webui/webui.go:424 +0x2b66
github.com/s-rah/onionscan/webui.(*WebUI).Index-fm(0x16a3920, 0xc42011a0e0, 0xc42000a900)
        /Users/demouser/go/src/github.com/s-rah/onionscan/webui/webui.go:439 +0x48
net/http.HandlerFunc.ServeHTTP(0xc42012c6a0, 0x16a3920, 0xc42011a0e0, 0xc42000a900)
        /opt/local/lib/go/src/net/http/server.go:1942 +0x44
net/http.(*ServeMux).ServeHTTP(0x16d83a0, 0x16a3920, 0xc42011a0e0, 0xc42000a900)
        /opt/local/lib/go/src/net/http/server.go:2238 +0x130
net/http.serverHandler.ServeHTTP(0xc4200a38c0, 0x16a3920, 0xc42011a0e0, 0xc42000a900)
        /opt/local/lib/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc4200d9180, 0x16a40e0, 0xc42012b600)
        /opt/local/lib/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
        /opt/local/lib/go/src/net/http/server.go:2668 +0x2ce
curl: (52) Empty reply from server

Expected results: OnionScan Correlation Lab returns HTML content regardless of which current working directory it was onionscan was invoked from.

Actual results: OnionScan prints an error indicating that templates/index.html could not be found; the browser shows a "Connection reset" error page.

Workaround:

As a workaround, I ended up looking for the template file with find ~/go -name 'index.html' -print | grep onionscan | grep templates and finding ~/go/src/github.com/s-rah/onionscan/templates/index.html. So I cd ~/go/src/github.com/s-rah/onionscan/; ~/go/bin/onionscan --mode analysis --dbdir ~/go/bin/onionscandb & and this allowed me access to the Correlation Lab's Web UI.

Maybe the paths to the Web UI need some tweaking? Might be related or worth working on in conjunction with #127?