diff --git a/modules/http_proxy/http_proxy.go b/modules/http_proxy/http_proxy.go index e8eeaef3..4c96f12a 100644 --- a/modules/http_proxy/http_proxy.go +++ b/modules/http_proxy/http_proxy.go @@ -56,7 +56,7 @@ func NewHttpProxy(s *session.Session) *HttpProxy { mod.AddParam(session.NewStringParameter("http.proxy.sslstrip.replacements", "*.com:*.corn *.net:*.nel *.org:*.orq", "(.*:.*\\s*$)+", - "Space separated list of ':', and ordered by priority. Use '*' for any characters. Internationalized Domain Names are allowed. If the domain to strip isn't found in this parameter, the last char of the top-level domain will be duplicated.")) + "Space separated list of ':', and ordered by priority. Use '*' for any characters. Internationalized Domain Names are allowed.")) mod.AddHandler(session.NewModuleHandler("http.proxy on", "", "Start HTTP proxy.", diff --git a/modules/http_proxy/http_proxy_base_sslstriper.go b/modules/http_proxy/http_proxy_base_sslstriper.go index 148e68f7..6a42a44a 100644 --- a/modules/http_proxy/http_proxy_base_sslstriper.go +++ b/modules/http_proxy/http_proxy_base_sslstriper.go @@ -142,7 +142,7 @@ func (s *SSLStripper) processURL(url string) string { iPort = iEndHost } // search for domain's part to replace according to the settings - replaceto := "" + replaceto := url[:iPort] for _, r := range strings.Fields(s.replacements) { rep := strings.Split(r, ":") replacer := regexp.MustCompile("(?i)^" + strings.ReplaceAll(regexp.QuoteMeta(rep[0]), "\\*", "(.+)") + "$") //allow using * to designate any existing character + case insensitive @@ -159,13 +159,9 @@ func (s *SSLStripper) processURL(url string) string { break } } - if len(replaceto) != 0 { - // replace domain according to the settings & strip HTTPS port (if any) - url = replaceto + url[iEndHost:] - } else { - // double the last TLD's character & strip HTTPS port (if any) - url = url[:iPort] + string(url[iPort-1]) + url[iEndHost:] - } + + // replace domain according to the settings & strip HTTPS port (if any) + url = replaceto + url[iEndHost:] // finally we add the http schema url = "http://" + url diff --git a/modules/https_proxy/https_proxy.go b/modules/https_proxy/https_proxy.go index 569f9f61..61c12420 100644 --- a/modules/https_proxy/https_proxy.go +++ b/modules/https_proxy/https_proxy.go @@ -43,7 +43,7 @@ func NewHttpsProxy(s *session.Session) *HttpsProxy { mod.AddParam(session.NewStringParameter("https.proxy.sslstrip.replacements", "*.com:*.corn *.net:*.nel *.org:*.orq", "(.*:.*\\s*$)+", - "Space separated list of ':', and ordered by priority. Use '*' for any characters. You can use Internationalized Domain Names. If the domain to strip isn't found in this parameter, the last char of the top-level domain will be duplicated.")) + "Space separated list of ':', and ordered by priority. Use '*' for any characters. You can use Internationalized Domain Names.")) mod.AddParam(session.NewStringParameter("https.proxy.injectjs", "",