Skip to content

Commit

Permalink
Insert Apache mod_status Reltionships
Browse files Browse the repository at this point in the history
Will be used for s-rah#73
  • Loading branch information
s-rah committed Oct 10, 2016
1 parent f0067b8 commit fa814c2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions deanonymization/apache_mod_status.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package deanonymization

import (
"net/url"

"fmt"
"github.com/s-rah/onionscan/config"
"github.com/s-rah/onionscan/report"
"github.com/s-rah/onionscan/utils"
"net/url"
"regexp"
"strings"
)
Expand All @@ -22,46 +22,46 @@ func ApacheModStatus(osreport *report.OnionScanReport, report *report.AnonymityR

// Check if this looks like a mod_status page. Sometimes sites simply load their index.
if len(serverVersion) > 1 {
//osc.LogInfo("Detected Apache mod_status Exposed...\033[091mAlert!\033[0m\n")
osc.LogInfo("Detected Apache mod_status Exposed...\033[091mAlert!\033[0m\n")
report.FoundApacheModStatus = true

//osc.LogInfo(fmt.Sprintf("\t Using mod_status Server Version: %s\n", serverVersion[1]))
osc.LogInfo(fmt.Sprintf("\t Using mod_status Server Version: %s\n", serverVersion[1]))
report.ServerVersion = serverVersion[1]

// Check for co-hosted onion services.
//osc.LogInfo("Scanning for Co-Hosted Onions\n")
osc.LogInfo("Scanning for Co-Hosted Onions\n")
r = regexp.MustCompile(`[a-z0-9]+.onion(:[0-9]{0-5})?`)
foundServices := r.FindAllString(string(contents), -1)
utils.RemoveDuplicates(&foundServices)
for _, onion := range foundServices {
if onion != osreport.HiddenService {
//osc.LogInfo(fmt.Sprintf("\t \033[091mAlert!\033[0m Found Co-Hosted Onions: %s\n", onion))
report.AddRelatedOnionService(onion)
osc.Database.InsertRelationship(osreport.HiddenService, "mod_status", onion)
}
}

// Check for co-hosted onion services.
//osc.LogInfo("Scanning for Co-Hosted Clearnet Domains\n")
osc.LogInfo("Scanning for Co-Hosted Clearnet Domains\n")
r = regexp.MustCompile(`>(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\.[a-zA-Z]{2,3})`)
foundServices = r.FindAllString(string(contents), -1)
utils.RemoveDuplicates(&foundServices)
for _, domain := range foundServices {
if strings.Contains(domain, ".onion") == false {
//osc.LogInfo(fmt.Sprintf("\t \033[091mAlert!\033[0m Found Co-Hosted Service: %s\n", domain[1:]))
report.AddRelatedClearnetDomain(domain[4:])
osc.Database.InsertRelationship(osreport.HiddenService, "mod_status", domain[4:])
}
}

// Check for IP Addresses
//osc.LogInfo("Scanning for IP Addresses (clearweb clients, and servers)\n")
osc.LogInfo("Scanning for IP Addresses (clearweb clients, and servers)\n")
r = regexp.MustCompile(`(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`)
foundIPs := r.FindAllString(string(contents), -1)
utils.RemoveDuplicates(&foundIPs)
for _, ip := range foundIPs {
if ip != "127.0.0.1" {
//osc.LogInfo(fmt.Sprintf("\t \033[091mAlert!\033[0m Found IP Address : %s\n", ip))
report.AddIPAddress(ip)
}
// This will also report local IPs like 127.0.0.1 however knowing this setup
// might be useful in some instances
report.AddIPAddress(ip)
osc.Database.InsertRelationship(osreport.HiddenService, "mod_status", ip)
}

}
Expand Down

0 comments on commit fa814c2

Please sign in to comment.