Setting Up Your Testing Environment
In this step, we're going to get your environment ready for the stealth network audit. We'll set up a simple web server that will act as the target for our scanning. Having a controlled target like this is crucial because it allows you to practice stealth scanning techniques without affecting real - world systems.
First, we need to open a terminal. The terminal is like a command - line interface where you can type commands to interact with your computer. Once you've opened the terminal, you'll navigate to your workspace. Your workspace is a specific directory where you'll keep all your project - related files. To do this, use the following command:
cd /home/labex/project
The cd
command stands for "change directory". It tells the system to move you from your current location to the specified directory, which in this case is /home/labex/project
.
Now that you're in your workspace, we'll create a new directory called stealth
. Directories are like folders on your computer, and creating a dedicated directory helps you organize your work. Use the following command to create the directory:
mkdir -p /home/labex/project/stealth
The mkdir
command is used to make a new directory. The -p
option ensures that if any intermediate directories in the path don't exist, they will be created as well.
After creating the directory, you need to navigate into it. This way, any files you create will be stored inside the stealth
directory. Use the cd
command again:
cd /home/labex/project/stealth
Next, we'll create a simple HTML file. HTML (Hypertext Markup Language) is the standard language for creating web pages. This file will be served by our web server, simulating a real - world web service. Use the following command to create the file:
echo "Robotics server running..." > index.html
The echo
command prints the text "Robotics server running..." to the terminal. The >
symbol redirects that output and writes it into a new file called index.html
.
Now, we need to set up a DNS resolver. DNS (Domain Name System) is like a phone book for the internet. It translates domain names (like google.com) into IP addresses. By setting up a DNS resolver, we ensure that our system can properly connect to other networks. Use the following command:
sudo sh -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
The sudo
command gives you administrative privileges to perform actions that require special permissions. The sh -c
is used to run a shell command. We're writing the line "nameserver 8.8.8.8" into the /etc/resolv.conf
file, which is where the system stores DNS configuration.
Finally, we'll start a simple web server using the nc
(netcat) command. Netcat is a versatile networking utility that can be used for various tasks, including setting up a simple server. This server will listen on port 8080 and serve the HTML file we created earlier. Use the following command:
nc -lvp 8080 < index.html &
Let's break down this command:
nc
is the netcat utility for network connections. It allows you to create connections between different network endpoints.
-l
tells netcat to listen for incoming connections. Instead of trying to connect to another server, it will wait for others to connect to it.
-v
enables verbose output. This means that netcat will provide more detailed information about what it's doing.
-p 8080
specifies the port to listen on. Ports are like doors on a computer, and in this case, we're opening port 8080 for incoming connections.
< index.html
feeds the content of index.html
to any connection. When a client connects to our server, it will receive the content of the index.html
file.
&
runs the process in the background. This way, you can continue using the terminal to run other commands while the server is running.
After running the command, you should see output indicating that the server is listening on port 8080:
Listening on 0.0.0.0 8080
You now have a web server running on port 8080 that will act as your target for the stealth scanning exercises.