diff --git a/.gitignore b/.gitignore index b25c15b..2401598 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,36 @@ +# common files *~ +*.log +*.bak +*.tmp +*.swp +*.lock + + +# Eclipse +.classpath +.project +.settings +.metadata +.factorypath + +# IDEA IntelliJ +*.ipr +*.iws +*.iml +.idea +.idea_modules +out +atlassian-ide-plugin.xml + +# Windows +Thumbs.db +ehthumbs.db +Desktop.ini + +# KDE directory preferences +.directory + +# OS X +.DS_Store +.Trashes \ No newline at end of file diff --git a/protocol/http_scanner.go b/protocol/http_scanner.go index 30ea255..2e47cfb 100644 --- a/protocol/http_scanner.go +++ b/protocol/http_scanner.go @@ -36,10 +36,16 @@ func (hps * HTTPProtocolScanner) ScanProtocol(hiddenService string, proxyAddress return } - // Initial Attempt at Resolving Server Type - log.Printf("Attempting to Derive Server Type from Headers..\n") - report.ServerVersion = response.Header.Get("Server") - log.Printf("\tServer Version: %s\n", report.ServerVersion) + // Reading all http headers + log.Printf("HTTP response headers: %s\n", report.ServerVersion) + responseHeaders := response.Header + for key := range responseHeaders { + value := responseHeaders.Get(key) + report.AddResponseHeader(key, value) + log.Printf("\t%s : %s\n", key, value) + } + + report.ServerVersion = responseHeaders.Get("Server") // Apache mod-status Check hps.ScanPage(hiddenService, "/server-status", report, scans.ApacheModStatus) diff --git a/report/onionscanreport.go b/report/onionscanreport.go index 22e0145..08cf7c7 100644 --- a/report/onionscanreport.go +++ b/report/onionscanreport.go @@ -4,6 +4,7 @@ import ( "encoding/json" "io/ioutil" "github.com/s-rah/onionscan/utils" + "fmt" ) type ExifTag struct { @@ -18,29 +19,31 @@ type ExifImage struct { type OnionScanReport struct { - WebDetected bool `json:"webDetected"` - SSHDetected bool `json:"sshDetected"` - RicochetDetected bool `json:"ricochetDetected"` + WebDetected bool `json:"webDetected"` + SSHDetected bool `json:"sshDetected"` + RicochetDetected bool `json:"ricochetDetected"` IRCDetected bool `json:"ircDetected"` FTPDetected bool `json:"ftpDetected"` SMTPDetected bool `json:"smtpDetected"` BitcoinDetected bool `json:"bitcoinDetected"` - HiddenService string `json:"hiddenService"` - ServerPoweredBy string `json:"serverPoweredBy"` - ServerVersion string `json:"serverVersion"` - FoundApacheModStatus bool `json:"foundApacheModStatus"` - RelatedOnionServices []string `json:"relatedOnionServices"` - RelatedClearnetDomains []string `json:"relatedOnionDomains"` - LinkedSites []string `json:"linkedSites"` - IP []string `json:"ipAddresses"` - OpenDirectories []string `json:"openDirectories"` - ExifImages []ExifImage `json:"exifImages"` - InterestingFiles []string `json:"interestingFiles"` - Hashes []string `json:"hashes"` - SSHKey string `json:"sshKey"` - Snapshot string `json:"snapshot"` + HiddenService string `json:"hiddenService"` + PageTitle string `json:"pageTitle"` + ResponseHeaders []string `json:"responseHeaders"` + ServerPoweredBy string `json:"serverPoweredBy"` + ServerVersion string `json:"serverVersion"` + FoundApacheModStatus bool `json:"foundApacheModStatus"` + RelatedOnionServices []string `json:"relatedOnionServices"` + RelatedClearnetDomains []string `json:"relatedOnionDomains"` + LinkedSites []string `json:"linkedSites"` + IP []string `json:"ipAddresses"` + OpenDirectories []string `json:"openDirectories"` + ExifImages []ExifImage `json:"exifImages"` + InterestingFiles []string `json:"interestingFiles"` + Hashes []string `json:"hashes"` + SSHKey string `json:"sshKey"` + Snapshot string `json:"snapshot"` } func LoadReportFromFile(filename string) (OnionScanReport, error) { @@ -83,6 +86,11 @@ func (osr *OnionScanReport) AddLinkedSite(site string) { utils.RemoveDuplicates(&osr.LinkedSites) } +func (osr *OnionScanReport) AddResponseHeader(name string, value string) { + header := fmt.Sprintf("%s : %s ", name, value) + osr.ResponseHeaders = append(osr.ResponseHeaders, header) +} + func (osr *OnionScanReport) Serialize() (string, error) { report,err := json.Marshal(osr) if err != nil { diff --git a/scans/standard-page-scan.go b/scans/standard-page-scan.go index 3b78b18..ccd4312 100644 --- a/scans/standard-page-scan.go +++ b/scans/standard-page-scan.go @@ -20,6 +20,16 @@ func StandardPageScan(scan Scanner, page string, status int, contents string, re report.Hashes = append(report.Hashes, hex.EncodeToString(hash[:])) report.Snapshot = contents + // Try resolve page title if present + isTitlePresent := strings.Contains(contents, "") + if isTitlePresent { + var startIndex = strings.Index(contents, "<title>") + var endIndex = strings.Index(contents, "") + var pageTitle = contents[startIndex+len(""):endIndex] + log.Printf("\tPage Title: %s\n", pageTitle) + report.PageTitle = pageTitle + } + domains := utils.ExtractDomains(contents) for _,domain := range domains {