Skip to content

Commit e8ac9f6

Browse files
committed
Merge pull request #87 from gaudryc/force_brute_force_attack
Log brute force attack
2 parents 6661a69 + ca09e62 commit e8ac9f6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main/WebServer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,17 @@ namespace http {
810810
usrname = base64_decode(usrname);
811811
int iUser = -1;
812812
iUser = FindUser(usrname.c_str());
813-
if (iUser == -1)
813+
if (iUser == -1) {
814+
// log brute force attack
815+
_log.Log(LOG_ERROR, "Failed login attempt for '%s' !", usrname.c_str());
814816
return;
815-
if (m_users[iUser].Password != usrpass)
817+
}
818+
if (m_users[iUser].Password != usrpass) {
819+
// log brute force attack
820+
_log.Log(LOG_ERROR, "Failed login attempt for '%s' !", m_users[iUser].Username.c_str());
816821
return;
822+
}
823+
_log.Log(LOG_STATUS, "Login successfull : user '%s'", m_users[iUser].Username.c_str());
817824
root["status"] = "OK";
818825
root["title"] = "logincheck";
819826
m_pWebEm->m_actualuser = m_users[iUser].Username;

0 commit comments

Comments
 (0)