Skip to content

Commit

Permalink
Merge tag 'parser' into develop
Browse files Browse the repository at this point in the history
Fix parser for Hurricane
  • Loading branch information
neriberto committed May 4, 2024
2 parents a632631 + 7e9fce5 commit b822126
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions utils/hurricane.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http/httputil"
"regexp"
"strings"
"time"

"github.com/PuerkitoBio/goquery"
"github.com/projectdiscovery/gologger"
Expand Down Expand Up @@ -38,6 +39,10 @@ func (h *Hurricane) RunCrawler() {
func (h *Hurricane) Request(url string) string {
opts := retryablehttp.DefaultOptionsSpraying
client := retryablehttp.NewClient(opts)

// Configurando o timeout diretamente no cliente HTTP interno
client.HTTPClient.Timeout = 30 * time.Second

resp, err := client.Get(url)
if err != nil {
panic(err)
Expand All @@ -56,7 +61,7 @@ func (h *Hurricane) ExtractDomain(domain string) {
var url = ""

if domain != "" {
url = urlBase + "dns/" + domain
url = urlBase + "dns/" + domain + "#_dns"
}

var str = h.Request(url)
Expand All @@ -77,7 +82,7 @@ func (h *Hurricane) ExtractDomains(ipRange string) {
return
}

var url = urlBase + "net/" + ipRange
var url = urlBase + "net/" + ipRange + "#_dnsrecords"
var html = h.Request(url)

h.ParseHTML(strings.NewReader(html))
Expand All @@ -89,7 +94,9 @@ func (h *Hurricane) ParseHTML(body io.Reader) {
gologger.Fatal().Msgf("%s", err)
}
var re = regexp.MustCompile(`\/dns\/([^"]+)`)
doc.Find("#_dnsrecords").Each(func(h int, div *goquery.Selection) {

doc.Find("#dnsrecords").Each(func(h int, div *goquery.Selection) {

div.Find("tr").Each(func(i int, tr *goquery.Selection) {
var result Result
tr.Find("td").Each(func(j int, td *goquery.Selection) {
Expand Down

0 comments on commit b822126

Please sign in to comment.