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 {
}
func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, proxyAddress string, report *report.OnionScanReport) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,9 +2,9 @@ package report
import (
"encoding/json"
"fmt"
"github.com/s-rah/onionscan/utils"
"io/ioutil"
"fmt"
)
type ExifTag struct {
@ -40,11 +40,11 @@ type OnionScanReport struct {
InterestingFiles []string `json:"interestingFiles"`
PageReferencedDirectories []string `json:"pageReferencedDirectories"`
Hashes []string `json:"hashes"`
SSHKey string `json:"sshKey"`
Snapshot string `json:"snapshot"`
PageTitle string `json:"pageTitle"`
ResponseHeaders []string `json:"responseHeaders"`
Hashes []string `json:"hashes"`
SSHKey string `json:"sshKey"`
Snapshot string `json:"snapshot"`
PageTitle string `json:"pageTitle"`
ResponseHeaders []string `json:"responseHeaders"`
}
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 {
log.Printf("\t Found interesting file %s/%s\n", dir, file[1])
//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="([^/](.*?))/"`)
@ -33,7 +33,7 @@ func CheckDirectoryListing(scan Scanner, dir string, status int, contents string
for _, file := range subDir {
log.Printf("\t Found subdir %s/%s\n", dir, file[1])
//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 {

View File

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

View File

@ -5,5 +5,5 @@ import (
)
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 {
var startIndex = 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)
report.PageTitle = pageTitle
}