mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 02:35:25 +00:00
fix panic while parsing tlsx response (#3641)
This commit is contained in:
parent
027880af34
commit
9b3a55d6c0
@ -255,17 +255,36 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
|
|||||||
data["template-id"] = requestOptions.TemplateID
|
data["template-id"] = requestOptions.TemplateID
|
||||||
data["template-info"] = requestOptions.TemplateInfo
|
data["template-info"] = requestOptions.TemplateInfo
|
||||||
|
|
||||||
|
// if response is not struct compatible, error out
|
||||||
|
if !structs.IsStruct(response) {
|
||||||
|
return errorutil.NewWithTag("ssl", "response cannot be parsed into a struct: %v", response)
|
||||||
|
}
|
||||||
|
|
||||||
// Convert response to key value pairs and first cert chain item as well
|
// Convert response to key value pairs and first cert chain item as well
|
||||||
responseParsed := structs.New(response)
|
responseParsed := structs.New(response)
|
||||||
for _, f := range responseParsed.Fields() {
|
for _, f := range responseParsed.Fields() {
|
||||||
|
if !f.IsExported() {
|
||||||
|
// if field is not exported f.IsZero() , f.Value() will panic
|
||||||
|
continue
|
||||||
|
}
|
||||||
tag := utils.CleanStructFieldJSONTag(f.Tag("json"))
|
tag := utils.CleanStructFieldJSONTag(f.Tag("json"))
|
||||||
if tag == "" || f.IsZero() {
|
if tag == "" || f.IsZero() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
data[tag] = f.Value()
|
data[tag] = f.Value()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if certificate response is not struct compatible, error out
|
||||||
|
if !structs.IsStruct(response.CertificateResponse) {
|
||||||
|
return errorutil.NewWithTag("ssl", "certificate response cannot be parsed into a struct: %v", response.CertificateResponse)
|
||||||
|
}
|
||||||
|
|
||||||
responseParsed = structs.New(response.CertificateResponse)
|
responseParsed = structs.New(response.CertificateResponse)
|
||||||
for _, f := range responseParsed.Fields() {
|
for _, f := range responseParsed.Fields() {
|
||||||
|
if !f.IsExported() {
|
||||||
|
// if field is not exported f.IsZero() , f.Value() will panic
|
||||||
|
continue
|
||||||
|
}
|
||||||
tag := utils.CleanStructFieldJSONTag(f.Tag("json"))
|
tag := utils.CleanStructFieldJSONTag(f.Tag("json"))
|
||||||
if tag == "" || f.IsZero() {
|
if tag == "" || f.IsZero() {
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user