mirror of
https://github.com/projectdiscovery/httpx
synced 2026-06-08 16:50:17 +00:00
favicon flag improvement (#718)
* favicon flag improvement * addressed review comments * utilizing request object
This commit is contained in:
@@ -496,11 +496,6 @@ func (options *Options) ValidateOptions() error {
|
||||
options.StoreResponse = true
|
||||
}
|
||||
|
||||
if options.Favicon {
|
||||
gologger.Debug().Msgf("Setting single path to \"favicon.ico\" and ignoring multiple paths settings\n")
|
||||
options.RequestURIs = "/favicon.ico"
|
||||
}
|
||||
|
||||
if options.Hashes != "" {
|
||||
for _, hashType := range strings.Split(options.Hashes, ",") {
|
||||
if !slice.StringSliceContains([]string{"md5", "sha1", "sha256", "sha512", "mmh3", "simhash"}, strings.ToLower(hashType)) {
|
||||
|
||||
+11
-7
@@ -1343,17 +1343,21 @@ retry:
|
||||
}
|
||||
builder.WriteRune(']')
|
||||
}
|
||||
|
||||
var faviconMMH3 string
|
||||
if scanopts.Favicon {
|
||||
faviconMMH3 = fmt.Sprintf("%d", stringz.FaviconHash(resp.Data))
|
||||
builder.WriteString(" [")
|
||||
if !scanopts.OutputWithNoColor {
|
||||
builder.WriteString(aurora.Magenta(faviconMMH3).String())
|
||||
req.URL.Path = "/favicon.ico"
|
||||
if faviconResp, favErr := hp.Do(req, httpx.UnsafeOptions{}); favErr == nil {
|
||||
faviconMMH3 = fmt.Sprintf("%d", stringz.FaviconHash(faviconResp.Data))
|
||||
builder.WriteString(" [")
|
||||
if !scanopts.OutputWithNoColor {
|
||||
builder.WriteString(aurora.Magenta(faviconMMH3).String())
|
||||
} else {
|
||||
builder.WriteString(faviconMMH3)
|
||||
}
|
||||
builder.WriteRune(']')
|
||||
} else {
|
||||
builder.WriteString(faviconMMH3)
|
||||
gologger.Warning().Msgf("Could not fetch favicon: %s", favErr.Error())
|
||||
}
|
||||
builder.WriteRune(']')
|
||||
}
|
||||
// adding default hashing for json output format
|
||||
if r.options.JSONOutput && len(scanopts.Hashes) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user