cybersecurity · beginner · ~15 min · safe pentest lab

Brute-force threshold reached?

Apply an alerting threshold.

Challenge

Turn a raw failed-login count into an actionable alert by comparing it against a threshold.

Task

Implement int is_bruteforce(int failed_count, int threshold) that returns 1 if the count meets or exceeds the threshold, else 0.

Input

  • failed_count: the number of failed logins observed.
  • threshold: the alerting threshold.

Output

Returns int: 1 if failed_count >= threshold, else 0.

Example

is_bruteforce(12, 10)   ->   1
is_bruteforce(3, 10)    ->   0
is_bruteforce(10, 10)   ->   1   (meets the threshold)

Edge cases

  • A count exactly equal to the threshold triggers the alert.

Input format

Two ints: failed_count and threshold.

Output format

An int: 1 if failed_count >= threshold, else 0.

Constraints

The threshold is inclusive (>=).

Starter code

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.