Alert user when you cannot connect on any port

This commit is contained in:
Nick Doiron 2016-05-23 15:38:10 +07:00
parent c5a87aa08d
commit 3324a6ec58
8 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package main
import (
"errors"
"fmt"
"github.com/s-rah/onionscan/config"
"github.com/s-rah/onionscan/protocol"
"github.com/s-rah/onionscan/report"
@ -53,5 +55,10 @@ func (os *OnionScan) Scan(hiddenService string) (*report.OnionScanReport, error)
smps := new(protocol.SMTPProtocolScanner)
smps.ScanProtocol(hiddenService, os.Config, report)
if !report.WebDetected && !report.SSHDetected && !report.RicochetDetected && !report.BitcoinDetected && !report.IRCDetected && !report.FTPDetected && !report.SMTPDetected {
fmt.Printf("Unable to connect to this Tor Hidden Service on any known protocol.\n")
return nil, errors.New("Unable to connect to this Tor Hidden Service on any known protocol.")
}
return report, nil
}

View File

@ -16,6 +16,7 @@ func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, onionscanC
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":8333")
if err != nil {
log.Printf("Failed to connect to service on port 8333\n")
report.BitcoinDetected = false
} else {
log.Printf("Detected possible Bitcoin instance\n")
// TODO: Actual Analysis

View File

@ -16,6 +16,7 @@ func (sps *FTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":21")
if err != nil {
log.Printf("Failed to connect to service on port 21\n")
report.FTPDetected = false
} else {
// TODO FTP Checking
report.FTPDetected = true

View File

@ -31,6 +31,8 @@ func (hps *HTTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConf
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":80")
if err != nil {
log.Printf("Failed to connect to service on port 80\n")
report.WebDetected = false
return
} else {
log.Printf("Found potential service on http(80)\n")
report.WebDetected = true

View File

@ -16,6 +16,7 @@ func (rps *IRCProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":6667")
if err != nil {
log.Printf("Failed to connect to service on port 6667\n")
report.IRCDetected = false
} else {
log.Printf("Detected possible IRC instance\n")
// TODO: Actual Analysis

View File

@ -16,6 +16,7 @@ func (rps *RicochetProtocolScanner) ScanProtocol(hiddenService string, onionscan
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":9878")
if err != nil {
log.Printf("Failed to connect to service on port 9878\n")
report.RicochetDetected = false
} else {
log.Printf("Detected possible ricochet instance\n")
// TODO: Actual Analysis

View File

@ -16,6 +16,7 @@ func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConf
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":25")
if err != nil {
log.Printf("Failed to connect to service on port 25\n")
report.SMTPDetected = false
} else {
// TODO SMTP Checking
report.SMTPDetected = true

View File

@ -21,6 +21,7 @@ func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
conn, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":22")
if err != nil {
log.Printf("Failed to connect to service on port 22\n")
report.SSHDetected = false
} else {
// TODO SSH Checking
report.SSHDetected = true