Nmap Common Ports Scanning

CybersecurityCybersecurityBeginner
Practice Now

Introduction

In the time of Ancient Greece, on the fields of the grand Olympic arena where the finest athletes honed their skills and spirits, there existed a group of guardians not of physical might but of knowledge โ€“ the Olympic Priests. These learned men, besides their religious duties, were also tasked with guarding the sacred flame, a symbol of purity and enlightenment. In this lab, we travel back to these ancient times and assume the role of a modern equivalent of those priests: a Cybersecurity Guardian. Your task is to employ your skills in the art of Nmap, specifically focusing on Common Ports Scanning to protect the digital realm of Olympia. Through mastering this skill, you will ensure the safety and integrity of your domain, keeping the sacred flame of data and network security burning bright.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL cybersecurity(("`Cybersecurity`")) -.-> cybersecurity/NmapGroup(["`Nmap`"]) cybersecurity/NmapGroup -.-> cybersecurity/nmap_common_ports("`Nmap Common Ports Scanning`") subgraph Lab Skills cybersecurity/nmap_common_ports -.-> lab-415920{{"`Nmap Common Ports Scanning`"}} end

Setting Up Your Environment

In this step, we'll start by setting up a local service on your machine that we'll later scan with Nmap. The aim is to simulate an ancient ritual of safeguarding the Olympiaโ€™s treasures, but in our modern cyber equivalent, that treasure is our network service.

  1. First, open a terminal and make sure you are in the correct directory:

    cd /home/labex/project
  2. Then, let's install a simple HTTP server (if not already installed):

    sudo apt update && sudo apt install apache2 -y
  3. To ensure the service is running:

    sudo service apache2 start

    Or open a web browser and navigate to http://localhost to confirm the service is running.

    For example, click on the + symbol in the top tab of the virtual environment to create a new Web Service and enter port 80.

Performing a Common Ports Scan

With our local server set up to represent our digital treasure, it's time to hone our skills in detecting potential threats using Nmap's common port scanning ability. This skill mirrors the task of the ancient Olympic Priests in detecting and neutralizing threats to the Olympic flame.

Back in our terminal, let's proceed with the scan. We'll aim to discover the open ports on our local machine, specifically looking for the web server we just set up.

  1. Execute the following Nmap command:

    nmap -F localhost

    The -F option tells Nmap to perform a fast scan, only scanning the top 100 most common ports. This scan should reveal that port 80, the standard web server port, is open.

  2. The output should list the open ports and the services running on them. For example, you should see an entry similar to this:

    PORT   STATE SERVICE
    80/tcp open  http

    This indicates that our Apache server is running and accessible through port 80.

Report Writing and Cleanup

Now that we've identified the presence of our "digital treasure", the final step in our lab is to document our findings and ensure our environment is clean, symbolizing the closing rituals of the Olympic ceremonies.

  1. Create a text file named scan_report.txt in /home/labex/project where you describe your scanning process and results. Include details on the scan type used and the ports discovered.

    echo "Nmap Fast Scan Report: Detected open port 80/tcp on localhost, indicating our Apache web server is running." > /home/labex/project/scan_report.txt
  2. Finally, let's stop the Apache service to simulate the closing of our temple's gates.

    sudo service apache2 stop

Summary

In this lab, we embarked on a journey back to the times of the Olympic arena, taking on the mantle of ancient priests but in the realm of cybersecurity. Through the steps of setting up a local service, performing a common ports scan with Nmap, and finally documenting our findings and cleanup, we have honed our skills in safeguarding our digital domain. Just as the Olympic Priests protected the sacred flame, we too have learned to guard our networks with vigilance, ensuring the flames of data and network security continue to burn bright in the cyber era.

Other Cybersecurity Tutorials you may like