mirror of
https://github.com/bettercap/bettercap
synced 2025-08-22 06:23:18 -07:00
Removed default behavior for domain stripping
This commit is contained in:
parent
b24d783f0b
commit
8357b266a3
3 changed files with 6 additions and 10 deletions
|
@ -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 '<original_domain>:<stripped_domain>', 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 '<original_domain>:<stripped_domain>', and ordered by priority. Use '*' for any characters. Internationalized Domain Names are allowed."))
|
||||
|
||||
mod.AddHandler(session.NewModuleHandler("http.proxy on", "",
|
||||
"Start HTTP proxy.",
|
||||
|
|
|
@ -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:]
|
||||
}
|
||||
|
||||
// finally we add the http schema
|
||||
url = "http://" + url
|
||||
|
|
|
@ -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 '<original_domain>:<stripped_domain>', 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 '<original_domain>:<stripped_domain>', and ordered by priority. Use '*' for any characters. You can use Internationalized Domain Names."))
|
||||
|
||||
mod.AddParam(session.NewStringParameter("https.proxy.injectjs",
|
||||
"",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue