Skip to content

vishal-kr-code/NMAP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 

Repository files navigation

NMAP

NMAP

Nmap, short for Network Mapper, is a powerful, open-source tool fundamental to network security, ethical hacking, and cybersecurity. It's essentially a reconnaissance tool; you use it to gather information about a target network or system before attempting any further action. Crucially, it's free to use, runs on virtually any platform, and doesn't require any payment.

The core function of Nmap is port scanning. As emphasized in the tutorial, Port Scanning is a one of the Most Important tools and Technic for Target Scanning. Why is this so important? Because identifying open ports reveals which services are running on a system, and these services can be potential entry points for attackers. Think of a building: closed doors and windows are secure. Open ones present vulnerabilities. Nmap helps you find those open doors.

Nmaps capabilities extend far beyond just finding open ports. It can also:

Discover Operating Systems: Attempt to identify the operating system running on the target host. Identify Services: Determine the specific services, like web servers, email servers, etc., running on the target and often even their versions. Extract Detailed Information: Gather a wealth of information about the target, including its hostname, MAC address, and more. Identify Potential Vulnerabilities: While Nmap itself doesn't exploit vulnerabilities, the information it provides can be used to identify weaknesses that attackers might leverage.

The overall goal when using Nmap is to collect as much information as possible about the target. This intelligence then allows for a more informed and targeted approach to any subsequent security assessments or penetration testing activities. It allows you to identify areas of weakness that could be exploited.

This chapter introduces Nmap, a powerful command-line tool for network exploration and port scanning, and demonstrates its installation and basic usage on Linux. The core idea is analogous to a house: just as a house with many unlocked doors presents vulnerabilities, a network with open ports can be exploited. Nmap helps you identify these potential entry points by scanning a network and revealing details about connected hosts and their services.

Installation Initial Setup The first step is installing Nmap. The video demonstrates this process with the following command:

bash sudo apt install nmap sudo apt install ipscan

After running this command, Nmap will check for updates. If the installed version is outdated, it prompts you to install the latest version. image

image image image image image image image image image image

Uploading image.png…

Network Discovery - Finding Your Network Before scanning specific targets, you need to know your networks details. The presenter shows how to determine your current network settings. He explains that you need to identify your network range often represented as a subnet mask. For example, he states, My 192.168.880 is here. This represents a segment of the network where devices reside. Youll also need to determine the subnet mask. The video emphasizes the importance of understanding your network structure.

Basic Port Scanning - Targeting an IP Address Once you know your network, you can scan a specific IP address. The basic syntax for this is:

bash nmap IP address

For example, if the target IP address is 192.168.1.1, the command would be:

bash nmap 192.168.1.1

The video also illustrates how to specify a subnet using CIDR notation. If your subnet is 192.168.1.0/24, the command would be:

bash nmap 192.168.1.0/24

This command tells Nmap to scan all IP addresses from 192.168.1.0 to 192.168.1.255. The /24 indicates that the first 24 bits of the IP address are fixed, and the remaining 8 bits can vary, resulting in 256 possible addresses.

What Nmap Reveals By running these commands, Nmap provides information about the target, including:

Host Status: Whether the host is online and responding. Open Ports: Which ports are open and accepting connections. Open ports indicate running services. Service Detection: Attempts to identify the service running on each open port e.g., HTTP, SSH, FTP. Operating System Detection: Tries to determine the operating system running on the target host though this isnt always reliable. The presenter repeatedly reinforces the need to understand the target network and uses the analogy of securing a house to highlight the significance of identifying and securing open ports. The command-line structure and the focus on subnet masks and IP addresses are key takeaways for network exploration with Nmap.

This tutorial focuses on network scanning and retrieving IP address information, demonstrating how to identify active hosts and their open ports within a network. The core idea is to use tools to probe a range of IP addresses and gather details about each responding device.

The process begins with a basic scan of a network. The video demonstrates this with a specific example. It appears a network contains hosts at IP addresses 129 and 130. Address 130 exhibits many open portsa significant indicator of activity, though the video notes its unclear whether this is a Linux or Windows machine at that point. Address 129 is also identified.

To perform a targeted scan of a specific IP, the instructor shows how to enter the address directly into the scanning tool. This allows for more detailed information to be retrieved about that particular host. Now lets do it as if you can do it and you can also do it, the instructor says, emphasizing ease of use.

The real power comes with scanning a range of addresses. For example, to discover the IP addresses in the range between 192.168.88.129 and 192.168.88.135, you input these two addresses into the tool. The tool then probes each address in that range. The video highlights that this functionality will then give it to 129 and 135, implying it returns all available information about those addresses. The example shows that this scanning reveals addresses 130 and 131, too. It is fine to 129 and 135 because it is fine here, because it is fine here because it is 130 and 131 our owns here.

Ultimately, the tutorial demonstrates that using network scanning tools enables users to quickly identify live hosts on a network, determine their IP addresses, and gain insight into the services they are running based on their open ports. The tools support both targeted scans of specific IPs and broader scans of IP address ranges.

Nmap offers flexible ways to specify your scan targets, allowing you to focus your efforts effectively. You can target single IP addresses, ranges of addresses, entire networks, or even randomly selected hosts. Lets break down how to do this, using examples from the demonstration.

Targeting Single IPs and Ranges: The simplest approach is to specify a single IP address. Nmap will then scan only that address. You can also define a range of IP addresses. For example, the instructor demonstrated scanning IP addresses from 129 to 140: 129-140. This covers a total of 12 IP addresses.

