Skip to content

Commit

Permalink
chore: -
Browse files Browse the repository at this point in the history
  • Loading branch information
enenumxela committed Jul 26, 2023
1 parent c006d8e commit d0bcea6
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
4 changes: 0 additions & 4 deletions pkg/xurlfind3r/httpclient/client.go
Expand Up @@ -15,10 +15,6 @@ func httpRequestWrapper(req *fasthttp.Request) (res *fasthttp.Response, err erro
return
}

// if res.StatusCode() != fasthttp.StatusOK {
// err = fmt.Errorf("unexpected status code")
// }

return
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/xurlfind3r/sources/bevigil/bevigil.go
Expand Up @@ -22,9 +22,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
go func() {
defer close(URLsChannel)

var key string
var err error

var key string

key, err = sources.PickRandom(config.Keys.Bevigil)
if key == "" || err != nil {
return
Expand Down
6 changes: 4 additions & 2 deletions pkg/xurlfind3r/sources/commoncrawl/commoncrawl.go
Expand Up @@ -31,9 +31,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
go func() {
defer close(URLsChannel)

var indexesRes *fasthttp.Response
var err error

var indexesRes *fasthttp.Response

indexesRes, err = httpclient.SimpleGet("https://index.commoncrawl.org/collinfo.json")
if err != nil {
return
Expand All @@ -57,9 +58,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
"Host": "index.commoncrawl.org",
}

var contentRes *fasthttp.Response
var err error

var contentRes *fasthttp.Response

contentRes, err = httpclient.Get(fmt.Sprintf("%s?url=*.%s/*&output=json&fl=url", API, domain), "", contentReqHeaders)
if err != nil {
return
Expand Down
5 changes: 4 additions & 1 deletion pkg/xurlfind3r/sources/github/github.go
Expand Up @@ -51,7 +51,7 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
return URLsChannel
}

func (source *Source) Enumerate(searchURL string, domain string, tokens *Tokens, URLsChannel chan sources.URL, config *sources.Configuration) {
func (source *Source) Enumerate(searchURL, domain string, tokens *Tokens, URLsChannel chan sources.URL, config *sources.Configuration) {
token := tokens.Get()

if token.RetryAfter > 0 {
Expand All @@ -68,10 +68,13 @@ func (source *Source) Enumerate(searchURL string, domain string, tokens *Tokens,
}

var err error

var searchRes *fasthttp.Response

searchRes, err = httpclient.Request(fasthttp.MethodGet, searchURL, "", reqHeaders, nil)

isForbidden := searchRes != nil && searchRes.StatusCode() == fasthttp.StatusForbidden

if err != nil && !isForbidden {
return
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/xurlfind3r/sources/intelx/intelx.go
Expand Up @@ -39,9 +39,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
go func() {
defer close(URLsChannel)

var key string
var err error

var key string

key, err = sources.PickRandom(config.Keys.Intelx)
if key == "" || err != nil {
return
Expand Down
3 changes: 2 additions & 1 deletion pkg/xurlfind3r/sources/otx/otx.go
Expand Up @@ -38,9 +38,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
for page := 1; ; page++ {
reqURL := fmt.Sprintf("https://otx.alienvault.com/api/v1/indicators/domain/%s/url_list?limit=%d&page=%d", domain, 200, page)

var res *fasthttp.Response
var err error

var res *fasthttp.Response

res, err = httpclient.SimpleGet(reqURL)
if err != nil {
return
Expand Down
3 changes: 2 additions & 1 deletion pkg/xurlfind3r/sources/urlscan/urlscan.go
Expand Up @@ -35,9 +35,10 @@ func (source *Source) Run(config *sources.Configuration, domain string) (URLsCha
go func() {
defer close(URLsChannel)

var key string
var err error

var key string

key, err = sources.PickRandom(config.Keys.URLScan)
if err != nil {
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/xurlfind3r/sources/wayback/waybackrobots.go
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hueristiq/xurlfind3r/pkg/xurlfind3r/sources"
)

func parseWaybackRobots(config *sources.Configuration, URL string) (robotsURLs chan string) {
func parseWaybackRobots(_ *sources.Configuration, URL string) (robotsURLs chan string) {
robotsURLs = make(chan string)

robotsEntryRegex := regexp.MustCompile(`Disallow:\s?.+`)
Expand Down
1 change: 1 addition & 0 deletions pkg/xurlfind3r/sources/wayback/waybacksource.go
Expand Up @@ -17,6 +17,7 @@ func parseWaybackSource(domain, URL string) (sourceURLs chan string) {
defer close(sourceURLs)

var err error

var snapshots [][2]string

snapshots, err = getWaybackSnapshots(URL)
Expand Down

0 comments on commit d0bcea6

Please sign in to comment.