45. Practice Exercises with Hints
45.1 How to Use These Exercises – Ethics First
Revision rule: read question → try 5 minutes → then Hint → then Lab. Do not jump to Hint first. Offensive verbs (nmap, sqlmap, hydra) = OWN IP list only.
How to score yourself (simple):
- Green – solved without Hint
- Yellow – solved after Hint
- Red – needed Lab walkthrough; rewrite answer in own words tomorrow
Ethics checklist before every session: sticky note with lab IPs; ip a on Kali shows host-only; written "I own this lab"; snapshot before weakening.
| Exercise | Task | Hint |
|---|---|---|
| E1 | Write 5 lines: when is scanning legal in India-focused practice? | Own systems + written authorisation; IT Act awareness; lab IPs on paper |
| E2 | List three things that are never targets in this book | Classmate phones, cafe Wi-Fi clients, client production without permission |
| E3 | Draw your host-only map: Kali / Metasploitable / DVWA IPs | Book plan: .10 / .20 / .30 – adjust if your lab differs; never bridge DC |
| E4 | Explain "hint discipline" in two sentences (classroom voice OK) | Try first; Hint is teacher whisper, not copy-paste for interview |
| E5 | Pair with Zoya: she is Red (lab only); you are Blue – switch roles after 10 min | Purple mindset: same chain, different goal |
| Red team (attacker) does | Blue team (defender) detects / stops |
|---|---|
Skips scope; scans 192.168.1.0/24 "by mistake" |
Host-only adapter; written IP list; firewall deny other subnets |
| Treats Hint as exploit recipe for live sites | Hints stay in lab notes; production = report + fix only |
Ravindra Bagale's Tip
Students say "just one try on the office Wi-Fi". That means the end of your career + legal risk. CEH exam modules also put authorization first. Sticky note + host-only. Remember this.
Ravindra Bagale's Tip – मराठी
Students "फक्त एकदा office Wi-Fi try" म्हणतात. हे career end + legal risk. CEH exam modules पण authorization first. Sticky note + host-only. लक्षात ठेवा.
Ravindra Bagale's Tip – हिंदी
Students कहते हैं "बस एक बार office Wi-Fi try". यह career end + legal risk है. CEH exam modules भी authorization first. Sticky note + host-only. याद रखो.
Lab
Open notebook: title Ethics gate. Paste your three lab IPs, one sentence IT Act reminder, and signature "I own this lab – Ravindra Bagale student notes". Photo for portfolio (no real org names).
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.