Scanning Domains CIDR Notation: Nmap can also scan entire domains. If you provide a domain name, like testpapy.aearweb.com, Nmap attempts to resolve it to an IP address and scans the resulting host. The instructor pointed out a demo site: testpapy.aearweb.com thats useful for practice. Be aware this site, like many test environments, might be subject to change.

A powerful technique is using CIDR Classless Inter-Domain Routing notation to specify an entire network. For instance, if you have a network with a CIDR of, say, 192.168.1.0/24, you could provide this to Nmap to scan all 256 addresses in that range. The instructor emphasizes that this works with any network, allowing broad scans.

Target Files Host Lists: Nmap accepts target lists from files. This is extremely useful when dealing with a large number of potential targets. The file would contain a list of IP addresses or hostnames, one per line. Nmap will then scan each of those targets.

Random Host Selection: For testing purposes, or to reduce the load on a network during initial reconnaissance, you can scan a random subset of hosts. The -R flag followed by a number specifies how many random hosts Nmap should scan. The instructor demonstrated using -R 50, which tells Nmap to scan 50 random hosts. Important note: scanning random hosts, especially large numbers, can take a significant amount of time. The instructor advised considering this before running such a command. They also mentioned that if the scan takes too long for a particular target, they would address it in a later demonstration.

Excluding Targets: Sometimes you want to exclude certain IP addresses from a scan. You can do this using the --exclude flag. You provide a list of IP addresses or a range to exclude. The instructor showed this in action: --exclude 192.168.1.1-192.168.1.5. This would scan a network but skip those specific five IP addresses.

In essence, Nmaps target specification features offer a lot of flexibility, ranging from pinpointing a single host to comprehensively analyzing entire networks and everything in between.

This chapter dives into the practicalities of network scanning and port detection, demonstrating how to identify active services and potential vulnerabilities on a target network. The core idea revolves around using tools to systematically probe a target, revealing which ports are open and what services are running on them. This information is invaluable for security assessments and understanding network infrastructure.

The presentation walks through a live demonstration, focusing on a network with the IP address 192.168.1.1. The initial scan reveals a surprising number of open ports over 29, suggesting a potentially rich and complex environment, though the exact operating system or services running on those ports remain unclear is it a V7 or LX machine

Different Scan Types Techniques

The demonstration highlights several scan types:

TCP Connect Scan: A fundamental scan type that establishes a full TCP connection to each port. Its reliable but can be relatively noisy easily detected by intrusion detection systems. UDP Scan: UDP scans are performed to discover services running over UDP. These are trickier than TCP scans because UDP is connectionless theres no guaranteed delivery or acknowledgment. The video identifies UDP ports as being found. Targeted Scans: The presenter illustrates how to focus scans on specific areas: scanning the ancolage port, presumably a typo for a specific service or device, or specifically scanning Windows ports to identify potential vulnerabilities related to that operating system. Why should we not check the AD suggests a specific focus on Active Directory ports if Windows is a target. List Scanning SL: The SL command is mentioned, indicating a tool or switch for scanning a list of targets. This streamlines the process when assessing multiple machines within a network.

Real-time Updates Scan Details

The live demo emphasizes the dynamic nature of network environments. As the scan progresses, updates are received - for example, an update mentioning a document and work with it. These real-time modifications underscore the importance of continuous monitoring and adaptation in network security. The video shows the scan report updating and improving as it goes. The phrase some such updates were removed indicates dynamic changes to the networks state during the scan.

Advanced Features Command Customization

The presenter also touches upon more advanced features. Theres mention of advanced things here, which implies the tool has options for customizing the scan beyond the basic TCP and UDP probes. The ability to specify the target with a number Han and whoever is here port number, etc. signifies a flexible approach to targeting specific ports on a specific machine. The mention of MAC addresses indicates the tool is capable of identifying devices at the hardware level.

Nmaps power lies in its ability to quickly and efficiently map a network by scanning ports and identifying the services running on those ports, including their versions. Its about more than just finding open ports; its about understanding what is running where. The videos demonstrate how to perform basic and targeted scans to achieve this.

Targeted Port Scanning: You dont always need to scan every single port which can take a very long time. Often, you only need to check specific, common ports or a range of ports. For instance, you might want to check ports 80 HTTP, 443 HTTPS, and everything in between ports 1 and 500. The command structure to achieve this is quite flexible.

Heres a breakdown based on the video examples. Instead of listing out individual ports, you can use a shorthand. The key is using hyphens to define a range. For instance, to scan ports 1 through 500:

bash nmap 1-500

You can also scan multiple, non-contiguous ports:

bash nmap 80,443,8080

Or, combine ranges and single ports:

bash nmap 1-100,200,300-400,500

The video emphasizes that Nmap is flexible and doesnt require you to specify port numbers it has default behavior, but you have considerable control. The core command nmap initiates the scan, and the subsequent numbers define the scope of the scan.

Service Version Detection: Once youve identified open ports, a crucial step is determining the service running on each port and its version. This is vital for identifying potential vulnerabilities, as older versions of software often have known exploits. Nmap has a built-in feature for this, activated using the -sV flag.

The video shows this in action. To perform service version detection on a target, use the following command:

bash nmap -sV targetIP

For example:

bash nmap -sV 192.168.1.192

The video presenter notes that -sV effectively asks Nmap to probe the service running on the host and determine its version. Essentially, nmap sends specific requests tailored to each service it detects and analyzes the responses to identify the software and its version number. For instance, it might report Apache httpd 2.4.41 instead of just http on port 80. This detail is critical for vulnerability assessment.

About

NMAP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published