49. Cheat Sheets
Chala mitrano, Part 13 continue – aata cheat sheets. Linux, MySQL, Nmap, Metasploit – ek page style revision cards. Exam / interview / lab madhe flag rattne sathi nahi – quick recall + Blue control sathi. Ethics pehle: he sheets attack cookbook nahi. OWN lab, host-only 192.168.56.x, written authorisation. Cafe / neighbour / client target – never. Ghabru naka – print kara, Blue column lakshat theva, Project finish kara. He khup important aahe, lakshat theva!
What you will practise in this chapter
- How to use cheat sheets for revision (not as attack recipes)
- Linux day-to-day commands on Amazon Linux (
sudo yum/sudo service) with Blue notes - MySQL connect / CRUD / SELECT / keys / GRANT / safe updates / backup awareness
- Nmap host discovery and gentle lab scans (
-T2) with OWN-IP ethics - Metasploit workflow awareness on Metasploitable only (detect / patch mindset)
- One combined revision card: situation → tool recall → Blue control
- Project Build-Hack-Fix + real incidents for scan / exposure hygiene
Lab scope
Cheat sheets list commands. Every offensive-looking flag means only systems you own: host-only VirtualBox (Kali 192.168.56.10, Metasploitable 192.168.56.20, DVWA/Juice 192.168.56.30–.50), your Free Tier EC2, or your emulator. Never Nmap a cafe Wi-Fi, never Metasploit a neighbour phone, never mysqldump a client production DB without written scope. IT Act sections such as 43 and 66 apply without authority (verify current text). Lab = learn. Production = defend. Sheets = revision, not permission.
Concepts in this chapter
- 49.1How to Use These Cheat Sheets
- 49.2Linux Cheat Sheet
- 49.3MySQL Cheat Sheet
- 49.4Nmap Cheat Sheet
- 49.5Metasploit Cheat Sheet (OWN lab only)
- 49.6Quick Combined Revision Card
- 49.7Red vs Blue, Project and Real Incidents
The chapter recap is at the end of the last concept page.
Chapter 49: Cheat sheets — practice tasks
Open chapter lessons · Full guided lab: defensive command cheat sheet tested (not repeated here)
49.1 Personal 20-command sheet
EasyITWhy: Your own sheet beats copying.
What: Write 20 commands you actually use, with one-line why.
How:
- Include ss, find, grep, ufw, journalctl, curl, dig, chmod.
- Test each once.
Expected output: 20 commands + why.
Hint
See linked defensive cheat sheet.
Answer / how to check
- Every command tested today.
49.2 One-page incident commands
MediumBankingWhy: Under stress you need a short list.
What: List commands for: who logged in, failed SSH, listening ports, recent files.
How:
- last; journalctl/grep Failed; ss -tulpn; find /tmp -mtime -1.
- Print and keep offline.
Expected output: One A4 page.
Hint
No attack commands on this page.
Answer / how to check
- Four sections present.
49.3 Windows equivalents
EasyLogisticsWhy: Many jobs are mixed OS.
What: Match Linux → Windows.
How:
- ss → netstat/Get-NetTCPConnection; grep → findstr/Select-String; chmod → icacls.
Expected output: A 5-row table.
Hint
Try each on a Windows lab if you have one.
Answer / how to check
- Five pairs listed.
Extended teaching notes
Why this lesson matters
Use this lesson to strengthen systems you own: understand the risk, practise safely in a lab, then write and apply the fix.
Apply the fix across stacks
Same class of bug, same idea in every language.
Java / Spring Boot
Parameterise queries, encode output, CSRF tokens, limited Actuator, dependency scanning.
ASP.NET Core
EF Core / parameterised SQL, Razor encoding, HTTPS, Data Protection.
Node.js / Express
helmet, parameterised SQL, npm audit, avoid eval and shell concat.
Python / Django / Flask / FastAPI
ORM, autoescape, pip-audit, Bandit; never shell=True with user input.
PHP / Laravel
PDO/Eloquent, Blade escaping, composer audit.
Go / Ruby
database/sql placeholders / ActiveRecord; html/template / ERB escaping; govulncheck / Brakeman.
nginx / Apache / Tomcat
Hide versions, TLS, security headers, least-open ports.
MySQL / PostgreSQL / MongoDB / Redis
Private networks, auth on, least-privilege users, no 0.0.0.0/0.
AWS / Azure / GCP
Roles not long-lived keys, private data stores, cloud audit logs on.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.