Leviathan Level 6
Leviathan Level 6 — a program wants a four-digit code; learn to brute-force a small secret with a shell loop.
Table of Contents
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
There is no information for this level, intentionally.
Study guide
Level map: logged in as leviathan6, find the password for leviathan7.
What this level teaches
Automating a guessing attack on a small search space.
Key ideas
- Search space. A four-digit code has only 10,000 possibilities.
- Loops. A
forloop withseqandprintfcan generate every candidate, including leading zeros. - Detecting success. The program behaves differently on a wrong and a right code, so your loop can stop when the output changes.
How to approach it
- Run the program once by hand to learn its arguments and failure behaviour.
- Write a loop that tries each value and prints only the interesting result.
Why it matters
It shows why short numeric codes need rate limiting, and gives you practice with shell automation for later games.