cybersecurity · beginner · ~15 min · safe pentest lab

Is the scan target allowed?

Restrict a scanner to loopback.

Challenge

Implement int scan_allowed(const char *host) returning 1 only for "127.0.0.1", "localhost", or "::1"; any other host returns 0.

Starter code

#include <string.h>

int scan_allowed(const char *host) {
    /* TODO */
    return 0;
}

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