/
replace.go
27 lines (24 loc) 路 829 Bytes
/
replace.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package optimization
import (
"strings"
model "github.com/hahwul/dalfox/v2/pkg/model"
)
// SetPayloadValue is change alert/prompt/conrifm value and type
func SetPayloadValue(payloads []string, options model.Options) []string {
var result []string
catype := strings.Split(options.CustomAlertType, ",")
for _,payload := range payloads {
for _,k := range catype {
if k == "none" {
temp := strings.ReplaceAll(payload, "DALFOX_ALERT_VALUE", options.CustomAlertValue)
result = append(result, temp)
} else if k == "str" {
temp := strings.ReplaceAll(payload, "DALFOX_ALERT_VALUE", "\""+options.CustomAlertValue+"\"")
result = append(result, temp)
temp = strings.ReplaceAll(payload, "DALFOX_ALERT_VALUE", "'"+options.CustomAlertValue+"'")
result = append(result, temp)
}
}
}
return result
}