Safe Penetration Testing Labs · intermediate · ~15 min
Compute a heuristic phishing score from a URL string.
Find the host part between // and /; count signals one-by-one; return the total.
Most phishing detectors are layered: structural smells first, then ML, then live fetch. Layer one is the cheapest and quickest.
Phishing URL detectors look at structural smells before they look at
content: too many dots, embedded IPs, IDN punycode, @ in the
authority, dashes inside the second-level domain, suspiciously long
hostnames.
We score those signals. We do not fetch the URL.
@ (authority spoofing).login123).xn-- (IDN punycode — neutral signal, but often
abused).paypal, apple, bank, microsoft, google, amazon).Implement int phishy_score(const char *url). Sum the scores and
return the total. NULL → -1.
xn-- is a prefix of a label, not a substring of
the whole URL (it's still useful as a flag here).Six rules, one pass over the hostname, integer score.