19. Information Gathering and Scanning
19.8 Timing, Output Formats and Scan Hygiene
Timing templates control speed and stealth:
| Template | Name | Use |
|---|---|---|
-T0 / -T1 |
paranoid / sneaky | Very slow, for IDS evasion studies |
-T2 |
polite | Uses less bandwidth |
-T3 |
normal | Default |
-T4 |
aggressive | Fast, good for your lab and reliable networks |
-T5 |
insane | May miss ports; avoid |
Always save output – a scan you did not save is a scan you will have to repeat:
sudo nmap -sC -sV -oN scan.txt 192.168.56.20 # normal text, easy to read
sudo nmap -sC -sV -oX scan.xml 192.168.56.20 # XML, for tools and reports
sudo nmap -sC -sV -oG scan.gnmap 192.168.56.20 # grepable
sudo nmap -sC -sV -oA msf2_full 192.168.56.20 # all three at once (best habit)
grep "open" msf2_full.gnmap # quick filter
xsltproc msf2_full.xml -o msf2_full.html # turn XML into an HTML report
A professional workflow on one target looks like this:
mkdir -p ~/lab/msf2/nmap && cd ~/lab/msf2/nmap
sudo nmap -sn 192.168.56.0/24 -oA 01_hosts # 1. who is alive
sudo nmap -p- -T4 192.168.56.20 -oA 02_allports # 2. every open TCP port
sudo nmap -sC -sV -p 21,22,80 192.168.56.20 -oA 03_services # 3. details only on open ports
sudo nmap -sU --top-ports 50 192.168.56.20 -oA 04_udp # 4. top UDP ports
Ravindra Bagale's Tip
Students scan, look at the output on screen, and close the terminal. Two days later, when writing the report, there's nothing! Always use -oA and keep a separate folder for each target. The report is an ethical hacker's real product – not the scan.
Ravindra Bagale's Tip – मराठी
Students scan करतात, screen वर output बघतात, आणि terminal बंद करतात. दोन दिवसांनी report लिहिताना काहीच नाही! नेहमी -oA वापरा आणि प्रत्येक target साठी वेगळा folder ठेवा. Report हा ethical hacker चा खरा product आहे – scan नाही.
Ravindra Bagale's Tip – हिंदी
Students scan करते हैं, screen पर output देखते हैं, और terminal बंद कर देते हैं. दो दिन बाद report लिखते समय कुछ नहीं! हमेशा -oA इस्तेमाल करो और हर target के लिए अलग folder रखो. Report ही ethical hacker का असली product है – scan नहीं.
Lab
Follow the four-step workflow above against Metasploitable 2 and keep all output files. Convert 03_services.xml to HTML with xsltproc and open it in Firefox inside Kali.