Network Scanning
Network Scanning
1|Page
Packet Fragmentation (-f) ...................................................... ....................... 28
Source Port Manipulation (-g) ..................................................................... 29
MTU Manipulation (--mtu) .......................................................................... 30
Decoy Scan (-D) .................................................................... ......................... 31
MAC Address Spoofing (--spoof-mac) .................................................... 32–33
Lab 05: Perform Network Scanning using Various Tools .............................. 34
Overview of Network Scanning Tools ................................ ........................... 34
Task 1: Scan Target Network using Metasploit ............................................ 35
Subnet Scan via Nmap in Metasploit ............................. ............................... 36
SYN Port Scan Module ........................................................................... 37–38
TCP Port Scan Module ................................................................................. 39
SMB Version Detection Module .................................................................. 40
Final Results & Enumeration ....................................................................... 40
Conclusion …………………………………………………………………………………………………41
References …………………………………………………………………………………………………42
2|Page
1. Introduction to Network Scanning
Network scanning is a systematic process used to identify live hosts, open
ports, running services, operating systems, and potential vulnerabilities within
a target network.
In ethical hacking, scanning is not actual intrusion — it is an advanced
reconnaissance phase. It helps penetration testers gather detailed technical
insights about a target system before attempting exploitation.
During scanning, an ethical hacker aims to:
• Identify live systems (active hosts)
• Discover open TCP/UDP ports
• Detect services running on those ports
• Perform OS fingerprinting
• Identify possible misconfigurations and vulnerabilities
This phase is critical because it provides a technical attack surface overview,
helping security professionals understand how a system could potentially be
compromised.
2. Lab Objectives
The objective of this lab was to:
• Conduct network scanning
• Perform port scanning
• Analyze discovered hosts and services
• Identify network vulnerabilities
Specifically, network scans were performed to:
• Check live systems and open ports
• Identify services running on live systems
• Perform banner grabbing and OS fingerprinting
• Detect potential network vulnerabilities
3|Page
3. Key Concepts Covered
a) Network Scanning
Used to discover active devices within a network range and map the network
structure.
b) Port Scanning
Involves connecting to TCP and UDP ports to determine:
• Which ports are open
• What services are running
• Whether those services are vulnerable
c) TCP vs UDP Scanning
• TCP scanning identifies services on connection-oriented communication.
• UDP scanning identifies services using connectionless communication
(often harder to detect).
d) Banner Grabbing
Used to extract service version information from open ports, helping identify
outdated or vulnerable services.
e) OS Fingerprinting
Determines the operating system running on a target machine by analyzing
network responses.
4|Page
5. Professional Reflection
This lab strengthened my understanding of how attackers map and analyze a
target network before launching an attack. It also reinforced the importance
of:
• Minimizing exposed services
• Hardening unnecessary open ports
• Keeping services updated
• Implementing proper monitoring and detection
Understanding scanning from an attacker’s perspective helps in building
stronger defensive strategies.
5|Page
Lab 01: Perform Host Discovery
Host discovery is the process of identifying active hosts in the target network.
6|Page
• Run nmap -sn -PR <Target IP Address> command (here, the target IP
address is [Link]).
Note: -sn disables port scan and -PR performs ARP ping scan.
• The scan results appear, indicating that the target Host is up, as shown
in the screenshot.
Note: In this lab, we are targeting the Windows VM ([Link]).
ARP Ping Scan Note
• The ARP ping scan sends an ARP request to the target host.
• If an ARP response is received, it means the host is active.
• Run nmap -sn -PU <Target IP Address> command (here, the target IP
address is same as the previous one). The scan results appear, indicating
that the target Host is up, as shown in the screenshot.
Note: -PU performs the UDP ping scan.
Note: The UDP ping scan sends UDP packets to the target host; a UDP
response means that the host is active. If the target host is offline or
unreachable, various error messages such as “host/network unreachable” or
“TTL exceeded” could be returned.
7|Page
• Now, we will perform the ICMP ECHO ping scan. Run nmap -sn -PE
<Target IP Address> command (here, the target IP address is same as
the previous one). The scan results appear, indicating that the target
Host is up, as shown in the screenshot.
Note: -PE performs the ICMP ECHO ping scan.
Note: The ICMP ECHO ping scan involves sending ICMP ECHO requests to a
host. If the target host is alive, it will return an ICMP ECHO reply. This scan is
useful for locating active devices or determining if ICMP is passing through a
firewall.
• Now, we will perform an ICMP ECHO ping sweep to discover live hosts
from a range of target IP addresses. Run nmap -sn -PE <Target Range of
IP Addresses> command (here, we have specified only 2 IPs i.e. one of
Windows VM and other of Parrot VM). The scan results appear,
indicating that the target Host is up, for both the targets that we have
scanned, as shown in the screenshot.
8|Page
Note: The ICMP ECHO ping sweep is used to determine the live hosts from a
range of IP addresses by sending ICMP ECHO requests to multiple hosts. If a
host is alive, it will return an ICMP ECHO reply.
• Run nmap -sn -PP <Target IP Address> command, (here, the target IP
address is also the same that we have used for Windows VM). The scan
results appear, indicating the target Host is up, as shown in the
screenshot.
Note: -PP performs the ICMP timestamp ping scan.
Note: ICMP timestamp ping is an optional and additional type of ICMP ping
whereby the attackers query a timestamp message to acquire the information
related to the current time from the target host machine.
9|Page
❖ ICMP Address Mask Ping Scan: This technique is an alternative
for the traditional ICMP ECHO ping scan, which are used to
determine whether the target host is live specifically when
administrators block the ICMP ECHO pings.
# nmap -sn -PM <target IP address>
❖ TCP SYN Ping Scan: This technique sends empty TCP SYN packets
to the target host, ACK response means that the host is active.
# nmap -sn -PS <target IP address>
❖ TCP ACK Ping Scan: This technique sends empty TCP ACK packets
to the target host; an RST response means that the host is active.
# nmap -sn -PA <target IP address>
❖ IP Protocol Ping Scan: This technique sends different probe
packets of different IP protocols to the target host, any response
from any probe indicates that a host is active.
# nmap -sn -PO <target IP address>
10 | P a g e
Lab 02: Perform Port and Service Discovery
Port and service discovery is the process of identifying open ports and services
running on the target IP addresses/active hosts.
11 | P a g e
• The Zenmap appears; in the Command field, type nmap -sT -v <Target IP
Address> (here, the target IP address is [Link]) and click Scan.
Note: -sT performs the TCP connect/full open scan and -v enables the verbose
output (include all hosts and ports in the output).
• The scan results appear, displaying all the open TCP ports and services
running on the target machine, as shown in the screenshot.
Note: TCP connect scan completes a three-way handshake with the target
machine. In the TCP three-way handshake, the client sends a SYN packet,
which the recipient acknowledges with the SYN+ACK packet. In turn, the client
acknowledges the SYN+ACK packet with an ACK packet to complete the
connection. Once the handshake is completed, the client sends an RST packet
to end the connection.
• Click the Ports/Hosts tab to gather more information on the scan results.
Nmap displays the Port, Protocol, State, Service, and Version of the scan.
12 | P a g e
• Click the Topology tab to view the topology of the target network that
contains the provided IP address and click the Fisheye option to view the
topology clearly.
13 | P a g e
• In the same way, click the Host Details tab to view the details of the TCP
connect scan.
• Click the Services tab located in the left pane of the window. This tab
displays a list of services.
Note: You can use any of these services and their open ports to enter into the
target network/host and establish a connection.
14 | P a g e
• In this sub-task, we shall be performing a stealth scan/TCP half-open
scan, Xmas scan, TCP Maimon scan, and ACK flag probe scan on a
firewall-enabled machine (i.e., Windows VM: [Link]) in order
to observe the result. To do this, we need to enable Windows Firewall in
the Windows virtual machine.
• Switch to the Windows Virtual machine and login with your credentials.
• Navigate to Control Panel → System and Security → Windows Defender
Firewall → Turn Windows Defender Firewall on or off, enable Windows
Firewall and click OK.
• Now, switch to the Kali Linux virtual machine. Launch Zenmap, type
nmap -sS -v <Target IP Address> (here, the target IP address is
[Link]) and click Scan.
Note: -sS performs the stealth scan/TCP half-open scan and -v enables the
verbose output (include all hosts and ports in the output).
• The scan results appear, displaying all open TCP ports and services
running on the target machine, as shown in the screenshot.
Note: The stealth scan involves resetting the TCP connection between the
client and server abruptly before completion of three-way handshake
signals, and hence leaving the connection half-open. This scanning
technique can be used to bypass firewall rules, logging mechanisms, and
hide under network traffic.
15 | P a g e
• As shown in the last task, you can gather detailed information from the
scan result in the Ports/Hosts, Topology, Host Details, and Scan tab.
• Similarly, type nmap -sX -v <Target IP Address> (here, the target IP
address is [Link]) and click Scan.
Note: -sX performs the Xmas scan and -v enables the verbose output (include
all hosts and ports in the output).
• The scan results appear, displaying that the ports are either open or
filtered on the target machine, which means a firewall has been
configured on the target machine.
Note: Xmas scan sends a TCP frame to a target system with FIN, URG, and
PUSH flags set. If the target has opened the port, then you will receive no
response from the target system. If the target has closed the port, then you
will receive a target system reply with RST.
16 | P a g e
• In the Command field, type nmap -sM -v <Target IP Address> (here, the
target IP address is [Link]) and click Scan.
Note: -sM performs the TCP Maimon scan and -v enables the verbose output
(include all hosts and ports in the output).
• The scan results appear, displaying either the ports are open/filtered on
the target machine, which means a firewall has been configured on the
target machine.
Note: In the TCP Maimon scan, a FIN/ACK probe is sent to the target; if there is
no response, then the port is Open|Filtered, but if the RST packet is sent as a
response, then the port is closed.
17 | P a g e
• In the Command field, type nmap -sA -v <Target IP Address> (here, the
target IP address is [Link]) and click Scan.
Note: -sA performs the ACK flag probe scan and -v enables the verbose output
(include all hosts and ports in the output).
• The scan results appear, displaying that the ports are filtered on the
target machine, as shown in the screenshot.
Note: The ACK flag probe scan sends an ACK probe packet with a random
sequence number; no response implies that the port is filtered (stateful
firewall is present), and an RST response means that the port is not filtered.
18 | P a g e
• This concludes the demonstration of discovering target open ports,
services, service versions, device type, OS details, etc. of the active hosts
in the target network using various scanning techniques of Nmap.
• Close all open windows and document all the acquired information.
19 | P a g e
Lab 03: Perform OS Discovery
Banner grabbing, or OS fingerprinting, is used to determine the OS running on
a remote target system.
20 | P a g e
Operating System Time To Live (TTL) TCP Window Size
Linux 64 5840
FreeBSD 64 65535
65,535 bytes to 1
Windows 128
Gigabyte
21 | P a g e
• In the terminal window, run nmap -O <Target IP Address> command
(here, the target machine is Windows VM [[Link]]). The scan
results appear, displaying information about open ports, respective
services running on the open ports, and the name of the OS running on
the target system.
Note: -O performs the OS discovery.
22 | P a g e
Analysis of SMB OS Discovery and Full Port Scan:
• Executed nmap --script [Link] [Link]
• Host was detected as up and reachable.
• 999 TCP ports were reported as filtered (no-response).
• Only port 135 (MSRPC) was open.
• No OS details were displayed because SMB ports (445 and 139) were
blocked by the firewall.
• Since SMB service was not accessible, the script could not extract OS
information.
• Performed a full TCP SYN scan using nmap -sS -p- [Link]
• 65,533 TCP ports were filtered and only two ports were open:
o 135/tcp – MSRPC
o 7680/tcp – pando-pub (Windows Delivery Optimization)
• The large number of filtered ports indicates that a firewall is enabled,
reducing the attack surface.
23 | P a g e
Lab 04: Scan Beyond IDS and Firewall
Scanning beyond IDS and firewall is a process of sending intended packets to
the target system in order to exploit IDS/firewall limitations.
24 | P a g e
• Anonymizers: Use anonymizers that allow them to bypass Internet
censors and evade IDS/firewalls.
25 | P a g e
• Minimize the Control Panel window, click Windows Search icon on the
Desktop. Search for wireshark in the search field and click Open to
launch it.
• The Wireshark Network Analyzer window appears, start capturing
packets by double-clicking the available ethernet or interface.
• Switch to the Kali Linux machine and login to it.
• Open a Terminal window and execute sudo su to run the programs as a
root user.
• In the terminal window, run nmap -f <Target IP Address> command
(here, the target machine is Windows 10 [[Link]]).
Note: -f switch is used to split the IP packet into tiny fragment packets.
Note: Packet fragmentation refers to the splitting of a probe packet into
several smaller packets (fragments) while sending it to a network. When these
packets reach a host, IDS and firewalls behind the host generally queue all of
them and process them one by one. However, since this method of processing
involves greater CPU consumption as well as network resources, the
configuration of most IDSs makes it skip fragmented packets during port scans.
• Although Windows Defender Firewall is turned on in the target system
(here, Windows 10), you can still obtain the results displaying all open
TCP ports along with the name of the service running on the target
machine, as shown in the screenshot.
26 | P a g e
• Switch to the Windows 10 machine (target machine). You can observe
the fragmented packets captured by the Wireshark, as shown in the
screenshot.
27 | P a g e
• Switch to the Windows 10 machine (target machine). In the Wireshark
window, scroll down and you can observe the TCP packets indicating
that the port number 80 is used to scan other ports of the target host, as
shown in the screenshot.
28 | P a g e
• Switch to the Kali Linux virtual machine.
• Now, run nmap --mtu 8 <Target IP Address> command (here, target IP
address is [Link]).
Note: In this command, --mtu specifies the number of Maximum
Transmission Units (MTU) (here, 8 bytes of packets).
Note: Using MTU, smaller packets are transmitted instead of sending one
complete packet at a time. This technique evades the filtering and detection
mechanism enabled in the target machine.
29 | P a g e
• Switch to the Windows 10 machine (target machine). In the Wireshark
window, scroll down and you can observe the fragmented packets
having maximum length as 8 bytes, as shown in the screenshot.
30 | P a g e
• Now, switch to the Windows 10 machine (target machine). In the
Wireshark window, scroll-down and you can observe the packets
displaying the multiple IP addresses in the source section, as shown in
the screenshot.
31 | P a g e
• Switch to the Kali Linux virtual machine.
• In the terminal window, run nmap -sT -Pn --spoof-mac 0 <Target IP
Address> command (here, target IP address is [Link]).
Note: In this command, --spoof-mac 0 represents randomizing the MAC
address, -sT performs the TCP connect/full open scan, and -Pn is used to skip
the host discovery.
Note: MAC address spoofing technique uses spoofing a MAC address with the
MAC address of a legitimate user on the network. This technique allows you to
send request packets to the target machine/network pretending to be a
legitimate host.
32 | P a g e
• Switch to the Windows 10 machine (target machine). In the Wireshark
window, scroll-down and you can observe the captured TCP, as shown in
the screenshot.
33 | P a g e
Lab 05: Perform Networking Scan using Various
Network Scanning Tools
Ethical hackers and pen testers are aided in network scanning with the help of
various scanning tools, which make scanning a target network an easy task.
34 | P a g e
• An msf command line appears. Type nmap -Pn -sS -A -oX Test
[Link]/24 and press Enter to scan the subnet, as shown in the
screenshot.
Note: Here, we are scanning the whole subnet [Link]/24 for active
hosts.
• Nmap begins scanning the subnet and displays the results. It takes
approximately 5 minutes for the scan to complete.
• After the scan completes, Nmap displays the host information for all the
targets in the given subnet along with open ports, service and OS
enumeration.
35 | P a g e
36 | P a g e
• Type search portscan and press Enter. The Metasploit port scanning
modules appear, as shown in the screenshot.
37 | P a g e
Note: Similarly, you can also specify a range of ports to be scanned against the
target IP address range.
• The result appears, displaying open port 80 in active hosts, as shown in
the screenshot.
• Now, we will perform a TCP scan for open ports on the target systems.
• To load the auxiliary/scanner/portscan/tcp module, type use
auxiliary/scanner/portscan/tcp and press Enter. Run show options
command to view module options.
38 | P a g e
• Type set RHOSTS [Link] and press Enter.
Note: Here, we will perform a TCP scan for open ports on a single IP address
([Link]), as scanning multiple IP addresses consumes much time.
• Type run and press Enter to discover open TCP ports in the target
system.
Note: It will take approximately 20 minutes for the scan to complete.
• The results appear, displaying all open TCP ports in the target IP address
([Link]).
• Now that we have determined the active hosts on the target network,
we can further attempt to determine the OSes running on the target
systems. As there are systems in our scan that have port 53 open, we
will use the module scanner/smb/smb_version to determine which
version of Windows is running on a target and which Samba version is
running on a Linux host.
• To do so, first type back, to revert to the msf command line. Then, type
use auxiliary/scanner/smb/smb_version and hit Enter.
• We will use this module to run a SMB version scan against the target IP
address range ([Link]-50). To do so, issue the below commands:
o set RHOSTS [Link]-50
o set THREADS 11
• Type run to discover SMB version in the target systems.
• The result appears, displaying the OS details of the target hosts.
39 | P a g e
• You can further explore various modules of Metasploit such as FTP
module to identify the FTP version running in the target host. This
information can further be used to perform vulnerability analysis on the
open services discovered in the target hosts.
• This concludes the demonstration of gathering information on open
ports, a list of services running on active hosts, and information related
to OSes, amongst others.
• Close all open windows and document all the acquired information.
40 | P a g e
Conclusion
This lab provided a comprehensive understanding of the network scanning
phase in ethical hacking and penetration testing. Through practical
experimentation using tools such as Nmap, Zenmap, Wireshark, and
Metasploit, multiple scanning techniques were explored to identify active
hosts, open ports, running services, and operating system information within a
target network.
The exercises demonstrated how attackers and security professionals gather
critical information about network infrastructure before attempting
exploitation. Techniques such as host discovery, port scanning, service
enumeration, OS fingerprinting, and IDS/firewall evasion highlighted how
networks can be analyzed in depth to identify potential vulnerabilities.
Furthermore, the lab emphasized the importance of defensive measures such
as firewall configuration, port hardening, service monitoring, and intrusion
detection systems to minimize exposure to scanning activities. Observing
scanning traffic through Wireshark also helped in understanding how network
packets behave during reconnaissance.
Overall, this lab strengthened practical knowledge of network reconnaissance
and illustrated how scanning techniques form the foundation of both
penetration testing and cybersecurity defense strategies.
41 | P a g e
References
1. EC-Council. (2023). Certified Ethical Hacker (CEH v12) Official
Courseware. EC-Council.
2. Gordon Lyon (Fyodor). Nmap Network Scanning: The Official Nmap
Project Guide to Network Discovery and Security Scanning.
[Link]
3. Nmap Official Documentation
[Link]
4. Wireshark Foundation. Wireshark User Guide.
[Link]
5. Rapid7. Metasploit Framework Documentation.
[Link]
6. Scarfone, K., & Mell, P. (2007). Guide to Intrusion Detection and
Prevention Systems (IDPS). NIST.
42 | P a g e