Add proxy support in device codes

Add clear device codes for campaign
This commit is contained in:
Ronni Skansing
2026-03-26 16:03:19 +01:00
parent 7852659520
commit 73b3287137
12 changed files with 282 additions and 23 deletions
+12
View File
@@ -2,11 +2,23 @@ package utils
import (
"path"
"regexp"
"strconv"
"github.com/phishingclub/phishingclub/errs"
)
// credentialsPattern matches userinfo (user, or user:pass) inside a URL authority component.
// it captures scheme://user:pass@host and scheme://user@host forms.
var credentialsPattern = regexp.MustCompile(`(?i)([a-z][a-z0-9+\-.]*://)([^@/\s]+@)`)
// RedactCredentialsFromString replaces any embedded URL credentials (user:pass@ or user@) found
// in s with the scheme and host only, so the result is safe to write to logs or error messages.
// e.g. "socks5://proxyuser:SecretDino123@10.0.0.1:1080" → "socks5://10.0.0.1:1080"
func RedactCredentialsFromString(s string) string {
return credentialsPattern.ReplaceAllString(s, "$1")
}
// Substring returns a substring of the input text from the start index to the end index.
// If the start index is less than 0, it is set to 0.
// If the end index is greater than the length of the text, it is set to the length of the text.