adding partial header extraction

This commit is contained in:
Mzack9999 2020-07-30 23:21:28 +02:00
parent 0817f3168e
commit 7f4a17b06b
2 changed files with 12 additions and 2 deletions

View File

@ -308,7 +308,7 @@ retry:
if scanopts.OutputContentType {
builder.WriteString(" [")
if !scanopts.OutputWithNoColor {
builder.WriteString(aurora.Magenta(resp.GetHeader("Content-Type")).String())
builder.WriteString(aurora.Magenta(resp.GetHeaderPart("Content-Type", 0)).String())
} else {
builder.WriteString(resp.GetHeader("content-type"))
}
@ -365,7 +365,7 @@ retry:
URL: fullURL,
ContentLength: resp.ContentLength,
StatusCode: resp.StatusCode,
ContentType: resp.GetHeader("Content-Type"),
ContentType: resp.GetHeaderPart("Content-Type", 0),
Title: title,
str: builder.String(),
VHost: isvhost,

View File

@ -25,3 +25,13 @@ func (r *Response) GetHeader(name string) string {
return ""
}
// GetHeaderPart with offset
func (r *Response) GetHeaderPart(name string, at int) string {
v, ok := r.Headers[name]
if ok && at < len(v) {
return v[at]
}
return ""
}