2016-04-10 00:04:22 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
2016-04-25 09:29:27 +00:00
|
|
|
"github.com/s-rah/onionscan/report"
|
2016-04-10 00:04:22 +00:00
|
|
|
"io/ioutil"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
flag.Usage = func() {
|
|
|
|
fmt.Printf("Usage of %s:\n", os.Args[0])
|
|
|
|
fmt.Printf(" onionscan [flags] hiddenservice\n")
|
|
|
|
flag.PrintDefaults()
|
|
|
|
}
|
|
|
|
|
|
|
|
torProxyAddress := flag.String("torProxyAddress", "127.0.0.1:9050", "the address of the tor proxy to use")
|
|
|
|
simpleReport := flag.Bool("simpleReport", true, "print out a simple report detailing what is wrong and how to fix it, true by default")
|
2016-04-25 09:29:27 +00:00
|
|
|
reportFile := flag.String("reportFile", "", "the file destination path for report file")
|
2016-04-10 00:04:22 +00:00
|
|
|
jsonReport := flag.Bool("jsonReport", false, "print out a json report providing a detailed report of the scan.")
|
|
|
|
verbose := flag.Bool("verbose", false, "print out a verbose log output of the scan")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
if len(flag.Args()) != 1 {
|
|
|
|
flag.Usage()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
hiddenService := flag.Args()[0]
|
|
|
|
|
|
|
|
log.Printf("Starting Scan of %s\n", hiddenService)
|
|
|
|
log.Printf("This might take a few minutes..\n\n")
|
|
|
|
|
|
|
|
if !*verbose {
|
|
|
|
log.SetOutput(ioutil.Discard)
|
|
|
|
}
|
|
|
|
|
|
|
|
onionScan := Configure(*torProxyAddress)
|
2016-04-25 09:29:27 +00:00
|
|
|
scanReport, err := onionScan.Scan(hiddenService)
|
2016-04-10 00:04:22 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error running scanner: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if *jsonReport {
|
2016-04-25 09:29:27 +00:00
|
|
|
report.GenerateJsonReport(*reportFile, scanReport)
|
2016-04-10 00:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if *simpleReport {
|
2016-04-25 09:29:27 +00:00
|
|
|
report.GenerateSimpleReport(*reportFile, scanReport)
|
2016-04-10 00:04:22 +00:00
|
|
|
}
|
|
|
|
}
|