Browse Source

HID bot detect: 3 temporary lockouts = permanent lockout

USG_1.0
Robert Fisk 4 years ago
parent
commit
0c7cc00c0a
  1. 20
      Upstream/Src/upstream_hid_botdetect.c

20
Upstream/Src/upstream_hid_botdetect.c

@ -19,9 +19,9 @@
//Variables common between keyboard and mouse bot detection:
uint32_t TemporaryLockoutTimeMs;
volatile LockoutStateTypeDef LockoutState = LOCKOUT_STATE_INACTIVE;
uint32_t TemporaryLockoutTimeMs;
uint8_t TemporaryLockoutCount = 0;
//Variables specific to keyboard bot detection:
@ -201,6 +201,14 @@ static void Upstream_HID_BotDetectKeyboard_DoLockout(void)
return;
}
//Three (temporary) strikes -> you're out!
if (++TemporaryLockoutCount >= 3)
{
LockoutState = LOCKOUT_STATE_PERMANENT_ACTIVE;
LED_SetState(LED_STATUS_FLASH_BOTDETECT);
return;
}
//Otherwise, reset counters and give warning
for (i = 0; i < KEYBOARD_BOTDETECT_FAST_BIN_COUNT; i++)
{
@ -572,6 +580,14 @@ static void Upstream_HID_BotDetectMouse_DoLockout(void)
return;
}
//Three (temporary) strikes -> you're out!
if (++TemporaryLockoutCount >= 3)
{
LockoutState = LOCKOUT_STATE_PERMANENT_ACTIVE;
LED_SetState(LED_STATUS_FLASH_BOTDETECT);
return;
}
//Otherwise, reset counters and give warning
for (i = 0; i < MOUSE_BOTDETECT_VELOCITY_HISTORY_SIZE; i++)
{

Loading…
Cancel
Save