onionscan/onionscan.go

65 lines
1.6 KiB
Go
Raw Normal View History

2016-04-10 00:04:22 +00:00
package main
import (
"github.com/s-rah/onionscan/protocol"
2016-04-10 00:04:22 +00:00
"github.com/s-rah/onionscan/report"
"strings"
2016-04-10 00:04:22 +00:00
)
type OnionScan struct {
TorProxyAddress string
DirectoryDepth int
2016-04-10 00:04:22 +00:00
}
func Configure(torProxyAddress string, directoryDepth int) *OnionScan {
2016-04-10 00:04:22 +00:00
onionScan := new(OnionScan)
onionScan.TorProxyAddress = torProxyAddress
onionScan.DirectoryDepth = directoryDepth
2016-04-10 00:04:22 +00:00
return onionScan
}
func (os *OnionScan) Scan(hiddenService string) (*report.OnionScanReport, error) {
// Remove Extra Prefix
// TODO: Add support for HTTPS?
if strings.HasPrefix(hiddenService, "http://") {
hiddenService = hiddenService[7:]
}
2016-04-10 00:04:22 +00:00
if strings.HasSuffix(hiddenService, "/") {
hiddenService = hiddenService[0 : len(hiddenService)-1]
}
2016-04-10 00:04:22 +00:00
report := report.NewOnionScanReport(hiddenService)
// HTTP
hps := new(protocol.HTTPProtocolScanner)
hps.ScanProtocol(hiddenService, os.TorProxyAddress, os.DirectoryDepth, report)
// SSH
sps := new(protocol.SSHProtocolScanner)
sps.ScanProtocol(hiddenService, os.TorProxyAddress, report)
// Ricochet
rps := new(protocol.RicochetProtocolScanner)
rps.ScanProtocol(hiddenService, os.TorProxyAddress, report)
2016-04-10 00:04:22 +00:00
// Bitcoin
bps := new(protocol.BitcoinProtocolScanner)
bps.ScanProtocol(hiddenService, os.TorProxyAddress, report)
//IRC
ips := new(protocol.IRCProtocolScanner)
ips.ScanProtocol(hiddenService, os.TorProxyAddress, report)
//FTP
fps := new(protocol.FTPProtocolScanner)
fps.ScanProtocol(hiddenService, os.TorProxyAddress, report)
//SMTP
smps := new(protocol.SMTPProtocolScanner)
smps.ScanProtocol(hiddenService, os.TorProxyAddress, report)
2016-04-10 00:04:22 +00:00
return report, nil
}