2016-04-25 02:46:28 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
2016-06-05 18:54:01 +00:00
|
|
|
"bufio"
|
|
|
|
"crypto/sha1"
|
|
|
|
"encoding/hex"
|
2016-05-03 14:31:56 +00:00
|
|
|
"github.com/s-rah/onionscan/config"
|
2016-04-25 02:46:28 +00:00
|
|
|
"github.com/s-rah/onionscan/report"
|
2016-06-07 06:29:29 +00:00
|
|
|
"github.com/s-rah/onionscan/utils"
|
2016-04-25 02:46:28 +00:00
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SMTPProtocolScanner struct {
|
|
|
|
}
|
|
|
|
|
2016-05-03 14:31:56 +00:00
|
|
|
func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, onionscanConfig *config.OnionscanConfig, report *report.OnionScanReport) {
|
2016-04-25 02:46:28 +00:00
|
|
|
// SMTP
|
|
|
|
log.Printf("Checking %s SMTP(25)\n", hiddenService)
|
2016-06-07 06:29:29 +00:00
|
|
|
conn, err := utils.GetNetworkConnection(hiddenService, 25, onionscanConfig.TorProxyAddress, onionscanConfig.Timeout)
|
2016-04-25 02:46:28 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Printf("Failed to connect to service on port 25\n")
|
2016-05-23 08:38:10 +00:00
|
|
|
report.SMTPDetected = false
|
2016-04-25 02:46:28 +00:00
|
|
|
} else {
|
|
|
|
// TODO SMTP Checking
|
|
|
|
report.SMTPDetected = true
|
2016-06-05 18:54:01 +00:00
|
|
|
reader := bufio.NewReader(conn)
|
|
|
|
banner, err := reader.ReadString('\n')
|
|
|
|
if err == nil {
|
|
|
|
report.SMTPBanner = banner
|
|
|
|
hash := sha1.Sum([]byte(banner))
|
|
|
|
report.SMTPFingerprint = hex.EncodeToString(hash[:])
|
|
|
|
log.Printf("Found SMTP Banner: %s (%s)", banner, report.SMTPFingerprint)
|
|
|
|
}
|
2016-04-25 02:46:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|