Hide password in PASS debug lines without : in trailing param

This commit is contained in:
Alexey Sokolov
2021-06-01 21:55:35 +01:00
parent 15e2351d40
commit e7b6a771c6
3 changed files with 36 additions and 3 deletions

View File

@@ -29,11 +29,16 @@ CString CDebug::Filter(const CString& sUnfilteredLine) {
// If the line is a PASS command to authenticate to a server / znc
if (sUnfilteredLine.StartsWith("PASS ")) {
CString sPrefix = sUnfilteredLine.substr(0, sUnfilteredLine[5] == ':' ? 6 : 5);
CString sRest = sUnfilteredLine.substr(sPrefix.length());
VCString vsSafeCopy;
sUnfilteredLine.Split(":", vsSafeCopy);
sRest.Split(":", vsSafeCopy);
if (vsSafeCopy.size() > 1) {
sFilteredLine = vsSafeCopy[0] + ":<censored>";
sFilteredLine = sPrefix + vsSafeCopy[0] + ":<censored>";
} else {
sFilteredLine = sPrefix + "<censored>";
}
}