Alert user when you cannot connect on any port
This commit is contained in:
parent
c5a87aa08d
commit
3324a6ec58
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/s-rah/onionscan/config"
|
"github.com/s-rah/onionscan/config"
|
||||||
"github.com/s-rah/onionscan/protocol"
|
"github.com/s-rah/onionscan/protocol"
|
||||||
"github.com/s-rah/onionscan/report"
|
"github.com/s-rah/onionscan/report"
|
||||||
|
@ -53,5 +55,10 @@ func (os *OnionScan) Scan(hiddenService string) (*report.OnionScanReport, error)
|
||||||
smps := new(protocol.SMTPProtocolScanner)
|
smps := new(protocol.SMTPProtocolScanner)
|
||||||
smps.ScanProtocol(hiddenService, os.Config, report)
|
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
|
return report, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, onionscanC
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":8333")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":8333")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 8333\n")
|
log.Printf("Failed to connect to service on port 8333\n")
|
||||||
|
report.BitcoinDetected = false
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Detected possible Bitcoin instance\n")
|
log.Printf("Detected possible Bitcoin instance\n")
|
||||||
// TODO: Actual Analysis
|
// TODO: Actual Analysis
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (sps *FTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":21")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":21")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 21\n")
|
log.Printf("Failed to connect to service on port 21\n")
|
||||||
|
report.FTPDetected = false
|
||||||
} else {
|
} else {
|
||||||
// TODO FTP Checking
|
// TODO FTP Checking
|
||||||
report.FTPDetected = true
|
report.FTPDetected = true
|
||||||
|
|
|
@ -31,6 +31,8 @@ func (hps *HTTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConf
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":80")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":80")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 80\n")
|
log.Printf("Failed to connect to service on port 80\n")
|
||||||
|
report.WebDetected = false
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Found potential service on http(80)\n")
|
log.Printf("Found potential service on http(80)\n")
|
||||||
report.WebDetected = true
|
report.WebDetected = true
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (rps *IRCProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":6667")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":6667")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 6667\n")
|
log.Printf("Failed to connect to service on port 6667\n")
|
||||||
|
report.IRCDetected = false
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Detected possible IRC instance\n")
|
log.Printf("Detected possible IRC instance\n")
|
||||||
// TODO: Actual Analysis
|
// TODO: Actual Analysis
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (rps *RicochetProtocolScanner) ScanProtocol(hiddenService string, onionscan
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":9878")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":9878")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 9878\n")
|
log.Printf("Failed to connect to service on port 9878\n")
|
||||||
|
report.RicochetDetected = false
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Detected possible ricochet instance\n")
|
log.Printf("Detected possible ricochet instance\n")
|
||||||
// TODO: Actual Analysis
|
// TODO: Actual Analysis
|
||||||
|
|
|
@ -16,6 +16,7 @@ func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConf
|
||||||
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":25")
|
_, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":25")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 25\n")
|
log.Printf("Failed to connect to service on port 25\n")
|
||||||
|
report.SMTPDetected = false
|
||||||
} else {
|
} else {
|
||||||
// TODO SMTP Checking
|
// TODO SMTP Checking
|
||||||
report.SMTPDetected = true
|
report.SMTPDetected = true
|
||||||
|
|
|
@ -21,6 +21,7 @@ func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, onionscanConfi
|
||||||
conn, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":22")
|
conn, err := socks.DialSocksProxy(socks.SOCKS5, onionscanConfig.TorProxyAddress)("", hiddenService+":22")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to connect to service on port 22\n")
|
log.Printf("Failed to connect to service on port 22\n")
|
||||||
|
report.SSHDetected = false
|
||||||
} else {
|
} else {
|
||||||
// TODO SSH Checking
|
// TODO SSH Checking
|
||||||
report.SSHDetected = true
|
report.SSHDetected = true
|
||||||
|
|
Loading…
Reference in New Issue