add YAML serialization for ruleset

This commit is contained in:
Kevin Pham
2023-12-04 19:55:50 -06:00
parent b39955025e
commit 6157d6543f
8 changed files with 238 additions and 38 deletions

View File

@@ -1,13 +1,18 @@
package requestmodifiers
import (
"fmt"
"regexp"
"ladder/proxychain"
)
func ModifyDomainWithRegex(match regexp.Regexp, replacement string) proxychain.RequestModification {
func ModifyDomainWithRegex(matchRegex string, replacement string) proxychain.RequestModification {
match, err := regexp.Compile(matchRegex)
return func(px *proxychain.ProxyChain) error {
if err != nil {
return fmt.Errorf("RequestModification :: ModifyDomainWithRegex error => invalid match regex: %s - %s", matchRegex, err.Error())
}
px.Request.URL.Host = match.ReplaceAllString(px.Request.URL.Host, replacement)
return nil
}