| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A retro arcade game for learning to identify secure vs. insecure code patterns. Defend against vulnerable code blocks in this Space Invaders-inspired security training tool!
Code Invaders is a browser-based arcade game that helps developers recognize secure coding practices, identify vulnerabilities, and spot malware patterns through engaging gameplay.
💡 Pro Tip: Tap/click code blocks to read them in full while the game continues running!
All code blocks are displayed with cyan borders and syntax highlighting for easy reading.
✅ Secure Code
⚠️ Insecure Code (Vulnerabilities)
☠️ Malware
| Action | Points |
|---|---|
| Hit Insecure Block | +10 |
| Hit Malware Block | +25 |
| Hit Secure Block | -15 |
| Insecure Reaches Base | -20 |
| Malware Reaches Base | -40 |
| Secure Reaches Base | +2 |
| Combo (3+ streak) | 1.5x multiplier |
The game ends when:
Clone or download this repository
Install TypeScript compiler (if not already installed):
npm install -g typescriptCompile TypeScript to JavaScript:
tsc src/main.ts --outDir dist --target ES6 --lib ES6,DOMServe the game:
Option A: Using Python
python3 -m http.server 8000Option B: Using Node.js
npx http-server -p 8000Option C: Using VS Code Live Server extension
Open in browser: Navigate to http://localhost:8000
code-invaders/ │ ├── index.html # Main HTML file ├── styles.css # Game styling and UI ├── snippets.json # Code snippets database ├── code-invaders-trend-pack-annotated.json # Rich annotated snippets (auto-loaded) ├── assets/ │ └── images/ │ └── player-ship.png # Custom player ship icon ├── src/ │ └── main.ts # TypeScript game source code ├── dist/ │ └── main.js # Compiled JavaScript (generated) ├── README.md # This file └── DEPLOYMENT-GUIDE.md # How to deploy live
The game follows a clean entity-component architecture:
Game State Management
Entity System
Game Loop
Collision Detection
Difficulty Scaling
Edit the CONFIG object in src/main.ts:
const CONFIG = {
// Adjust player speed
player: {
speed: 300, // Pixels per second
shootCooldown: 0.25, // Seconds between shots
},
// Modify block behavior
block: {
initialSpeed: 60, // Starting fall speed
speedIncrement: 5, // Speed increase per level
},
// Change scoring
scoring: {
hitInsecure: 10,
hitMalware: 25,
hitSecure: -15,
// ... etc
},
// Adjust difficulty curve
difficulty: {
levelDuration: 15, // Seconds per level
malwareChanceStart: 0.15, // 15% initially
malwareChanceMax: 0.35, // Max 35%
},
};Easy! Just edit snippets.json - no coding required:
{
"secure": [
"stmt = conn.prepare(\"SELECT * FROM users WHERE id=?\")",
"bcrypt.hash(password, 12)",
"Add your new secure example here"
],
"insecure": [
"query = \"SELECT * FROM users WHERE id=\" + userId",
"eval(userInput)",
"Add your new vulnerability example here"
],
"malware": [
"eval(atob(\"dmFyIGE9ZG9jdW1lbnQuY29va2ll\"))",
"Add your new malware pattern here"
]
}The game automatically loads snippets from this file on startup. Just refresh the browser to see your changes!
This game teaches recognition of:
# Make sure you're in the project root
tsc src/main.ts --outDir dist --target ES6 --lib ES6,DOMPotential additions:
Want to publish your game online? See DEPLOYMENT-GUIDE.md for complete instructions!
Quick Deploy:
./deploy-prep.shThen choose from:
This project is provided as-is for educational purposes. Feel free to modify and extend!
Built as a secure coding training tool combining gaming and education.
Ready to defend against insecure code? Load up and start playing! 🎮🔐
| Back | FazBrowse Home | New Git URL |