mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
优化content-length输出, 现在超过max的结果也会正确的获取, 但添加了(exceed)
标记
This commit is contained in:
parent
f30712bb7e
commit
5dc8f7107f
@ -92,6 +92,9 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bl.BodyLength > ihttp.DefaultMaxBodySize {
|
||||||
|
bl.ExceedLength = true
|
||||||
|
}
|
||||||
bl.Source = int(unit.source)
|
bl.Source = int(unit.source)
|
||||||
bl.ReqDepth = unit.depth
|
bl.ReqDepth = unit.depth
|
||||||
bl.Spended = time.Since(start).Milliseconds()
|
bl.Spended = time.Since(start).Milliseconds()
|
||||||
|
@ -28,7 +28,7 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
|||||||
bl.Host = host
|
bl.Host = host
|
||||||
}
|
}
|
||||||
bl.Body = resp.Body()
|
bl.Body = resp.Body()
|
||||||
bl.BodyLength = len(bl.Body)
|
bl.BodyLength = resp.ContentLength()
|
||||||
bl.Header = resp.Header()
|
bl.Header = resp.Header()
|
||||||
bl.HeaderLength = len(bl.Header)
|
bl.HeaderLength = len(bl.Header)
|
||||||
bl.RedirectURL = resp.GetHeader("Location")
|
bl.RedirectURL = resp.GetHeader("Location")
|
||||||
@ -55,7 +55,7 @@ func NewInvalidBaseline(u, host string, resp *ihttp.Response, reason string) *Ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
bl.Body = resp.Body()
|
bl.Body = resp.Body()
|
||||||
bl.BodyLength = len(bl.Body)
|
bl.BodyLength = resp.ContentLength()
|
||||||
bl.Header = resp.Header()
|
bl.Header = resp.Header()
|
||||||
bl.HeaderLength = len(bl.Header)
|
bl.HeaderLength = len(bl.Header)
|
||||||
bl.RedirectURL = string(resp.GetHeader("Location"))
|
bl.RedirectURL = string(resp.GetHeader("Location"))
|
||||||
@ -71,6 +71,7 @@ type Baseline struct {
|
|||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
Body []byte `json:"-"`
|
Body []byte `json:"-"`
|
||||||
BodyLength int `json:"body_length"`
|
BodyLength int `json:"body_length"`
|
||||||
|
ExceedLength bool `json:"-"`
|
||||||
Header []byte `json:"-"`
|
Header []byte `json:"-"`
|
||||||
Raw []byte `json:"-"`
|
Raw []byte `json:"-"`
|
||||||
HeaderLength int `json:"header_length"`
|
HeaderLength int `json:"header_length"`
|
||||||
@ -85,12 +86,12 @@ type Baseline struct {
|
|||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
IsValid bool `json:"valid"`
|
IsValid bool `json:"valid"`
|
||||||
IsFuzzy bool `json:"fuzzy"`
|
IsFuzzy bool `json:"fuzzy"`
|
||||||
URLs []string `json:"-"`
|
|
||||||
Source int `json:"source"`
|
Source int `json:"source"`
|
||||||
RecuDepth int `json:"-"`
|
|
||||||
ReqDepth int `json:"depth"`
|
ReqDepth int `json:"depth"`
|
||||||
Recu bool `json:"-"`
|
Recu bool `json:"-"`
|
||||||
*parsers.Hashes
|
RecuDepth int `json:"-"`
|
||||||
|
URLs []string `json:"-"`
|
||||||
|
*parsers.Hashes `json:"hashes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bl *Baseline) IsDir() bool {
|
func (bl *Baseline) IsDir() bool {
|
||||||
@ -292,6 +293,9 @@ func (bl *Baseline) ColorString() string {
|
|||||||
line.WriteString(logs.GreenBold(strconv.Itoa(bl.Status)))
|
line.WriteString(logs.GreenBold(strconv.Itoa(bl.Status)))
|
||||||
line.WriteString(" - ")
|
line.WriteString(" - ")
|
||||||
line.WriteString(logs.YellowBold(strconv.Itoa(bl.BodyLength)))
|
line.WriteString(logs.YellowBold(strconv.Itoa(bl.BodyLength)))
|
||||||
|
if bl.ExceedLength {
|
||||||
|
line.WriteString(logs.Red("(exceed)"))
|
||||||
|
}
|
||||||
line.WriteString(" - ")
|
line.WriteString(" - ")
|
||||||
line.WriteString(logs.YellowBold(strconv.Itoa(int(bl.Spended)) + "ms"))
|
line.WriteString(logs.YellowBold(strconv.Itoa(int(bl.Spended)) + "ms"))
|
||||||
line.WriteString(logs.GreenLine(bl.Additional("title")))
|
line.WriteString(logs.GreenLine(bl.Additional("title")))
|
||||||
@ -339,6 +343,9 @@ func (bl *Baseline) String() string {
|
|||||||
line.WriteString(strconv.Itoa(bl.Status))
|
line.WriteString(strconv.Itoa(bl.Status))
|
||||||
line.WriteString(" - ")
|
line.WriteString(" - ")
|
||||||
line.WriteString(strconv.Itoa(bl.BodyLength))
|
line.WriteString(strconv.Itoa(bl.BodyLength))
|
||||||
|
if bl.ExceedLength {
|
||||||
|
line.WriteString("(exceed)")
|
||||||
|
}
|
||||||
line.WriteString(" - ")
|
line.WriteString(" - ")
|
||||||
line.WriteString(strconv.Itoa(int(bl.Spended)) + "ms")
|
line.WriteString(strconv.Itoa(int(bl.Spended)) + "ms")
|
||||||
line.WriteString(bl.Additional("title"))
|
line.WriteString(bl.Additional("title"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user