mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 10:41:21 +00:00
保留类似http的指定任意字段输出的能力
This commit is contained in:
parent
5c48bce5d4
commit
0cf6bf3a19
@ -93,6 +93,55 @@ func (bl *baseline) FuzzyEqual(other *baseline) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (bl *baseline) Get(key string) string {
|
||||
switch key {
|
||||
case "url":
|
||||
return bl.Url
|
||||
case "host":
|
||||
return bl.Host
|
||||
case "title":
|
||||
return bl.Title
|
||||
case "redirect":
|
||||
return bl.RedirectURL
|
||||
case "md5":
|
||||
if bl.Hashes != nil {
|
||||
return bl.Hashes.BodyMd5
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
case "simhash":
|
||||
if bl.Hashes != nil {
|
||||
return bl.Hashes.BodySimhash
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
case "mmh3":
|
||||
if bl.Hashes != nil {
|
||||
return bl.Hashes.BodySimhash
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
case "stat", "status":
|
||||
return strconv.Itoa(bl.Status)
|
||||
case "spend":
|
||||
return strconv.Itoa(bl.Spended)
|
||||
//case "extract":
|
||||
// return bl.Extracteds
|
||||
case "frame", "framework":
|
||||
return bl.Frameworks.ToString()
|
||||
default:
|
||||
return ""
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (bl *baseline) Additional(key string) string {
|
||||
if v := bl.Get(key); v != "" {
|
||||
return "[" + v + "]"
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
func (bl *baseline) String() string {
|
||||
var line strings.Builder
|
||||
//line.WriteString("[+] ")
|
||||
@ -107,11 +156,8 @@ func (bl *baseline) String() string {
|
||||
line.WriteString(bl.RedirectURL)
|
||||
line.WriteString(" ")
|
||||
}
|
||||
line.WriteString(" [" + bl.Title + "]")
|
||||
if bl.Hashes != nil {
|
||||
line.WriteString(" [" + bl.Hashes.BodyMd5 + "]")
|
||||
}
|
||||
|
||||
line.WriteString(bl.Additional("title"))
|
||||
line.WriteString(bl.Additional("mmh3"))
|
||||
line.WriteString(bl.Frameworks.ToString())
|
||||
//line.WriteString(bl.Extracteds)
|
||||
//line.WriteString("\n")
|
||||
|
@ -12,7 +12,8 @@ import (
|
||||
type Option struct {
|
||||
URL string `short:"u" long:"url"`
|
||||
URLFile string `short:"l" long:"list"`
|
||||
WordLists []string `short:"w" long:"word"`
|
||||
Dictionaries []string `short:"d" long:"dict"`
|
||||
Word string `short:"w" long:"word"`
|
||||
Extension string `short:"e" long:"extensions"`
|
||||
ExcludeExtensions bool `long:"exclude-extensions"`
|
||||
RemoveExtensions bool `long:"remove-extensions"`
|
||||
@ -82,18 +83,23 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
logs.Log.Importantf("load %d urls from %s", len(r.URLList), urlfrom)
|
||||
|
||||
// prepare word
|
||||
words := make([][]string, len(opt.WordLists))
|
||||
for i, f := range opt.WordLists {
|
||||
words[i], err = loadFileToSlice(f)
|
||||
dicts := make([][]string, len(opt.Dictionaries))
|
||||
for i, f := range opt.Dictionaries {
|
||||
dicts[i], err = loadFileToSlice(f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logs.Log.Importantf("load %d word from %s", len(r.Wordlist), f)
|
||||
}
|
||||
|
||||
for _, w := range words {
|
||||
r.Wordlist = append(r.Wordlist, w...)
|
||||
if opt.Word == "" {
|
||||
for _, w := range dicts {
|
||||
r.Wordlist = append(r.Wordlist, w...)
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// todo mask
|
||||
|
||||
// prepare header
|
||||
|
Loading…
x
Reference in New Issue
Block a user