mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-14 00:47:21 +00:00
31 lines
916 B
Go
31 lines
916 B
Go
package privatekey
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func normalize(in string) string {
|
|
in = strings.ReplaceAll(in, `"`, "")
|
|
in = strings.ReplaceAll(in, `'`, "")
|
|
in = strings.ReplaceAll(in, "\t", "")
|
|
in = strings.ReplaceAll(in, `\t`, "")
|
|
in = strings.ReplaceAll(in, `\\t`, "")
|
|
in = strings.ReplaceAll(in, `\n`, "\n")
|
|
in = strings.ReplaceAll(in, `\\r\\n`, "\n")
|
|
in = strings.ReplaceAll(in, `\r\n`, "\n")
|
|
in = strings.ReplaceAll(in, "\r\n", "\n")
|
|
in = strings.ReplaceAll(in, `\\r`, "\n")
|
|
in = strings.ReplaceAll(in, "\r", "\n")
|
|
in = strings.ReplaceAll(in, `\r`, "\n")
|
|
in = strings.ReplaceAll(in, `\\n`, "\n")
|
|
in = strings.ReplaceAll(in, `\n\n`, "\n")
|
|
in = strings.ReplaceAll(in, "\n\n", "\n")
|
|
in = strings.ReplaceAll(in, `\\`, "\n")
|
|
|
|
cleaned := strings.Builder{}
|
|
parts := strings.Split(in, "\n")
|
|
for _, line := range parts {
|
|
cleaned.WriteString(strings.TrimSpace(line) + "\n")
|
|
}
|
|
return cleaned.String()
|
|
}
|