Defend your servers for 10 seconds
The public internet is sending a continuous wave toward your private network: 20 packets per second for 10 seconds, for a total of 200 packets. Write Python rules that block every bad request while allowing every legitimate request through.
Your servers share 100 health points. Each bad packet that reaches a server causes 2 damage. At zero health, the wave ends early.
Your firewall rules
The game supplies a fresh packet dictionary each time your code runs:
packet["port"] is the destination port.
packet["rate"] is the source's observed request rate, in requests per second.
Set action to "allow" or "block" with one if, elif, and else chain:
- Check the rate first: If
packet["rate"] > 1000, block the request, even on port 443.
- Then check the port: Otherwise, if
packet["port"] == 443, allow it.
- Block everything else: Use
else for the remaining traffic.
You do not need a loop, a function, or print(). Do not replace the supplied packet values.
Run the traffic wave
Complete your rules and press Run. The wave contains 120 bad requests and 80 legitimate requests, in the same order on every attempt so you can compare your changes.
- Bad request blocked: The packet breaks apart at the firewall. No damage.
- Bad request allowed: It reaches a server, causes a red flash, and removes 2 health points.
- Good request allowed: It reaches a server with a green pulse and increases the requests-served counter.
- Good request blocked: No health damage, but it counts as a filtering mistake.
The rule cards show how many requests each branch of your code handles. The health bar and counters update throughout the wave. Your rules stay fixed for the current wave; edits submitted while it is running are queued for the next one.
Spawning stops after 10 seconds, then the last packets finish traveling. To win, finish with 100 health, block all 120 bad requests, serve all 80 legitimate requests, and pass 25 additional rule checks. Blocking everything will not pass.
If your rules need work, the result shows an example packet and the decision it should have received. Fix your code and run the wave again.
Optional damage sound
A short warning sound plays when bad traffic damages a server, when sound is enabled and supported by your browser. Use the game's SOUND ON/OFF control or Server Academy's mute control. Damage flashes and health changes work even when muted.
Hint: Exactly 1000 is not above the limit. Check the rate before the port so high-rate HTTPS requests cannot slip through.
The visible 20-packets-per-second animation is separate from each source's packet["rate"] value. This is a simplified model for practicing Python conditionals, not a production firewall or DDoS mitigation system.