cybersecurity · beginner · ~15 min · safe pentest lab

Is the target in scope?

Enforce the scope list before acting.

Challenge

Enforce the engagement scope: confirm a target exactly matches the one authorised address before any action — anything outside scope is off-limits.

Task

Implement int in_scope(const char *target, const char *allowed) that returns 1 if target exactly matches the single allowed target string, and 0 otherwise.

Input

  • target: the address you are about to act on.
  • allowed: the single authorised target.

Both are NUL-terminated strings the grader provides.

Output

Returns 1 if the two strings are exactly equal, 0 otherwise.

Example

in_scope("10.0.0.5", "10.0.0.5")   ->   1
in_scope("10.0.0.6", "10.0.0.5")   ->   0

Edge cases

  • Only an exact match is in scope; any difference returns 0.

Input format

A target string and the single allowed target string.

Output format

1 if target exactly equals allowed; otherwise 0.

Constraints

Exact string match; anything outside scope is off-limits.

Starter code

#include <string.h>

int in_scope(const char *target, const char *allowed) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.