NMAP

NMAP

Nmap is short for Network Mapper. It is an open-source Linux command-line tool that is used to scan IP addresses and ports in a network and to detect installed applications.

Nmap allows network admins to find which devices are running on their network, discover open ports and services, and detect vulnerabilities.

Gordon Lyon (pseudonym Fyodor) wrote Nmap as a tool to help map an entire network easily and to find its open ports and services.

Nmap has become hugely popular, being featured in movies like The Matrix and the popular series Mr. Robot.

Why use Nmap?

There are a number of reasons why security pros prefer Nmap over other scanning tools.

First, Nmap helps you to quickly map out a network without sophisticated commands or configurations. It also supports simple commands (for example, to check if a host is up) and complex scripting through the Nmap scripting engine.

Other features of Nmap include:

  • Ability to quickly recognize all the devices including servers, routers, switches, mobile devices, etc on single or multiple networks.
  • Helps identify services running on a system including web servers, DNS servers, and other common applications. Nmap can also detect application versions with reasonable accuracy to help detect existing vulnerabilities.
  • Nmap can find information about the operating system running on devices. It can provide detailed information like OS versions, making it easier to plan additional approaches during penetration testing.
  • During security auditing and vulnerability scanning, you can use Nmap to attack systems using existing scripts from the Nmap Scripting Engine.
  • Nmap has a graphical user interface called Zenmap. It helps you develop visual mappings of a network for better usability and reporting.Stealth scan

Stealth scanning is performed by sending an SYN packet and analyzing the response. If SYN/ACK is received, it means the port is open, and you can open a TCP connection.

However, a stealth scan never completes the 3-way handshake, which makes it hard for the target to determine the scanning system.

> nmap -sS scanme.nmap.org
        

You can use the ‘-sS’ command to perform a stealth scan. Remember, stealth scanning is slower and not as aggressive as the other types of scanning, so you might have to wait a while to get a response.

Version scanning

Finding application versions is a crucial part in penetration testing.

It makes your life easier since you can find an existing vulnerability from the Common Vulnerabilities and Exploits (CVE) database for a particular version of the service. You can then use it to attack a machine using an exploitation tool like Metasploit.

> nmap -sV scanme.nmap.org
        

To do a version scan, use the ‘-sV’ command. Nmap will provide a list of services with its versions. Do keep in mind that version scans are not always 100% accurate, but it does take you one step closer to successfully getting into a system.

OS Scanning

In addition to the services and their versions, Nmap can provide information about the underlying operating system using TCP/IP fingerprinting. Nmap will also try to find the system uptime during an OS scan.

> nmap -sV scanme.nmap.org
        

You can use the additional flags like osscan-limit to limit the search to a few expected targets. Nmap will display the confidence percentage for each OS guess.

Again, OS detection is not always accurate, but it goes a long way towards helping a pen tester get closer to their target.

Aggressive Scanning

Nmap has an aggressive mode that enables OS detection, version detection, script scanning, and traceroute. You can use the -A argument to perform an aggressive scan.

> nmap -A scanme.nmap.org
        

Aggressive scans provide far better information than regular scans. However, an aggressive scan also sends out more probes, and it is more likely to be detected during security audits.

Scanning Multiple Hosts

Nmap has the capability of scanning multiple hosts simultaneously. This feature comes in real handy when you are managing vast network infrastructure.

You can scan multiple hosts through numerous approaches:

  • Write all the IP addresses in a single row to scan all of the hosts at the same time.

> nmap 192.164.1.1 192.164.0.2 192.164.0.2
        

  • Use the asterisk (*) to scan all of the subnets at once.

> nmap 192.164.1.*
        

  • Add commas to separate the addresses endings instead of typing the entire domains.

> nmap 192.164.0.1,2,3,4
        

  • Use a hyphen to specify a range of IP addresses

> nmap 192.164.0.0–255
        

Port Scanning

Port scanning is one of the most fundamental features of Nmap. You can scan for ports in several ways.

  • Using the -p param to scan for a single port

> nmap -p 973 192.164.0.1
        

  • If you specify the type of port, you can scan for information about a particular type of connection, for example for a TCP connection.

> nmap -p T:7777, 973 192.164.0.1
        

  • A range of ports can be scanned by separating them with a hyphen.

> nmap -p 76–973 192.164.0.1
        

  • You can also use the -top-ports flag to specify the top n ports to scan.

> nmap --top-ports 10 scanme.nmap.org
        

Scanning from a File

If you want to scan a large list of IP addresses, you can do it by importing a file with the list of IP addresses.

> nmap -iL /input_ips.txt
        

The above command will produce the scan results of all the given domains in the “input_ips.txt” file. Other than simply scanning the IP addresses, you can use additional options and flags as well.

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

Seetha M的更多文章

  • Full stack development for AI-Driven Applications

    Full stack development for AI-Driven Applications

    In the era of artificial intelligence, full-stack development is evolving beyond traditional web and mobile…

  • Distributed ledger technology

    Distributed ledger technology

    Distributed Ledger Technology (DLT) is a decentralized system for recording, sharing, and synchronizing data across…

  • MERN Stack

    MERN Stack

    An Overview of the MERN Stack The MERN stack is one of the most popular technology stacks for building full-stack web…

  • IOT Penetration Testing

    IOT Penetration Testing

    IoT penetration testing is a process of evaluating the different system components of an IoT-based device by exploiting…

  • Java script

    Java script

    JavaScript is a high-level, interpreted programming language that is essential for web development. It enables the…

  • Prompt engineering

    Prompt engineering

    Prompt engineering has emerged as a crucial skill in maximizing AI's potential, shaping how models like GPT-4 interact…

社区洞察

其他会员也浏览了