Now print results at request, not response

This commit is contained in:
edoardottt
2021-08-28 09:52:10 +02:00
parent 2cc6bf0384
commit 56ae3a16dd
2 changed files with 16 additions and 5 deletions
+6 -4
View File
@@ -45,9 +45,13 @@ func Crawler(target string, txt string, html string, delayTime int, concurrency
// This is to avoid to insert into the crawler target regular
// expression directories passed as input.
var targetTemp string
var protocolTemp string
// if there isn't a scheme use http.
if !utils.HasScheme(target) {
targetTemp = utils.GetHost("http://" + target)
protocolTemp = "http"
targetTemp = utils.GetHost(protocolTemp + "://" + target)
} else {
protocolTemp = utils.GetProtocol(target)
targetTemp = utils.GetHost(target)
}
if intensive {
@@ -205,9 +209,7 @@ func Crawler(target string, txt string, html string, delayTime int, concurrency
})
// Start scraping on target
c.Visit("http://" + target)
c.Visit("https://" + target)
c.Wait()
c.Visit(protocolTemp + "://" + target)
if html != "" {
output.FooterHTML(html)
}
+10 -1
View File
@@ -39,7 +39,16 @@ func GetHost(input string) string {
return u.Host
}
//GetHost >
//GetProtocol >
func GetProtocol(input string) string {
u, err := url.Parse(input)
if err != nil {
return ""
}
return u.Scheme
}
//GetRootHost >
func GetRootHost(input string) string {
_, err := url.Parse(input)
if err != nil {