mirror of https://github.com/daffainfo/nuclei.git
fix json deserialization issues
parent
994988357a
commit
27fefe59d3
|
@ -87,7 +87,11 @@ func (userAgentHolder *UserAgentHolder) UnmarshalYAML(unmarshal func(interface{}
|
|||
}
|
||||
|
||||
func (userAgentHolder *UserAgentHolder) UnmarshalJSON(data []byte) error {
|
||||
computedUserAgent, err := toUserAgent(strings.Trim(string(data), `"`))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedUserAgent, err := toUserAgent(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -100,7 +100,11 @@ func (holder *ExtractorTypeHolder) UnmarshalYAML(unmarshal func(interface{}) err
|
|||
}
|
||||
|
||||
func (holder *ExtractorTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toExtractorTypes(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toExtractorTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -107,7 +107,11 @@ func (holder *MatcherTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error
|
|||
}
|
||||
|
||||
func (holder *MatcherTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toMatcherTypes(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toMatcherTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -89,7 +89,11 @@ func (holder *AttackTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error)
|
|||
}
|
||||
|
||||
func (holder *AttackTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toAttackType(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toAttackType(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -117,7 +117,11 @@ func (holder *DNSRequestTypeHolder) UnmarshalYAML(unmarshal func(interface{}) er
|
|||
}
|
||||
|
||||
func (holder *DNSRequestTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toDNSRequestTypes(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toDNSRequestTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -199,7 +199,11 @@ func (holder *ActionTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error)
|
|||
}
|
||||
|
||||
func (holder *ActionTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toActionTypes(strings.Trim(string(data), `"`))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toActionTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -117,7 +117,11 @@ func (holder *HTTPMethodTypeHolder) UnmarshalYAML(unmarshal func(interface{}) er
|
|||
}
|
||||
|
||||
func (holder *HTTPMethodTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toHTTPMethodTypes(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toHTTPMethodTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -79,7 +79,11 @@ func (holder *SignatureTypeHolder) UnmarshalYAML(unmarshal func(interface{}) err
|
|||
}
|
||||
|
||||
func (holder *SignatureTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toSignatureType(strings.Trim(string(data), "\""))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toSignatureType(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -88,7 +92,7 @@ func (holder *SignatureTypeHolder) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (holder *SignatureTypeHolder) MarshalJSON() ([]byte, error) {
|
||||
func (holder SignatureTypeHolder) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(holder.Value.String())
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,11 @@ func (holder *NetworkInputTypeHolder) UnmarshalYAML(unmarshal func(interface{})
|
|||
}
|
||||
|
||||
func (holder *NetworkInputTypeHolder) UnmarshalJSON(data []byte) error {
|
||||
computedType, err := toNetworkInputTypes(strings.Trim(string(data), `"`))
|
||||
s := strings.Trim(string(data), `"`)
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
computedType, err := toNetworkInputTypes(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue