make onionscan struct again and scan exportable function so whole package is library-able
This commit is contained in:
parent
d3d2adefdd
commit
23259d3698
5
main.go
5
main.go
|
@ -39,8 +39,9 @@ func main() {
|
||||||
log.SetOutput(ioutil.Discard)
|
log.SetOutput(ioutil.Discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
onionScanConfig := config.Configure(*torProxyAddress, *directoryDepth)
|
onionScan := new(OnionScan)
|
||||||
report, err := onionscan(onionScanConfig, hiddenService)
|
onionScan.Config = config.Configure(*torProxyAddress, *directoryDepth)
|
||||||
|
report, err := onionScan.Scan(hiddenService)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error running scanner: %s", err)
|
log.Fatalf("Error running scanner: %s", err)
|
||||||
|
|
20
onionscan.go
20
onionscan.go
|
@ -7,7 +7,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func onionscan(onionscanConfig *config.OnionscanConfig, hiddenService string) (*report.OnionScanReport, error) {
|
type OnionScan struct {
|
||||||
|
Config *config.OnionscanConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func (os *OnionScan) Scan(hiddenService string) (*report.OnionScanReport, error) {
|
||||||
|
|
||||||
// Remove Extra Prefix
|
// Remove Extra Prefix
|
||||||
// TODO: Add support for HTTPS?
|
// TODO: Add support for HTTPS?
|
||||||
|
@ -23,31 +27,31 @@ func onionscan(onionscanConfig *config.OnionscanConfig, hiddenService string) (*
|
||||||
|
|
||||||
// HTTP
|
// HTTP
|
||||||
hps := new(protocol.HTTPProtocolScanner)
|
hps := new(protocol.HTTPProtocolScanner)
|
||||||
hps.ScanProtocol(hiddenService, onionscanConfig, report)
|
hps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
// SSH
|
// SSH
|
||||||
sps := new(protocol.SSHProtocolScanner)
|
sps := new(protocol.SSHProtocolScanner)
|
||||||
sps.ScanProtocol(hiddenService, onionscanConfig, report)
|
sps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
// Ricochet
|
// Ricochet
|
||||||
rps := new(protocol.RicochetProtocolScanner)
|
rps := new(protocol.RicochetProtocolScanner)
|
||||||
rps.ScanProtocol(hiddenService, onionscanConfig, report)
|
rps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
// Bitcoin
|
// Bitcoin
|
||||||
bps := new(protocol.BitcoinProtocolScanner)
|
bps := new(protocol.BitcoinProtocolScanner)
|
||||||
bps.ScanProtocol(hiddenService, onionscanConfig, report)
|
bps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
//IRC
|
//IRC
|
||||||
ips := new(protocol.IRCProtocolScanner)
|
ips := new(protocol.IRCProtocolScanner)
|
||||||
ips.ScanProtocol(hiddenService, onionscanConfig, report)
|
ips.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
//FTP
|
//FTP
|
||||||
fps := new(protocol.FTPProtocolScanner)
|
fps := new(protocol.FTPProtocolScanner)
|
||||||
fps.ScanProtocol(hiddenService, onionscanConfig, report)
|
fps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
//SMTP
|
//SMTP
|
||||||
smps := new(protocol.SMTPProtocolScanner)
|
smps := new(protocol.SMTPProtocolScanner)
|
||||||
smps.ScanProtocol(hiddenService, onionscanConfig, report)
|
smps.ScanProtocol(hiddenService, os.Config, report)
|
||||||
|
|
||||||
return report, nil
|
return report, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue