This commit is contained in:
Sarah Jamie Lewis 2016-04-26 17:47:00 -07:00
parent d83d10bd93
commit 44cc375066
11 changed files with 21 additions and 27 deletions

View File

@ -7,7 +7,6 @@ import (
) )
type BitcoinProtocolScanner struct { type BitcoinProtocolScanner struct {
} }
func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

@ -7,7 +7,6 @@ import (
) )
type FTPProtocolScanner struct { type FTPProtocolScanner struct {
} }
func (sps *FTPProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (sps *FTPProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

@ -7,7 +7,6 @@ import (
) )
type IRCProtocolScanner struct { type IRCProtocolScanner struct {
} }
func (rps *IRCProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (rps *IRCProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

@ -7,7 +7,6 @@ import (
) )
type RicochetProtocolScanner struct { type RicochetProtocolScanner struct {
} }
func (rps *RicochetProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (rps *RicochetProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

@ -7,7 +7,6 @@ import (
) )
type SMTPProtocolScanner struct { type SMTPProtocolScanner struct {
} }
func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

@ -1,18 +1,17 @@
package protocol package protocol
import ( import (
"crypto/md5"
"errors"
"fmt"
"github.com/s-rah/onionscan/report" "github.com/s-rah/onionscan/report"
"golang.org/x/crypto/ssh"
"h12.me/socks" "h12.me/socks"
"log" "log"
"golang.org/x/crypto/ssh"
"net" "net"
"errors"
"crypto/md5"
"fmt"
) )
type SSHProtocolScanner struct { type SSHProtocolScanner struct {
} }
func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) { func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {
@ -24,14 +23,14 @@ func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, proxyAddress s
} else { } else {
// TODO SSH Checking // TODO SSH Checking
report.SSHDetected = true report.SSHDetected = true
config := &ssh.ClientConfig { config := &ssh.ClientConfig{
HostKeyCallback : func (hostname string, addr net.Addr, key ssh.PublicKey) error { HostKeyCallback: func(hostname string, addr net.Addr, key ssh.PublicKey) error {
h := md5.New() h := md5.New()
h.Write(key.Marshal()) h.Write(key.Marshal())
fBytes := h.Sum(nil) fBytes := h.Sum(nil)
fingerprint := string("") fingerprint := string("")
for i := 0; i < len(fBytes); i++ { for i := 0; i < len(fBytes); i++ {
if i+1 != len(fBytes) { if i+1 != len(fBytes) {
fingerprint = fmt.Sprintf("%s%0.2x:", fingerprint, fBytes[i]) fingerprint = fmt.Sprintf("%s%0.2x:", fingerprint, fBytes[i])
@ -45,7 +44,7 @@ func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, proxyAddress s
return errors.New("error") return errors.New("error")
}, },
} }
ssh.NewClientConn(conn,hiddenService+":22",config) ssh.NewClientConn(conn, hiddenService+":22", config)
} }

View File

@ -2,9 +2,9 @@ package report
import ( import (
"encoding/json" "encoding/json"
"fmt"
"github.com/s-rah/onionscan/utils" "github.com/s-rah/onionscan/utils"
"io/ioutil" "io/ioutil"
"fmt"
) )
type ExifTag struct { type ExifTag struct {
@ -40,11 +40,11 @@ type OnionScanReport struct {
InterestingFiles []string `json:"interestingFiles"` InterestingFiles []string `json:"interestingFiles"`
PageReferencedDirectories []string `json:"pageReferencedDirectories"` PageReferencedDirectories []string `json:"pageReferencedDirectories"`
Hashes []string `json:"hashes"` Hashes []string `json:"hashes"`
SSHKey string `json:"sshKey"` SSHKey string `json:"sshKey"`
Snapshot string `json:"snapshot"` Snapshot string `json:"snapshot"`
PageTitle string `json:"pageTitle"` PageTitle string `json:"pageTitle"`
ResponseHeaders []string `json:"responseHeaders"` ResponseHeaders []string `json:"responseHeaders"`
} }
func LoadReportFromFile(filename string) (OnionScanReport, error) { func LoadReportFromFile(filename string) (OnionScanReport, error) {

View File

@ -25,7 +25,7 @@ func CheckDirectoryListing(scan Scanner, dir string, status int, contents string
for _, file := range interestingFiles { for _, file := range interestingFiles {
log.Printf("\t Found interesting file %s/%s\n", dir, file[1]) log.Printf("\t Found interesting file %s/%s\n", dir, file[1])
//TODO: We can do further analysis here, for now, just report them. //TODO: We can do further analysis here, for now, just report them.
report.AddInterestingFile(dir+"/"+file[1]) report.AddInterestingFile(dir + "/" + file[1])
} }
r = regexp.MustCompile(`href="([^/](.*?))/"`) r = regexp.MustCompile(`href="([^/](.*?))/"`)
@ -33,7 +33,7 @@ func CheckDirectoryListing(scan Scanner, dir string, status int, contents string
for _, file := range subDir { for _, file := range subDir {
log.Printf("\t Found subdir %s/%s\n", dir, file[1]) log.Printf("\t Found subdir %s/%s\n", dir, file[1])
//TODO: We can do further analysis here, for now, just report them. //TODO: We can do further analysis here, for now, just report them.
scan.ScanPage(report.HiddenService, dir+"/"+file[1], report, CheckDirectoryListing) scan.ScanPage(report.HiddenService, dir+"/"+file[1], report, CheckDirectoryListing)
} }
} else { } else {

View File

@ -3,7 +3,7 @@ package scans
import ( import (
"github.com/s-rah/onionscan/report" "github.com/s-rah/onionscan/report"
"github.com/xiam/exif" "github.com/xiam/exif"
"io" "io"
"log" "log"
"strings" "strings"
) )

View File

@ -5,5 +5,5 @@ import (
) )
type Scanner interface { type Scanner interface {
ScanPage(string, string,*report.OnionScanReport, func(Scanner, string,int, string,*report.OnionScanReport)) ScanPage(string, string, *report.OnionScanReport, func(Scanner, string, int, string, *report.OnionScanReport))
} }

View File

@ -25,7 +25,7 @@ func StandardPageScan(scan Scanner, page string, status int, contents string, re
if isTitlePresent { if isTitlePresent {
var startIndex = strings.Index(contents, "<title>") var startIndex = strings.Index(contents, "<title>")
var endIndex = strings.Index(contents, "</title>") var endIndex = strings.Index(contents, "</title>")
var pageTitle = contents[startIndex+len("<title>"):endIndex] var pageTitle = contents[startIndex+len("<title>") : endIndex]
log.Printf("\tPage Title: %s\n", pageTitle) log.Printf("\tPage Title: %s\n", pageTitle)
report.PageTitle = pageTitle report.PageTitle = pageTitle
} }