forked from s-rah/onionscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
http_scanner.go
34 lines (29 loc) · 875 Bytes
/
http_scanner.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package protocol
import (
"fmt"
"github.com/s-rah/onionscan/config"
"github.com/s-rah/onionscan/report"
"github.com/s-rah/onionscan/spider"
"github.com/s-rah/onionscan/utils"
"net/http"
)
type HTTPProtocolScanner struct {
Client *http.Client
}
func (hps *HTTPProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport) {
// HTTP
osc.LogInfo(fmt.Sprintf("Checking %s http(80)\n", hiddenService))
conn, err := utils.GetNetworkConnection(hiddenService, 80, osc.TorProxyAddress, osc.Timeout)
if conn != nil {
conn.Close()
}
if err != nil {
osc.LogInfo("Failed to connect to service on port 80\n")
report.WebDetected = false
} else {
osc.LogInfo("Found potential service on http(80)\n")
report.WebDetected = true
wps := new(spider.OnionSpider)
wps.Crawl(report.HiddenService, osc, report)
}
}