vnc所有帳號登陸的時候: 1.加入ip到一個列表(黑名單), 并記錄時間, 在這個時間上+10s鐘作為下一次連接拒絕時間。 2.登陸次數(shù)限制, 如果失敗超過5次, 則加入黑名黨, 再等10s后才能登陸。 請 ...
vnc所有帳號登陸的時候:
1.加入ip到一個列表(黑名單), 并記錄時間, 在這個時間上+10s鐘作為下一次連接拒絕時間。
2.登陸次數(shù)限制, 如果失敗超過5次, 則加入黑名黨, 再等10s后才能登陸。
請看下面代碼:
void
vncServer::AddAuthHostsBlacklist(const char *machine)
{
omni_mutex_lock l(m_clientsLock);
// -=- Is the specified host blacklisted?
vncServer::BlacklistEntry *current = m_blacklist;
// Get the current time as a 64-bit value
SYSTEMTIME systime;
FILETIME ftime;
LARGE_INTEGER now;
GetSystemTime(&systime);
SystemTimeToFileTime(&systime, &ftime);
now.LowPart=ftime.dwLowDateTime;now.HighPart=ftime.dwHighDateTime;
now.QuadPart /= 10000000; // Convert it into seconds
while (current)
{
// Is this the entry we're interested in?
if (_stricmp(current->_machineName, machine) == 0)
{
// If the host is already blocked then ignore
if (current->_blocked)
return;
// Set the RefTime & failureCount
current->_lastRefTime.QuadPart = now.QuadPart + 10;
current->_failureCount++;
if (current->_failureCount > 5)
current->_blocked = TRUE;
判定函數(shù)代碼:
while (current)
{
// Has the blacklist entry timed out?
if ((now.QuadPart - current->_lastRefTime.QuadPart) > 0) {////當(dāng)前時間超過隔離時間?即如果10s鐘后
// Yes. Is it a "blocked" entry?
if (current->_blocked)
{
// Yes, so unblock it & re-set the reference time
current->_blocked = FALSE; ///超過10s, 解除黑名單
current->_lastRefTime.QuadPart = now.QuadPart + 10;
} else
{
// No, so remove it
if (previous)
previous->_next = current->_next;
else
m_blacklist = current->_next;
vncServer::BlacklistEntry *next = current->_next;
free(current->_machineName);
delete current;
current = next;
continue;
}
}
// Is this the entry we're interested in?
if ((_stricmp(current->_machineName, hostname) == 0) &&/////比較是否再黑名單里面
(current->_blocked))
{
// Machine is blocked, so just reject it
vnclog.Print(LL_CONNERR, VNCLOG("client %s rejected due to blacklist entry\n"), hostname);
return vncServer::aqrReject;
}
previous = current;
current = current->_next;
}
// Has a hostname been specified?
if (hostname == 0) {
vnclog.Print(LL_INTWARN, VNCLOG("verify failed - null hostname\n"));
return vncServer::aqrReject;
}
。剑剑剑剑剑剑剑剑剑剑剑剑剑剑剑剑剑
以上原因決定了vnc弱口令掃描的特點:
1.密碼最多只能超過5次出錯, 然后就會被鎖定, 需要10s鐘解鎖。
2.出錯超過5次后每猜解一個密碼, 都會被鎖定, 所以后面的密碼猜解非常慢(每一個隔10s)。