Lab - Investigate Kali Linux
Lab - Investigate Kali Linux
Objectives
In this lab, you will complete the following objectives:
Background / Scenario
Computing power and resources have increased tremendously in a short period of time.
A benefit of multi-core processors and large amounts of RAM is the ability to run multiple
operating systems on a computer using virtualization.
With virtualization, one or more virtual computers can operate on a single physical
computer. Virtual computers that run on physical computers are called virtual machines
(VMs). Virtual machines are often called guests, and physical computers are often called
hosts. Anyone with a modern computer and operating system can run virtual machines.
In this lab, you will first install a desktop virtualization application, such as Oracle
VirtualBox, and deploy a virtual machine running a Kali Linux OS.
Required Resources
Computer with a minimum of 4 GB of RAM and 50 GB of free disk space
Internet access to download virtualization software, Oracle Virtualbox or UTM,
and VM image
Instructions
Even though most modern computers can support virtualization, if you are not sure,
perform an internet search to determine the capability of virtualization on your PC and
enable virtualization as necessary.
Depending on the architecture of your PC, you will either use Oracle VirtualBox or UTM
for your virtualization software.
Part 1: Deploying a Pre-Built Customized Kali VM on
AMD or Intel Chip-based Computer
Note: Go to the next part if you have M1/M2 MacOS or other ARM-based devices that
can support UTM.
VMware Workstation Player and VirtualBox are two virtualization programs that you can
download and install to run the Kali VM file. In this lab, you will use the VirtualBox
application.
a. Open VirtualBox.
b. Click File > Import Appliance to import the downloaded OVA file, Kali.ova.
Click Next to continue.
c. Review the appliance settings. Increase the amount of RAM if desired.
Click Finish to continue.
d. Click Start to power up the newly created VM after the appliance has been
imported.
In this lab, you will use the free version of the UTM app.
a. Navigate to https://mac.getutm.app/. Click Download to download the free
version.
b. After the file is downloaded, install UTM.
The root user in Linux is equivalent to the administrator user on windows. The
commands su and sudo allow you to gain root permissions.
The su command allows you to become the root user after providing the root password.
When you are done with running commands, you will need to type the exit command to
leave the root shell and back to your own account.
With the sudo command, only a single command is run with root privileges using the
current user’s password by default.
For the pre-built customized Kali for this course, the user kali is configured to use
the sudo command to access root privileges.
Note: These commands are for demonstration only. You will be more familiar with these
commands as you become more fluent with Linux.
a. Log into the Kali system with the username kali and the password kali. You are
presented with the Kali desktop.
b. Right-click the Desktop > select Applications > click Terminal Emulator. This will
open a terminal emulator window.
c. Root privilege is required to view and edit the file /etc/sudoers. To illustrate the
use of root privileges, enter the command visudo at the command prompt in the
terminal.
┌──(kali㉿Kali)-[~]
└─$ visudo
visudo: /etc/sudoers: Permission denied
Note that you do not have permission to view and edit the file.
b. To temporarily elevate your permission for root access, enter sudo visudo at the
prompt. Provide the password kali when prompted.
┌──(kali㉿Kali)-[~]
└─$ sudo visudo
c. Scroll toward the end of the file. The highlighted configurations allow any users in
the sudo group to execute any commands. Press Ctrl +x to exit the file and do not
save any changes.
d. Verify that the user kali is part of the sudo group. The grep command only prints
out the lines that match the given pattern. In this example, the command
searches for the word sudo in the file /etc/group and prints out that line. The result
confirms that the user kali is in the group sudo.
┌──(kali㉿Kali)-[~]
└─$ grep sudo /etc/group
sudo:x:27:kali
As you work in the terminal, you may find yourself retyping some commands or trying to
remember a command, filename, or folder name. A few keyboard shortcuts can help you
become more efficient at the terminal.
a. You can use the up or down arrow keys to locate and execute the previously
entered command. In the terminal, press the up arrow until you find
the visudo command.
How many times did you need to press up arrow? Do not press enter unless you want
to run the command again.
Answer Area
Show Answer
If you wanted to locate the sudo visudo command, how many times would you need to
press the down arrow to find it? Do not press enter unless you want to run the
command again.
Answer Area
Show Answer
b. What if you were looking for a command that you used a while ago? The
command history allows you to view all the commands that you have used
recently in the same terminal. At the prompt, delete the displayed command if
necessary. Enter the history command to see a list of recently used commands.
┌──(kali㉿Kali)-[~]
└─$ history
1 visudo
2 sudo visudo
3 grep sudo /etc/group
4 history
The output displays the list of commands with a number beside each command
that you just used in the previous step.
c. You can use a combination of the exclamation point (!) and history number or
command string to repeat previously used commands.
Answer Area
Show Answer
At the prompt, enter !his. What command is displayed?
Answer Area
Show Answer
d. The tab key can help you complete a partial command or file or folder name.
At the prompt, enter hi and press the tab key. What is the output?
Answer Area
Show Answer
e. You can continue to add more letters to the command until histo is displayed.
Now when you press tab, the command is completed because it is unique to the
system.
f. Tab completion can also be used on files and folders. Enter ls /me and press the
tab key. Because the string me is unique in the listing of file and folder names in
the root directory, you should see the command completed as ls /media.
Press Enter to view the contents of the /media folder.
Reflection Question
What are the benefits of using either the installer image or the pre-built image to create
the Kali VM?
Answer Area
Show Answer
Show All AnswersClear My Responses
© 2017 - 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
Close
Lab - Investigate Kali Linux
Objectives
In this lab, you will complete the following objectives:
Background / Scenario
Linux is open source, fast, reliable, and small. It requires very little hardware resources
to run and is highly customizable. Unlike other operating systems such as Windows and
Mac OS X, Linux was created, and is currently maintained by, a community of
programmers. Linux is part of several platforms and can be found on devices anywhere
from “wristwatches to supercomputers”. Because Linux is open source, any person or
company can get the kernel’s source code, inspect it, modify it, and re-compile it at will.
They are also allowed to redistribute the program with or without charges.
Kali Linux is a special version of Linux designed specifically for security auditing and
penetration testing. Many changes have been implemented to ensure security, system
integrity, and security-specific capabilities. It is not recommended to use Kali for
standard uses, such as gaming, development, and other day-to-day uses. As a security
and pentesting expert, it is very important for you to know how to get around in Kali, both
in the GUI and at the terminal. You need to be able to find the tools that you need to
perform your job and manipulate files in the file system.
Required Resources
Kali VM customized for Ethical Hacker course
Internet access
Instructions
Part 1: Familiarize Yourself with the Kali Linux GUI.
Step 1: Start the VM and learn about the Kali GUI.
Modern operating systems use an interface that most people are familiar with, but there
are things that can only be completed from the command line. It is still very important for
you to know your way around the GUI.
a. Log into the Kali system with the username kali and the password kali. You are
presented with the Kali desktop.
Like the Windows desktop, Kali has icons representing things like the trash, file
explorer, and other links. There are also several icons across the top, like the
Windows taskbar. In addition, icons for running applications will appear there. This
is called the panel. From here, you can launch the Firefox web browser, terminals
and also set up additional desktops using the numbered buttons. Each desktop
can be configured differently with specific links and files on it. This is useful if you
commonly have sets of tools and files that you use for specific tasks. You can
switch to the desktop that has the items you need when you are working on a
certain job.
b. Right-click the panel, click Panel, and then + Add New Items…
Here you can add many items to the panel to help you get to the tools and
configurations that you use the most. Close the Add New Items window.
Here you can modify many settings to customize how the panel works and what it
looks like. Additional panels can be added as well, to accommodate more items.
The top-right corner shows some settings and information, such as network
connection, audio, time and date, and the power button. You can add additional
items to this area using the panel configuration if you wish. This is a good place to
look for useful information.
This opens the Applications menu. Like the Start button in Windows, this menu
contains shortcuts to the applications and settings in the operating system. From
here, you can navigate to any of the tools that have been installed, find the
operating system settings, and search for anything you are looking for. All the tools
in this VM are arranged by type, such as wireless attacks or vulnerability analysis.
These groups make it easier to find an application specific to a functionality.
b. Navigate through the folders and look at all the different tools. Open a few if you
would like to see them. Note that some of the tools have GUIs, but most open in a
terminal window.
c. Close any open windows and click the square black and white icon in the panel.
This will open a terminal for the next part of the lab.
a. To learn more about the man page, open a terminal, and type:
┌──(kali㉿Kali)-[~]
└─$ man man
Scroll through the output and name a few sections that are included in a man page.
Answer Area
Show Answer
To invoke a command via the shell, simply type its name. The shell will try to find it
in the system path and execute it.
The table lists some basic Linux commands and their functions.
Command Description
Moves or renames files
mv
and directories.
chmod Modifies file permissions.
Changes the ownership of
chown
a file.
Copies data from an input
dd
to an output.
Displays the name of the
pwd
current directory.
Lists the processes that
ps are currently running in
the system.
Simulates a login as
su another user or to become
a superuser.
Runs a command as a
sudo super user, by default, or
another named user.
Used to search for
specific strings of
grep
characters within a file or
other command outputs.
Used to display or
configure network card
related information. If
issued without
parameters, ifconfig will
display the current
ifconfig
network card(s)
configuration.
Note: While still widely
in use, this command is
deprecated. Use ip
address instead.
Used to install, configure,
and remove packages on
apt-get
Debian and its
derivatives.
Used to display or
configure wireless
iwconfig
network card related
information.
shutdown Shuts down the
computer. shutdown can
be instructed to perform
several shut down related
tasks, including restart,
halt, put to sleep, or kick
out all currently
connected users.
Used to change the
password. If no
parameters are
passwd
provided, passwd changes
the password for the
current user.
Used to list the contents
of a file and expects the
cat
file name as the
parameter.
Used to display the
man documentation for a
specific command.
Many command line tools are included in Linux by default. To adjust the command
operation, users can pass parameters and switches along with the command. The
table lists a few of the most common commands related to files and directories.
Command Description
Displays
the files
ls
inside a
directory.
Changes
cd the current
directory.
Creates
mkdir
directories.
Copies files
and
directories
cp
from
source to
destination.
Moves or
renames
mv
files and
directories.
Removes
rm files or
directories.
grep Searches
for specific
strings of
characters
within a
file or other
commands
outputs.
Lists the
contents of
a file and
cat expects the
file name
as the
parameter.
For complete help on everything Kali Linux, open the Firefox web browser and go
to https://www.kali.org/docs/.
Here, you can perform a search by typing keywords in the search box or use the
categories to find an answer by subject.
In this step, you will use the change directory (cd), make directory (mkdir), and list
directory (ls) commands.
Note: A directory is another word for folder. The terms directory and folder are used
interchangeably throughout this lab.
Note: There may be times when a command will not work because the user that is
currently logged on does not have permission to perform it. To temporarily gain
permission for the command, proceed the command with sudo, which stands for super
user "do". You may need to provide the password of a user that has permission to
perform the command. Alternatively, you can use a terminal that has a higher
permission level. This terminal is called Root Terminal Emulator and can be found in the
panel by using the drop-down menu next to the terminal icon.
a. In a terminal, enter pwd at the prompt. This command will print the current
working directory to the terminal.
┌──(kali㉿Kali)-[~]
└─$ pwd
/home/kali
What is the current directory?
Answer Area
Show Answer
┌──(kali㉿Kali)-[~]
└─$ cd /home/kali
c. Type ls -l at the command prompt to list the files and folders that are in the
current working directory. The ls command stands for list. The -l option displays
the file size, permissions, ownership, date of creation and more for the files and
folders.
┌──(kali㉿Kali)-[~]
└─$ ls -l
total 36
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Desktop
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Documents
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Downloads
-rw-r--r-- 1 kali kali 142 Apr 10 14:51 gvm_admin_passwd.txt
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Music
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Pictures
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Public
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Templates
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Videos
d. In the current directory, use the mkdir command to create three new
folders: kali_folder1, kali_folder2, and kali_folder3. Type mkdir
kali_folder1 and press Enter. Repeat these steps to create kali_folder2 and
kali_folder3.
┌──(kali㉿Kali)-[~]
└─$ mkdir kali_folder1
┌──(kali㉿Kali)-[~]
└─$ mkdir kali_folder2
┌──(kali㉿Kali)-[~]
└─$ mkdir kali_folder3
┌──(kali㉿Kali)-[~]
└─$ mkdir kali_folder1 kali_folder2 kali_folder3
e. Type ls -l to verify that the folders have been created and navigate to a new
folder:
┌──(kali㉿Kali)-[~]
└─$ ls -l
total 48
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Desktop
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Documents
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Downloads
drwxr-xr-x 2 kali kali 4096 Apr 21 15:09 kali_folder1
drwxr-xr-x 2 kali kali 4096 Apr 21 15:09 kali_folder2
drwxr-xr-x 2 kali kali 4096 Apr 21 15:09 kali_folder3
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Music
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Pictures
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Public
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Templates
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Videos
┌──(kali㉿Kali)-[~]
└─$ cd /home/kali/kali_folder3
┌──(kali㉿Kali)-[~/kali_folder3]
└─$
Which folder are you in now?
Answer Area
Show Answer
Note: In the [kali@kali ~]$ prompt above: The tilde symbol ~ represents the
current user’s home directory. In this example, the current user’s home directory
is /home/kali. After the cd /home/kali/kali_folder3 command, the current working
directory is now /home/kali/kali_folder3.
Note: $ (dollar sign) indicates regular user privilege. If a ‘#’ (hashtag or pound
sign) is displayed at the prompt, it indicates elevated privilege (root user).
Note: While these symbols, conventions and main concepts remain the same, the
terminal window prompt is highly customizable in Linux. Therefore, the prompt
structure seen in this VM will likely differ from the prompt in other Linux
installations.
Challenge: Type the command cd ~ and describe what happens. Why did this happen?
Answer Area
Show Answer
f. Use the mkdir command to create a new folder named kali_folder4 inside
the kali_folder3 folder:
┌──(kali㉿Kali)-[~]
└─$ mkdir /home/kali/kali_folder3/kali_folder4
┌──(kali㉿Kali)-[~]
└─$ ls -l /home/kali/kali_folder3
total 4
drwxr-xr-x 2 kali kali 4096 Apr 21 15:19 kali_folder4
2. Up to this point, we have been using full paths. Full path is the term used when
referring to paths that always start at the root (/) directory. It is also possible to
work with relative paths. Relative paths reduce the amount of text to be typed. To
understand relative paths, we must understand the . and .. (dot and double dots)
directories. From the kali_folder3 directory, issue ls –la:
┌──(kali㉿Kali)-[~/kali_folder3]
└─$ ls -la
total 12
drwxr-xr-x 3 kali kali 4096 Apr 21 15:09 .
drwx------ 20 kali kali 4096 Apr 21 15:07 ..
drwxr-xr-x 2 kali kali 4096 Apr 21 15:19 kali_folder4
The -a option tells ls to show all files. Notice the . and .. listings shown by ls.
These listings are used by the operating system to track the current directory (.)
and the parent directory (..) You can use . and .. with the cd command to change
directories. Using the cd command to change the directory to the . directory incurs
no visible directory change as the . points to the current directory itself.
┌──(kali㉿Kali)-[~]
└─$ cd /home/kali/kali_folder3
4. Type cd .
┌──(kali㉿Kali)-[~/kali_folder3]
└─$ cd .
┌──(kali㉿Kali)-[~/kali_folder3]
└─$
What happens?
Answer Area
Show Answer
5. Changing the directory to the .. directory, will change to the directory that is one
level up the path. This directory is also known as parent directory. Type cd ..
┌──(kali㉿Kali)-[~/kali_folder3]
└─$ cd ..
What happens?
Answer Area
Show Answer
┌──(kali㉿Kali)-[~]
└─$
What would be the current directory?
Answer Area
Show Answer
┌──(kali㉿Kali)-[/home]
└─$
what would be the current directory?
Answer Area
Show Answer
┌──(kali㉿Kali)-[/]
└─$
what would be the current directory?
Answer Area
Show Answer
6. Try using the ~ to change back to the user home directory. Verify your location
with the command that is used to display the current working directory.
Answer Area
Show Answer
┌──(kali㉿Kali)-[/]
└─$ cd /home/kali/
┌──(kali㉿Kali)-[~]
└─$
b. Use the echo command to echo a message. Because no output was defined,
echo will output to the current terminal window:
┌──(kali㉿Kali)-[~]
└─$ echo echo this message
echo this message
c. Use the > operator to redirect the output of echo to a text file instead of to the
screen:
┌──(kali㉿Kali)-[~]
└─$ echo redirect this to a file > text_file.txt
No output was shown. Is that expected?
Answer Area
Show Answer
d. Notice that even though the text_file.txt file did not exist, it was automatically
created to receive the output generated by echo. Use the cat command to display
the contents of the text_file.txt file:
┌──(kali㉿Kali)-[~]
└─$ cat text_file.txt
redirect this to a file
a. Similar to the > operator, the >> operator also allows for redirecting data to files.
The difference is that >> appends data to the end of the referred file, keeping the
current contents intact. To append a message to the text_file.txt, issue the
command below:
┌──(kali㉿Kali)-[~]
└─$ echo this text will be appended to the text file >>
text_file.txt
b. Use the cat command to display the contents of the text_file.txt text file again.
Answer Area
Show Answer
a. Use the rm command to remove files or directories. Issue the command below to
remove the file text_file.txt from the home directory. The ls command can be
used to show that the file text_file.txt has been removed from the home
directory:
┌──(kali㉿Kali)-[~]
└─$ rm text_file.txt
b. In Linux, directories are seen as a type of file. Therefore, the rm command is also
used to delete directories but the -r (recursive) option must be used. Notice that
all files and other directories inside a given directory are also deleted when
deleting a parent directory. Issue the command below to delete
the kali_folder1 folder and its contents:
┌──(kali㉿Kali)-[~]
└─$ rm -r kali_folder1
Step 6: Move files and directories.
a. Moving files works similarly to copying files. The difference is that moving a file
removes it from its original location. Use the mv commands to move files around
the local filesystem. Like the cp command, the mv command also requires
source and destination parameters.
b. Create a new text_file.txt file in the kali_folder2 folder by redirecting some text
to it.
c. Return to the /home/kali/ folder.
d. Issue the command below to move
the text_file.txt from /home/kali/kali_folder2 to the home directory. Note: There
is a dot at the end of command.
┌──(kali㉿Kali)-[~]
└─$ mv kali_folder2/text_file.txt .
┌──(kali㉿Kali)-[~]
└─$ ls -l
total 48
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Desktop
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Documents
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Downloads
drwxr-xr-x 2 kali kali 4096 Apr 21 15:25 kali_folder2
drwxr-xr-x 3 kali kali 4096 Apr 21 15:25 kali_folder3
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Music
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Pictures
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Public
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Templates
-rw-r--r-- 1 kali kali 18 Apr 21 15:49 text_file.txt
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Videos
Why was the dot (“.”) used as the destination parameter for mv?
Answer Area
Show Answer
e. The mv command can also be used to move entire directories and the files they
contain. To move the kali_folder3 (and all the files and directories it contains)
into kali_folder2, use the command below:
┌──(kali㉿Kali)-[~]
└─$ mv kali_folder3/ kali_folder2/
┌──(kali㉿Kali)-[~]
└─$ ls -l /home/kali
total 44
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Desktop
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Documents
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Downloads
drwxr-xr-x 3 kali kali 4096 Apr 21 16:03 kali_folder2
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Music
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Pictures
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Public
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Templates
-rw-r--r-- 1 kali kali 18 Apr 21 15:49 text_file.txt
drwxr-xr-x 2 kali kali 4096 Apr 10 14:51 Videos
f. Use the ls command to verify that the kali_folder3 directory was correctly moved
to kali_folder2.
┌──(kali㉿Kali)-[~]
└─$ ls -l kali_folder2/
total 4
drwxr-xr-x 3 kali kali 4096 Apr 21 15:25 kali_folder3
Reflection
You have learned some basic ways to use Kali Linux in this lab. You learned how to use
the Kali GUI and terminal with some basic Linux commands. The strength of Kali is in its
collection of tools. We will cover some of those tools in labs to come.
How can you learn more about Kali command line tools?
Answer Area
Show Answer
Show All AnswersClear My Responses
© 2017 - 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public