cybersecurity · beginner · ~15 min · safe pentest lab
Apply an alerting threshold.
Turn a raw failed-login count into an actionable alert by comparing it against a threshold.
Implement int is_bruteforce(int failed_count, int threshold) that returns 1 if the count meets or exceeds the threshold, else 0.
failed_count: the number of failed logins observed.threshold: the alerting threshold.Returns int: 1 if failed_count >= threshold, else 0.
is_bruteforce(12, 10) -> 1
is_bruteforce(3, 10) -> 0
is_bruteforce(10, 10) -> 1 (meets the threshold)
Two ints: failed_count and threshold.
An int: 1 if failed_count >= threshold, else 0.
The threshold is inclusive (>=).
int is_bruteforce(int failed_count, int threshold) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.