add YAML serialization for ruleset
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
package requestmodifiers
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"fmt"
|
||||
"ladder/proxychain"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func ModifyPathWithRegex(match regexp.Regexp, replacement string) proxychain.RequestModification {
|
||||
func ModifyPathWithRegex(matchRegex string, replacement string) proxychain.RequestModification {
|
||||
match, err := regexp.Compile(matchRegex)
|
||||
return func(px *proxychain.ProxyChain) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("RequestModification :: ModifyPathWithRegex error => invalid match regex: %s - %s", matchRegex, err.Error())
|
||||
}
|
||||
px.Request.URL.Path = match.ReplaceAllString(px.Request.URL.Path, replacement)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user