Attacks and brute force
How attackers get in
- Beyond malware, attackers use direct attacks. The exam lists several:
- Brute-force attack — trying every possible password until one works.
- Hacking — gaining access without permission, often through a weakness.

Attacks on the network
- Data interception — "listening in" on data as it travels, to steal it (a packet sniffer).
- Denial of Service (DoS) — flooding a server with so many requests that it cannot serve real users.
- A DDoS does this from thousands of machines at once, so it is hard to block.
Why short passwords fail
- A 4-digit PIN has only 10,000 combinations. A computer tries millions per second.
- Below, brute-force a PIN by trying every value — then notice how a longer password would have far more combinations.
The lesson
- Each extra character multiplies the number of guesses needed.
- That is why length is the single most powerful thing about a password — more on that soon.
Covers: IGCSE 5.3 (brute-force, hacking, interception, DDoS).
Common mistakes
- A brute-force attack tries every combination — a longer password makes it far slower.
- Rate-limiting and account lockouts help defend against it.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
A 4-digit PIN has only 10000 possibilities — a computer can try them all in an instant. Loop through range(10000) וגם print the value that equals the secret, then stop.
לחץ על הרץ כדי לראות את התוצא כאן.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
See why אורך wins. A lowercase-letters password has 26 ** length combinations. Print the number of combinations for length 4, then for length 8 — watch it explode.
לחץ על הרץ כדי לראות את התוצא כאן.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
A lockout stops brute force. Write login(attempts, pin). Go through the guesses in attempts in order: return "unlocked" at the first correct one, but return "locked" as soon as 3 wrong guesses have been made. If the guesses run out first, return "waiting".
לחץ על הרץ כדי לראות את התוצא כאן.