Skip to main content

Command Palette

Search for a command to run...

πŸš€ Nmap: The Basics β€” A Beginner-Friendly Guide (TryHackMe Walkthrough)

Published
β€’4 min readβ€’View as Markdown
S

This blog serves as a beginner-friendly guide to understanding the world of cybersecurity. From defining what cybersecurity is to exploring its two major domainsβ€”offensive and defensive securityβ€”it breaks down various career paths such as Security Analyst, Engineer, Penetration Tester, and more. Whether you're just curious or planning a career, this blog gives you the insight and direction to get started in the cybersecurity field.

πŸš€ Nmap: The Basics β€” A Beginner-Friendly Guide (TryHackMe Walkthrough)

If you’re stepping into cybersecurity or penetration testing, one tool you must master is Nmap. In this blog, I’ll walk you through the fundamentals of Nmap in a simple, Google-friendly format β€” covering host discovery, port scanning, service detection, timing control, output handling, and more.

Let’s dive in. πŸ‘‡


πŸ”Ž What is Nmap?

https://upload.wikimedia.org/wikipedia/commons/7/73/Logo_nmap.png

https://www.cyberciti.biz/media/new/cms/2012/11/welcome-nmap.png

https://www.techtarget.com/rms/onlineimages/nmap-image6-h_half_column_mobile.jpg

4

Nmap (Network Mapper) is an open-source network scanning tool used for:

  • Discovering live hosts

  • Finding open ports

  • Detecting running services

  • Identifying service versions

  • Guessing operating systems

  • Saving detailed scan reports

It was first released in 1997 and is now one of the most powerful tools in cybersecurity.


πŸ–₯️ 1. Host Discovery β€” Who Is Online?

Before scanning ports, we need to know which systems are alive.

πŸ“Œ Command:

nmap -sn 192.168.1.0/24

What -sn Does:

  • Performs a ping scan

  • Discovers live hosts

  • Does NOT scan ports

Target Formats You Can Use:

  • IP Range β†’ 192.168.1.1-10

  • Subnet β†’ 192.168.1.0/24

  • Hostname β†’ example.com

πŸ”Ή Local Network Scanning

If you're directly connected (WiFi/Ethernet), Nmap uses ARP requests.

πŸ”Ή Remote Network Scanning

If routers are involved, Nmap uses:

  • ICMP Echo

  • TCP SYN probes

  • TCP ACK probes


πŸ”“ 2. Port Scanning β€” Who Is Listening?

Every device has 65,535 TCP and 65,535 UDP ports.

Let’s explore the main scan types.


πŸ”Ή TCP Connect Scan (-sT)

nmap -sT target_ip
  • Completes full TCP 3-way handshake

  • Easy to detect

  • Default when running without sudo


πŸ”Ή TCP SYN Scan (-sS) β€” Stealth Scan

sudo nmap -sS target_ip
  • Sends SYN packet only

  • Does not complete handshake

  • Faster and stealthier

  • Requires sudo/root


πŸ”Ή UDP Scan (-sU)

sudo nmap -sU target_ip

Used to detect:

  • DNS (53)

  • DHCP

  • SNMP

  • NTP


πŸ”Ή Limiting Ports

OptionMeaning
-FScan top 100 ports
-p10-100Scan port range
-p-Scan all 65,535 ports

🧠 3. Version & OS Detection

https://miro.medium.com/0%2AsakZmwSHlIQmw7O0.jpg

https://www.linux.org/attachments/figure-02-jpg.700/

https://us1.discourse-cdn.com/flex015/uploads/ine/original/1X/c18170c30a8c69a20a5c8f7d6304b490a82e744b.png

4


πŸ”Ή Service Version Detection (-sV)

sudo nmap -sV target_ip

Shows:

  • Service name

  • Version number

Example:

lighttpd 1.4.74

πŸ”Ή OS Detection (-O)

sudo nmap -O target_ip

Makes an educated guess about the OS.


πŸ”Ή Aggressive Scan (-A)

sudo nmap -A target_ip

Enables:

  • OS detection

  • Version detection

  • Traceroute

  • Script scanning


πŸ”Ή Force Scan Even If Host Appears Down

nmap -Pn target_ip

Treats all hosts as online.


⚑ 4. Timing Control β€” How Fast Should You Scan?

https://cdn.vectorstock.com/i/1000v/62/51/cybersecurity-rocket-shield-analysis-vector-59846251.jpg

https://cdn.vectorstock.com/i/1000v/34/20/5g-network-internet-speed-with-speedometer-concept-vector-38213420.jpg

https://forum.hackersploit.org/uploads/default/original/2X/f/f2e165154e5724bba744a951f3a267087526468a.gif

4

Nmap provides 6 timing templates:

OptionName
-T0paranoid
-T1sneaky
-T2polite
-T3normal
-T4aggressive
-T5insane

Example:

nmap -T4 target_ip

Advanced Controls:

  • --min-rate 100

  • --max-rate 500

  • --host-timeout 30s

  • --min-parallelism

  • --max-parallelism


πŸ“Š 5. Output & Reporting

πŸ”Ή Verbosity

OptionMeaning
-vVerbose
-vvMore verbose
-dDebug mode
-d9Maximum debug

πŸ”Ή Saving Reports

OptionFormat
-oN file.txtNormal
-oX file.xmlXML
-oG file.gnmapGrepable
-oA scanAll formats

Example:

nmap -sS target_ip -oA report

Creates:

  • report.nmap

  • report.xml

  • report.gnmap


πŸ“ All Answers (From This Room)

Here are all the answers gathered together:

  1. Last IP in 192.168.0.1/27 β†’
    192.168.0.31

  2. Number of open TCP ports on 10.49.183.215 β†’
    6

  3. Flag from web server β†’
    THM{SECRET_PAGE_38B9P6}

  4. Web server name and version β†’
    lighttpd 1.4.74

  5. Non-numeric equivalent of -T4 β†’
    -T aggressive

  6. Debugging option β†’
    -d

  7. Scan used when running without sudo β†’
    Connect Scan (-sT)


🎯 Conclusion

In this room, we learned:

  • Host discovery (-sn)

  • TCP & UDP scanning (-sS, -sT, -sU)

  • Port range control (-p, -F)

  • Version detection (-sV)

  • OS detection (-O)

  • Aggressive scanning (-A)

  • Timing control (-T0 to -T5)

  • Debugging (-d)

  • Saving reports (-oN, -oX, -oA)

πŸ’‘ Important Tip:
Always run Nmap with sudo to unlock its full power.

More from this blog

A

A's BLACKHOLE

76 posts

This blog serves as a beginner-friendly guide to understanding the world of cybersecurity.