Nmap: Learning the Art of Network Scanning with Cool Flags!

Nmap: Learning the Art of Network Scanning with Cool Flags!

In the world of pen testing, Nmap stands out as a popular scanning tool. Nmap stands for Network Mapper, it’s an open-source Linux command-line tool. Basically, it scans IP addresses and ports in a network, identifying installed applications. Nmap helps network admins to pinpoint devices on their network, uncover open ports and services, and spot vulnerabilities. The credit for creating Nmap goes to Gordon Lyon, also known as Fyodor, who developed it to easily map networks, revealing open ports and services.

Well, to check if the device is up, what we use? Ping, right?

But what if we have to check in the whole network that which device is up?

nmap -sP <network-range>        

Nmap syntax is simple and looks like this:

nmap <scan types> <options> <target>        

To know all the options which nmap provides us, type:

nmap --help        

This is a bunch of commands for you, but don’t worry, I’ve narrowed it down to the coolest and most essential ones in each category.

A) Target Specification:

  1. Scanning hostname/ip address/networks:

nmap <ip-address>         

2. Getting input from the file (-iL):

nmap -iL <file-name>         

B) Host discovery:

  1. Disabling port scan (-sn) Ping Scan: This will check that which hosts are up in the given network.

nmap -sn <ip-range>        

C) Scan Techniques:

1. TCP-SYN Scan (-sS): By default scan. This only sends the SYN flag and thus doesn’t complete 3-way handshake. So, full connection of TCP is not made. If Nmap receives a SYN-ACK flag after it sends a SYN flag then it is marked open otherwise marked as close.

sudo nmap -sS <ip-address>        

2. TCP Connect Scan (-sT): This checks 3-way handshake. It is considered open if the target port responds with an SYN-ACK packet and closed if responds with RST (reset) packet. It is slower than TCP-SYN scan but also stealthier.

nmap -sT <ip-address>        

3. UDP Scan (-sU): doesn't require 3-way handshake. Less common.

sudo nmap <ip-address> -sU        

D) Port Specification:

1. Specifying the port:

sudo nmap <ip-address> -p <ports-to-scan>        

2. Giving the range of ports:

nmap <ip-address> -p 1–443        

3. Scan all ports:

nmap -p- <ip-address>        

4. Fast port scan (top 100):

nmap -F <ip-address>         

E) Service/ Version Detection:

  1. Getting the version of services (-sV):

nmap -sV <ip-address>        

2. Detailed version scan activity (?—?version-trace):

nmap --version-trace <ip-address>        

F) Script?Scan:

  1. Running default scripts (-sC):

nmap -sC <ip-address>         

G) OS Detection:

  1. Detecting the OS of host (-O):

sudo nmap -O <ip-address>        

H) Output:

  1. Saving output in a file (-o):

nmap <ip-address> -o <file-name>        

2. Getting output in 3 major formats (-oA):

nmap -sC <ip-address> -oA <file.name>        

3. Increasing Verbosity (-v): Provides more detailed information about the scanning process. To increase the verbosity strength, increase number of v’s (-vvv). It’s helpful for understanding what Nmap is doing and identifying any issues during the scan.

nmap -v <ip-address>        

4. Increasing Debugging (-d): used for troubleshooting and when trying to diagnose problems or understand the inner workings of Nmap. To increase the debugging strength, increase number of d’s (-ddd).

nmap -d <ip-address>        

5. Showing possibly open ports (?—?— open):

nmap --open <ip-address>        

I) MISC:

1. Aggressive Scan (-A): It’s a step up from the basics. You can trigger it using the -A flag. Essentially, it bundles together several scans we discussed earlier: service detection (-sV), OS detection (-O), traceroute (?—?— traceroute), and default scripts (-sC).

nmap -A <ip-address>         

Well, these are fundamental yet crucial CLI flags that one should familiarize themselves with before getting into hacking or pen-testing stuff.

This blog may receive updates with new flags later on. In the meantime, grasp these concepts, and don’t forget to engage in hands-on practical exercises. Feel free to share additional flags in the comments to enhance everyone’s knowledge! Also, I would recommend you to solve TryHackMe | Nmap room,?, it’s fun trust me.

Thanks for taking the time to check out this blog, you’re Awesome!

Connection: LinkedIn

Ritesh M.

MERN | Interested in Bug Bounty?? & CTF??

1 年

Love this ??

要查看或添加评论,请登录

Aastha Thakker的更多文章

  • Reverse Engineering Essentials — 2

    Reverse Engineering Essentials — 2

    After covering the basics of ISA architectures, CPU components, and clock speed, it’s time to understand the workings…

  • Reverse Engineering Essentials?-?1

    Reverse Engineering Essentials?-?1

    Hey everyone! In our last blog, we talked about what “engineering” really means, and how “reverse engineering” fits…

    2 条评论
  • Forward & Reverse Engineering

    Forward & Reverse Engineering

    How frequently do you hear the term “reverse engineering” in the cyber world? Often, right! To understand reverse…

  • AWS Practical — 1

    AWS Practical — 1

    Alright, let’s move from theory to practical! We’ve discussed the breadth of AWS capabilities, and now it’s time to get…

  • SOC: Human, Automation & AI Teaming to Beat Alert?Fatigue

    SOC: Human, Automation & AI Teaming to Beat Alert?Fatigue

    You’re stuck in a digital panic room. Every notification is a mini-heart attack.

  • MANETs: How Devices Create Their Own Social Networks

    MANETs: How Devices Create Their Own Social Networks

    In an era where our homes are getting smarter and our devices are increasingly interconnected, there’s a pressing…

    2 条评论
  • Satellite Hacking: Space?Wars

    Satellite Hacking: Space?Wars

    Hey there! How are you able to read this post? Is it the internet? Of course! But what’s the backbone of this…

    1 条评论
  • Digital Forensics and Anti-forensics

    Digital Forensics and Anti-forensics

    Hey Everyone! Just like our previous dive into purple teaming, this blog lays the groundwork for understanding both…

    2 条评论
  • Gen AI vs. Agentic AI

    Gen AI vs. Agentic AI

    Hey Everyone! Another AI blog post! (I can hear your eyes rolling from here.) But wait — before you close this tab…

    7 条评论
  • Purple Teaming: Turning Frenemies into Allies

    Purple Teaming: Turning Frenemies into Allies

    Remember Tom and Jerry? Those two were the ultimate frenemies. When they were fighting, they’d wreck the entire house.

    6 条评论

社区洞察

其他会员也浏览了