4 Scanning Networks
4 Scanning Networks
4 Scanning Networks
Scanning Networks
Introduction
Lab Topology
Exercise 1 - Using Microsoft Network Scanning Tools
Exercise 2 - Using Linux Network Scanning Tools
Review
Introduction
Network Scanning
ID Serve
Nmap
Zenmap
CurrPorts
Netcat
Hping3
MyLanViewer
Netdiscover
Fping
Ethical Hacking
Welcome to the Scanning Networks Practice Lab. In this module, you will be
provided with the instructions and devices needed to develop your hands-on skills.
Learning Outcomes
In this module, you will complete the following exercises:
Exam Objectives
The following exam objective is covered in this lab:
Note: Our main focus is to cover the practical, hands-on aspects of the exam
objectives. We recommend referring to course material or a search engine to
research theoretical topics in more detail.
Lab Duration
It will take approximately 1 hour to complete this lab.
ID Serve
CurrPorts
Nmap
MyLanViewer
NetView
Amap
Netscan Tools Pro
LANSurveyor
Friendly Pinger
Global Network Inventory
It is important to understand that some of the tools will work in a similar fashion,
such as discover live systems on a network. On the other hand, some tools, such as
ID Serve, have a distinct function, such as a scan for a Webserver and extract its
configuration information.
In this exercise, you will learn to use some of the key Windows-based tools for
network scanning.
Learning Outcomes
After completing this exercise, you will be able to:
Your Devices
You will be using the following devices in this lab. Please power these on now.
Domain
IP address
ID Serve can be used to grab the server’s greeting message (if any) along with the
make and model. It can also grab the operating system’s information.
In this task, you will perform banner grabbing using ID Serve. To do this, perform
the following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABWIN10.
Step 2
In the Type here to search box, type the following:
Internet Explorer
Press Enter.
Step 3
The Intranet website is displayed.
Step 4
Scroll down and click Hacking Tools.
Figure 1.4 Screenshot of PLABWIN10: Clicking the Hacking Tools folder on
the intranet Website.
Step 5
Scroll down and click idserve.exe.
Figure 1.5 Screenshot of PLABWIN10: Clicking the idserve.exe tool.
Step 6
A notification bar appears at the bottom of Internet Explorer. Click Save.
Figure 1.6 Screenshot of PLABWIN10: Clicking Save in the notification bar.
Step 7
Click Run on the notification bar.
Figure 1.7 Screenshot of PLABWIN10: Clicking Run in the notification bar.
Step 8
Minimize the Internet Explorer window.
Step 9
On the Server Query tab, type the following URL in the Enter or copy / paste
an Internet server URL or IP address here text box:
http://intranet
Step 10
You can scroll up and find the Webserver’s IP address.
Figure 1.11 Screenshot of PLABWIN10: Showing the IP address of the
Intranet Webserver.
Step 11
Click Exit to close the ID Serve dialog box.
Figure 1.12 Screenshot of PLABWIN10: Clicking Exit to close the ID Server
dialog box.
Nmap has a graphical user interface (GUI) with the name Zenmap. It has the same
capabilities as Nmap. You can scan for ports, services, and so on.
In this task, you will explore a network using Nmap. To do this, perform the
following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABWIN10.
Step 2
Ensure that you are on the Hacking Tools page on the Intranet Website. Scroll
down and click nmap-6.47-setup.exe.
Figure 1.14 Screenshot of PLABWIN10: Clicking the nmap executable from
the Intranet Website.
Step 3
A notification bar appears. Click Save.
Figure 1.15 Screenshot of PLABWIN10: Clicking Save in the notification
bar.
Step 4
After the installer is downloaded, click Run in the notification bar.
Figure 1.16 Screenshot of PLABWIN10: Clicking Run in the notification
bar.
Step 5
The Nmap Setup dialog box is displayed.
Step 6
On the Choose Components page, keep the default selection and click Next.
Figure 1.18 Screenshot of PLABWIN10: Keeping the default selection and
clicking Next on the Choose Components page.
Step 7
On the Choose Install Location page, keep the default Destination Folder path,
and click Install.
Figure 1.19 Screenshot of PLABWIN10: Keeping the default location and
clicking Install on the Choose Install Location.
Step 8
Another dialog box named WinPcap (Nmap) 4.1.3 Setup is displayed.
Step 9
The installation progress for WinPcap is displayed.
Step 10
On the WinPcap Options page, keep the default selection and click Next.
Figure 1.23 Screenshot of PLABWIN10: Showing the options on the
WinPcap Options and clicking Next.
Step 11
On the Finished page, click Finish.
Figure 1.24 Screenshot of PLABWIN10: Clicking Finish on the Finished
page.
Step 12
After the installation is completed, click Next on the Installation Complete page.
Figure 1.26 Screenshot of PLABWIN10: Clicking Next on the Installation
Complete page.
Step 13
On the Create Shortcuts page, keep the default selection and click Next.
Figure 1.27 Screenshot of PLABWIN10: Clicking Next on the Create
Shortcuts page.
Step 14
On the Finished page, click Finish.
Figure 1.28 Screenshot of PLABWIN10: Clicking Finished on the Finish
page.
Step 15
Minimize the Internet Explorer window.
Step 16
The Zenmap window is displayed. The top section has three key fields:
192.168.0.1
Click Scan.
The output is displayed on the Nmap Output tab in the right pane.
Figure 1.31 Screenshot of PLABWIN10: Showing the scan results on the
Nmap Output tab.
Step 17
To view the ports information only, click the Ports / Hosts tab.
Figure 1.32 Screenshot of PLABWIN10: Showing the open ports on the
Ports / Hosts tab.
Step 18
Click the Topology tab. The topology for 192.168.0.1 is displayed.
Figure 1.33 Screenshot of PLABWIN10: Showing topology on the Topology
tab.
Step 19
Click the Host Details tab.
Notice that it displays quite a bit of detail. You can find its state (which is up), open
ports, filtered ports, and scanned ports.
Figure 1.34 Screenshot of PLABWIN10: Showing the host information on
the Host Details tab.
Step 20
Click the Scans tab.
Notice that it displays the command that has been executed to get the information
about the target system.
Note: The current scan is in an unsaved state. You can use the Scan > Save
Scan option (in the toolbar) to save the scan. Alternatively, you can press the
Ctrl + s keys to save the scan.
Figure 1.35 Screenshot of PLABWIN10: Showing the unsaved command on
the Scans tab.
Step 21
Close the Zenmap window. When prompted to save changes, click Close anyway.
Figure 1.36 Screenshot of PLABWIN10: Clicking Close anyway o the
Unsaved changes dialog box.
CurrPorts is a network monitoring tool. It can display the open TCP and UDP
connections on a local system.
In this task, you will use CurrPorts to monitor TCP/IP connections. To do this,
perform the following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABWIN10.
Step 2
Ensure that you are on the Hacking Tools page on the Intranet Website.
Step 3
In the notification bar, click Save.
Figure 1.39 Screenshot of PLABWIN10: Clicking Save in the notification
bar.
Step 4
In the notification bar, click Open folder.
Figure 1.40 Screenshot of PLABWIN10: Clicking Open folder on the
notification bar.
Step 5
The File Explorer window displays the Downloads folder.
Step 6
The Extract Compressed (Zipped) Folders dialog box is displayed.
Step 7
A new File Explorer window is displayed with the cports folder. Double-click the
cports application file.
Figure 1.43 Screenshot of PLABWIN10: Showing the new File Explorer
window and double-clicking the cports executable.
The CurrPorts window is displayed. Notice that it displays the open TCP and UDP
connections.
Process Name
Process ID
Protocol
Local Port
Local and Remote Addresses
State
Figure 1.44 Screenshot of PLABWIN10: Showing TCP and UDP
connections.
Step 8
Let’s attempt to close a TCP connection.
Select a TCP connection, right-click and select Close Selected TCP Connections.
Figure 1.45 Screenshot of PLABWIN10: Selecting Close Selected TCP
Connections from the context menu.
Step 9
The CurrPorts dialog box is displayed. It prompts to confirm the closure of the
selected TCP connection. Click Yes.
Figure 1.46 Screenshot of PLABWIN10: Clicking Yes on the CurrPorts
dialog box.
Step 10
The CurrPorts dialog box displays an error message. You must start the
CurrPorts tool with admin privileges to close a TCP connection.
Click OK.
Figure 1.47 Screenshot of PLABWIN10: Showing the error of elevated
privileges required in the CurrPorts dialog box.
Step 11
Click Close to close the CurrPorts application.
Figure 1.48 Screenshot of PLABWIN10: Closing the CurrPorts window.
MyLanViewer is a network and IP Scanner. It is also a tool that can search the
WHOis database. You can use it for multiple purposes, such as:
Traceroute
Remote shutdown
Wake On LAN (WOL) manager
Wireless network scanner and monitor
In this task, you will use MyLanViewer to scan the network. To use MyLanViewer,
perform the following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABWIN10.
Step 2
Ensure that you are on the Hacking Tools page on the Intranet Website.
Scroll down and click MyLanViewer-setup.exe.
Step 3
In the notification bar, click Save.
Figure 1.51 Screenshot of PLABWIN10: Clicking Save in the notification
bar.
Step 4
In the notification bar, click Run.
Figure 1.52 Screenshot of PLABWIN10: Clicking Run in the notification
bar.
Step 5
The Setup - MyLanViewer wizard is displayed.
Step 6
On the License Agreement page, select I accept the agreement and click Next.
Figure 1.54 Screenshot of PLABWIN10: Accepting the license agreement
and clicking Next.
Step 7
On the Select Destination Location page, keep the default path, and click Next.
Figure 1.55 Screenshot of PLABWIN10: Clicking Next on the Select
Destination Location page to accept the default location.
Step 8
On the Select Start Menu Folder page, keep the default name for the Start Menu
and click Next.
Figure 1.56 Screenshot of PLABWIN10: Clicking Next on the Select Start
Menu Folder page.
Step 9
On the Select Additional Tasks page, keep the default selection and click Next.
Figure 1.57 Screenshot of PLABWIN10: Clicking Next on the Select
Additional Tasks page.
Step 10
On the Ready to Install page, review the installation configuration, and click
Install.
Figure 1.58 Screenshot of PLABWIN10: Clicking Install on the Ready to
Install page.
Step 11
On the Completing the MyLanViewer Setup Wizard page, keep the default
selection and click Finish.
Figure 1.59 Screenshot of PLABWIN10: Clicking Finish on the Launch
MyLanViewer page.
Step 12
The MyLanViewer dialog box is displayed, informing that this is a trial version that
will work as a fully functional product for 15 days.
Click OK.
Figure 1.60 Screenshot of PLABWIN10: Clicking OK on the MyLanViewer
dialog box.
MyLanViewer will now start to scan the subnet or Wi-Fi network depending on
your system’s connectivity.
Figure 1.61 Screenshot of PLABWIN10: Showing the scanning in the
MyLanViewer - Monitoring Devices on Your Subnet/Wi-Fi window.
Step 13
After a few minutes, it is able to scan for the live systems on the subnet. Expand
PLABWIN10.PRACTICELABS.COM (Your Computer).
Notice that it has captured a lot of system-related information. For example, you can
find its MAC address, IP address, and online status.
Figure 1.62 Screenshot of PLABWIN10: Expanding
PLABWIN10.PRACTICELABS.COM (Your Computer).
Step 14
Click Tools in the toolbar and select Ping / Traceroute To Host…
Figure 1.63 Screenshot of PLABWIN10: Clicking Tools and selecting Ping /
Traceroute To Host option.
Step 15
The Ping / Traceroute To Host dialog box is displayed.
192.168.0.250
Click Ping.
Figure 1.64 Screenshot of PLABWIN10: Entering the IP address in the
Host textbox and clicking Ping.
Step 16
Close the Ping / Traceroute To Host dialog box.
Figure 1.66 Screenshot of PLABWIN10: Closing the Ping / Traceroute To
Host dialog box.
Step 17
Close the MyLanViewer - Monitoring Devices on Your Subnet/Wi-Fi
window.
Figure 1.67 Screenshot of PLABWIN10: Closing the MyLanViewer -
Monitoring Devices on Your Subnet/Wi-Fi window.
Hping3
Dmitry
Netcat
Netdiscover
Nmap
Fping
Msfconsole
Most of these tools are meant for network scanning. However, some of the tools are
primarily for a different function. For example, Msfconsole if primarily a penetration
testing and exploit creation tool, but it also provides the capability of scanning a
network.
In this exercise, you will learn to use various Linux-based tools for network scanning.
Learning Outcomes
After completing this exercise, you will be able to:
Your Devices
You will be using the following devices in this lab. Please power these on now.
Hping3 is a powerful tool that can be used for various types of scanning in a network.
It can perform Layer 3 and Layer 4 scanning.
In this task, you will use the hping3 tool to perform various types of network
scanning. To do this, perform the following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABKALI01.
Credentials are:
Username:
root
Password:
Passw0rd
Click the Terminal icon in the left pane.
Figure 2.1 Screenshot of PLABKALI01: Showing the desktop of
PLABWIN10 and clicking the Terminal icon in the left pane.
Step 2
The terminal window is displayed. You can perform an ICMP discovery of a single
host using hping3.
Press Enter.
Figure 2.2 Screenshot of PLABKALI01: Entering the command to perform
ICMP discovery of a single host.
Step 3
The output of the command is displayed.
The hping3 command will continue for an indefinite time unless you stop it. To do
this, press the Ctrl + C keys.
Figure 2.3 Screenshot of PLABKALI01: Showing the response from the
target system.
Step 4
Clear the screen by entering the following command:
clear
You can also limit the command to perform ICMP discovery for a limited number. To
do this, type the following command:
hping3 192.168.0.1 --icmp -c 5
Press Enter.
Step 5
Clear the screen by entering the following command:
clear
You can also use the hping3 command to scan for a specific TCP port. You need to
specify the port number with the - - scan parameter. Type the following command:
hping3 intranet --scan 80 -S
Press Enter.
Notice that in the flags column, S and A are mentioned. This means that the
SYN+ACK response was received from the target system.
Figure 2.7 Screenshot of PLABKALI01: Showing the output of the hping3
command.
SYN+ACK is part of the TCP 3-way handshake process between two systems, which
has the following steps:
Step 6
You can also scan for multiple ports using the hping3 command. To do this, type the
following command:
Press Enter.
Notice the output. Only port 80 has responded. The output only displays the ports if
the SYN+ACK response is received.
Figure 2.9 Screenshot of PLABKALI01: Showing the output of the hping3
command.
Step 7
Clear the screen by entering the following command:
clear
You can also scan for a range of ports. To do this, you need to specify the first and the
last port. Type the following command:
hping3 192.168.0.1 --scan 1-80 -S
Press Enter.
Step 8
Clear the screen by entering the following command:
clear
To scan the entire TCP port range, type the following command:
Scroll down to the command prompt. Notice that all closed ports are mentioned.
Figure 2.14 Screenshot of PLABKALI01: Showing the output of the hping3
command.
Step 9
Clear the screen by entering the following command:
clear
You can use hping3 to determine open ports on a target. To identify open ports on
192.168.0.1, type the following command:
hping3 -8 0-100 -S 192.168.0.1
Press Enter.
The output displays the list of open ports and the services that use them. The output
also displays the list of ports that do not respond to the scan.
Note: Notice the given command sent the SYN flag and received the SYN ACK
flag from each open port on PLABDC01.
Dmitry is an information gathering tool. It has the capability to gather the following
types of information:
Subdomains
E-mail addresses
Uptime information
TCP port scan
WHOis lookups
In this task, you will use Dmitry to perform a TCP scan. To do this, perform the
following steps:
Step 1
Ensure you have powered on the required devices and connect to PLABKALI01.
If you are continuing from the previous task, the terminal window should be open. If
not, then open a new terminal window.
If continuing from the previous task, then clear the screen by entering the following
command:
clear
dmitry
Press Enter.
Figure 2.17 Screenshot of PLABKALI01: Entering the dmitry command.
Step 2
Clear the screen by entering the following command:
clear
You will now use the -p parameter along with the dmitry command to perform a
TCP scan. Type the following command:
dmitry -p intranet
Press Enter.
The output displays the list of open ports. It also shows the target’s IP address.
Figure 2.20 Screenshot of PLABKALI01: Showing the output of the dmitry
command.
Step 3
Clear the screen by entering the following command:
clear
You can also send the dmitry output to a text file. In this step, you will send the
output to a text file named plab.
Press Enter.
Step 4
Clear the screen by entering the following command:
clear
cat plab.txt
Press Enter.
Notice that the output is the same as the output for the following command:
dmitry -p intranet
The plab.txt file contains the same output as the above-mentioned command.
Figure 2.24 Screenshot of PLABKALI01: Showing the contents of the
plab.txt file.
Netcat, or nc, is a tool that is used for monitoring network connections and can also
be used for port scanning.
In this task, you will use nc for port scanning. To do this, perform the following
steps:
Step 1
Ensure you have powered on the required devices and connect to PLABKALI01.
If you are continuing from the previous task, the terminal window should be open. If
not, then open a new terminal window.
If continuing from the previous task, then clear the screen by entering the following
command:
clear
nc -h
Press Enter.
Figure 2.25 Screenshot of PLABKALI01: Entering the nc command to view
its list of parameters.
Step 2
Clear the screen by entering the following command:
clear
nc -nvz 192.168.0.1 88
Press Enter.
The output of the nc command is displayed. It confirms that the port 88, which is
used by Kerberos, is open. You can test out various ports and find out if they are
open.
Figure 2.28 Screenshot of PLABKALI01: Showing the output of the nc
command.
Netdiscover is a tool that can perform Layer 2 discovery. You can pass the range of IP
address in the CIDR notation, and Netdiscover can scan the entire range.
In this task, you will learn to scan the network using Netdiscover. To do this, type the
following command:
Step 1
Ensure you have powered on the required devices and connect to PLABKALI01.
If you are continuing from the previous task, the terminal window should be open. If
not, then open a new terminal window.
If continuing from the previous task, then clear the screen by entering the following
command:
clear
To view the list of parameters of the netdiscover command, type the following:
netdiscover -r 192.168.0.0/24
Press Enter.
Notice the output of the netdiscover command. It has detected five systems on the
network.
Note: The fifth system is the Kali Linux system. Since you are executing the
command from sixth system, it does not mention it in the list.
Figure 2.30 Screenshot of PLABKALI01: Showing the output of the
netdiscover command.
Step 2
Press Ctrl + C to break the command.
If you are scanning an entire system, it can alert an Intrusion Detection System (IDS)
or Intrusion Prevention System (IPS). This is because ARP requests are broadcasted
all over the subnet, which can alert an IDS or IPS. You can run the netdiscover
command in stealth mode using the -p parameter.
netdiscover -p
Press Enter.
Notice that the command executes in the passive mode, which is stealth mode.
Step 3
If this command takes a long time to run, you can break the command by pressing
Ctrl + C keys.
Figure 2.33 Screenshot of PLABKALI01: Breaking the netdiscover
command.
In a stealth scan, the attacker does not complete the three-way handshake with the
victim’s system and, therefore, goes undetected. Nmap has different options for
conducting stealth scans, which you will perform in this task. To conduct stealth
scanning, perform the following steps:
Step 1
Ensure that you are connected to Kali Linux and the terminal window is open.
You will now scan for the ports using a TCP SYN scan, which is known to be a
stealth scan. Type the following command:
Press Enter.
Step 2
Clear the screen by entering the following command:
clear
ACK scan cannot be used for scanning ports. This type of scan will never show ports
in the "open" state, and hence it should be used in conjunction with other scan types
to gain more information about firewalls or packet filters between your source
machine and the target machine.
If used for port scanning, ACK scan will only provide a meaningful result if the target
OS type is Solaris.
ACK scanning is mainly used to discover the rules of a filter. It can help to determine
if a firewall is stateless (that blocks incoming SYN packets) or stateful (that tracks
connections and also blocks unsolicited ACK packets).
As the name indicates, the ACK scan sends ACK packets to the target host. If the
target responds with an RST packet, then the port is classified as "unfiltered" (the
port is allowed to send its RST packet through the firewall that is in place). If no
packets are received, the port is said to be "filtered" (the firewall prevented the RST
packet sent from the port).
Press Enter.
The output of this command is displayed. The output does not contain the open or
closed ports but filtered or unfiltered ports. For example, all 1000 ports on
192.168.0.2 are filtered whereas, on 192.168.0.250, they are unfiltered.
Step 3
Clear the screen by entering the following command:
clear
You can also perform a stealth scan to avoid being detected by the non-stateful
firewalls. This is known as Null scan. In this type of scan, the TCP segment does not
carry a flag. In the usual state, there would be at least the ACK flag that is raised.
To perform this, type the following command:
Press Enter.
The output of this command is displayed. It lists the open and filtered ports on
various target systems.
Step 4
Clear the screen by entering the following command:
clear
Another type of stealth scan is a FIN scan, which sends a TCP FIN message. To
conduct a FIN scan, type the following command:
Press Enter.
Figure 2.40 Screenshot of PLABKALI01: Typing the nmap -sF command in
the terminal window.
Step 5
Clear the screen by entering the following command:
clear
The next type of stealth scan is Xmas scan, which sends the TCP segment with
three flags raised. These flags are FIN, PSH, and URG.
Note: The Null, FIN, and Xmas scans are used to avoid being detected by the
non-stateful firewall.
Press Enter.
Step 6
Clear the screen by entering the following command:
clear
You can also choose the speed of your stealth scan. For example, you choose
paranoid (T0), sneaky (T1), polite (T2), normal (T3), aggressive (T4), and
insane (T5). T0 is the slowest scan, and T5 is the fastest scan.
nmap 192.168.0.2 -T 5
Press Enter.
Note: You can attempt to perform a T1 or T2 scan and notice the time
difference.
Figure 2.45 Screenshot of PLABKALI01: Showing the output of the nmap
command with the -T parameter.
The fping tool is similar to the ping tool but has additional features. One of the
additional features is that it can be used as a scanning tool.
Step 1
Ensure that you are connected to Kali Linux and the terminal window is open.
clear
You can simply pass the IP address to the fping command as a parameter to check if
a system is alive on the network.
fping 192.168.0.1
Press Enter.
Step 2
Using the -g parameter, you can scan for more than one system on the network.
Press Enter.
Step 3
Using the -g parameter, you can scan an entire subnet using the CIDR notation.
fping -g 192.168.0.0/24
Press Enter.
Notice the output scans for the live systems on the entire subnet and lists the status
of each IP address.
UDP scan
TCP stealth scan
Full connect scan
In this task, you will perform a TCP stealth scan. To do this, perform the following
steps:
Step 1
Ensure you have powered on the required devices and connect to PLABKALI01.
Step 2
The terminal window is displayed.
Type msfconsole
Press Enter
Note: The number of exploits and payloads will change from time to time.
Step 3
Next, you will load the module with the use command. To do this, type the following
command:
use auxiliary/scanner/portscan/syn
Press Enter.
Figure 2.54 Screenshot of PLABKALI01: Using the use command for a
module.
Step 4
You will now need to set the remote host on which you want to perform the TCP
stealth scan. Type the following command:
Press Enter.
Step 5
Notice that the RHOSTS value is now set. You will now set the number of
concurrent tasks to be performed in the background. This is done by setting the
THREADS value. Type the following command:
set THREADS 25
Press Enter.
Step 6
Notice that the THREADS value is now set. You will need to set the port. This is
done by setting the PORTS value. Type the following command:
set PORTS 53
Press Enter.
Step 7
Notice that the PORTS value is now set. You can now execute the module.
run
Press Enter.
Step 8
Let’s now scan against a range of ports. To do this, you need to reset the PORTS
value. Type the following command:
Press Enter.
Notice that the value of PORTS has been reset to 1-100. This means ports 1 to 100
will be scanned.
Step 9
You can now execute the module. To do this, type the following command:
run
Press Enter.
Notice that in the range of 1 to 100, two ports, 53 and 88, are found open.
Step 10
You have performed a TCP stealth scan against a single host. You can reset the
RHOSTS value to perform this scan against multiple hosts in one go. To do this,
type the following command:
Press Enter. Notice that the value of RHOSTS has been reset to 192.168.0.1-3.
Step 11
You can now execute the module. To do this, type the following command:
run
Press Enter.
Notice the output. Port 53 and 88 are open on 192.168.0.1. Port 80 is open on
192.168.0.2.
Review
Well done, you have completed the Scanning Networks Practice Lab.
Summary
You completed the following exercises:
Feedback
Shutdown all virtual machines used in this lab. Alternatively, you can log out of
the lab platform.