0% found this document useful (0 votes)
163 views48 pages

CY2004-CyberSec Assignment No. 1

Uploaded by

universitydata18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views48 pages

CY2004-CyberSec Assignment No. 1

Uploaded by

universitydata18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

CY-2004 Cyber Security Fall 2024 ASSIGNMENT No.

INSTRUCTIONS

• Download & Modify the attached Template of assignment.


• You must submit the docx file of final version of your report with the naming convention as
✓ RollNumber-FullName-A01.docx.
• Files submitted with naming convention other than provided instructions / filetype / template
will result in -50% marks.
• Your final draft must be submitted on Google Classroom (GCR) before the deadline.
• All snapshots added to the report must be of full screen including task bar and status bar etc.
Failing to comply with this will result in marks deduction.
• Read the whole manual carefully, after all environmental setup there is an assignment task at
the end of this document.
• Maximum Marks = 120
• Deadline = August 31, 2024 (11:59 PM)
• NOTE: If you already have Linux installed, you can skip PART A. Just add a screenshot of your
Linux environment.

Part A (Pre-Environment Setup) {10 Marks}

INTRODUCTION TO VIRTUAL MACHINES AND THEIR INSTALLATION

Lab Objectives:

In this lab, you will learn:

• Virtualization
• VMware Workstation and its Installation
• Install Linux on VMware Workstation
• Linux Terminal Commands

Lab Description:

What does Virtual Machine (VM) mean?

For simplicity, think of a virtual machine (VM) as a "computer made of software"


which you can use to run any software you'd run on a real, physical computer. Like a
physical machine, a virtual machine has its own operating system (Windows, Linux,
etc.), storage, networking, configuration settings, and software, and it is fully isolated
from other virtual machines running on that host.

How virtualization works

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

Virtualization describes a technology in which an application, guest OS or data


storage is abstracted away from the true underlying hardware or software. Hypervisors
take the physical resources and separate them so they can be utilized by the virtual
environment. They can sit on top of an OS, or they can be directly installed onto the
hardware.

Advantages of virtualization

The advantages of utilizing a virtualized environment include the following:

• Lower costs. Virtualization reduces the amount of hardware servers necessary


within a company and data center. This lowers the overall cost of buying and
maintaining large amounts of hardware.
• Easier disaster recovery. Disaster recovery is very simple in a virtualized
environment. Regular snapshots provide up-to-date data, allowing virtual
machines to be feasibly backed up and recovered. Even in an emergency, a
virtual machine can be migrated to a new location within minutes.
• Easier testing. Testing is less complicated in a virtual environment. Even if a
large mistake is made, the test does not need to stop and go back to the
beginning. It can simply return to the previous snapshot and proceed with the
test.
• Quicker backups. Backups can be taken of both the virtual server and the virtual
machine. Automatic snapshots are taken throughout the day to guarantee that
all data is up to date. Furthermore, the virtual machines can be easily migrated
between each other and efficiently redeployed.
• Improved productivity. Fewer physical resources result in less time spent
managing and maintaining the servers. Tasks that can take days or weeks in a
physical environment can be done in minutes. This allows staff members to
spend most of their time on more productive tasks, such as raising revenue and
fostering business initiatives.

VMware

• VMware is one of the best virtualization platforms in the world, popular among IT
specialists due to its ability to provide high speed operations, reliability,
scalability, security and convenience.
• It is essential to internal penetration testing as most organizations use it for their
infrastructure.
• As security professionals, we need to learn about this technology and
understand the attacks that can be carried out against it.
• VMware is an amazing virtualization platform for network engineers, system
administrators and other information technology professionals.
• In this lab, we will focus on VMware Workstation Player. We will learn VMware
Download and VMware Workstation Installation step by step.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• With VMware, you can create virtual devices on our PC and use them as they are
real devices.
• This device can be a Windows server, Linux server etc. With VMware workstation
player, we can have multiple virtual devices, and we can run virtual devices,
programs on them.

Tools/Software Requirement:

1. VMware
(https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workst
ation%20Pro&authuser=0)
2. Kali Linux ISO (https://cdimage.kali.org/kali-2024.2/kali-linux-2024.2-installer-amd64.iso)

Lab Tasks 1: Installing VMware Workstation


There are two options for downloading, one is Windows and the other for Linux. In this lab the
Windows version will be used.

✓ Navigate to the Link (https://profile.broadcom.com/web/registration) and register yourself


using your NU Emails.

✓ Now Login/Sign in to your Broadcom account using Link


(https://access.broadcom.com/default/ui/v1/signin/) or navigated automatically to the login
page or maybe you logged in automatically.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

✓ Now navigate to the above given link


(https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workst
ation%20Pro&authuser=0) & select the windows personal use tab.

✓ Select the latest release of the VMware Workstation Pro.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

✓ Click on the Download Button.

✓ After Download, Run the VMware Workstation Pro Executable.

✓ Click Next to continue.

✓ Read the agreement, then accept the agreement, & click Next to continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

✓ Set installation path or use default, them enable Enhanced Keyboard Driver & click Next.

✓ Click Next to continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

✓ Click Next to continue.

✓ Click Install.

✓ Click Finish to exit the wizard.


✓ That’s it we have successfully installed VMware Workstation Pro.
✓ Now you can start the VMware Workstation Pro by clicking on the shortcut on Desktop.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

Below is the home screen of the VMware Workstation pro which you will see every time when you start
Workstation.

Lab Tasks 2: Installing Kali Linux on VMWare Workstation Pro


• First, visit the official website of Kali Linux from your favorite web browser. Once the page
loads, click on Download or use link (https://cdimage.kali.org/kali-2024.2/kali-linux-2024.2-
installer-amd64.iso)
• Your browser should start downloading the Kali Linux ISO file. It may take a while to complete.
• Once the Kali Linux ISO file is downloaded, open VMware Workstation Pro and click on File >
New Virtual Machine. Or simply select Create a new Virtual Machine from Home Page.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Click Next to continue.

• Select Installer disc image file, then click on browse… to add the iso of kali Linux downloaded
in previous step & click Next to continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select Linux from Operating system, then from version dropdown select Debian 12.x 64-bit &
click Next to continue.

• Provide some name to virtual machine, the browse for the location where to save the virtual
machine. Make sure there is at least 40GB space in your selected drive & click Next to
continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Recommended disk size is 20GB but use at least 40GB of disk space, the select anyone fotm
the split options. Click Next to continue.

• Click Finish to exit the wizard

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

To customize hardware use, Customize Hardware option. We can do this later.


• A new virtual machine should be created. Now, Power On the Kali Linux newly created Virtual
Machine.

• NOTE: To enter the cursor inside the Virtual Machine just click inside the Virtual Machine
window, if you want to release the cursor then simply use combination of ctrl + alt buttons.
• Click on the Graphical Install.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select language and click Continue.

• Select Location & click continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select Keyboard & click continue.

• Now wait for the progress, it will take some time to add additional components.
• Write Hostname or click continue to use default hostname kali.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Just leave the domain name empty & click continue.

• Enter your Full Name or any Name.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Set username for your account & click continue.

• Set a password for your account.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select clock & click continue.

• For current scenario select Guided – use entire disk which means it will initialize the complete
disk assigned at VM creation process. Click continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Disk will be selected by default, click continue.

• Use default selected option, All files in one partition, click continue

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Verify disk partition the select Finish partitioning & click continue.

• Select Yes to write changes on the disk & click continue.

• This will take some time to install the complete operating system.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select the software details to install (Xfce, GNOME, KDE Plasma all are GUI for kali linux install
anyone of them. Xfce is the default GUI of Kali Linux) & click continue.

• It will take a long time to install so, sit back calmly and wait.
• To Install Grub select yes & click continue.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Select the device/drive to install grub & click continue.

• It will take a few minutes to finish the installation.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Click continue to reboot the system, after reboot the Kali Linux operating system will be installed
& ready to use.

• After rebooting, kali Linux is installed. To continue provide the username and password that were
initially set at the installation step & click Login.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• This is the desktop of Kali Linux Operating system with the following things highlighted.
1. Lock Screen Button: This icon allows you to lock your screen & other to perform
other power operations.
2. Volume & Network Status Control: This icon lets you adjust the system volume
& the status of your network connection. This bar also includes Battery & Time.
3. Resource Monitor: This allows you to monitor the CPU & Memory Usage.
4. Workspace Switcher: This allows you to switch between different virtual
workspaces.
5. Terminal Icon: This icon opens the terminal to perform command line (CLI)
operations.
6. Show Desktop: This icon allows you to jump to Desktop from any window & then
jump back to that window again.
7. Show Applications Icon: This icon opens the applications menu where you can
browse and launch installed applications.

<-------------------------------------------------------Part A------------------------------------------------------->

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

Part B (Assessment Tasks) {90 Marks}

INTRODUCTION TO LINUX & THEIR COMMANDS

Linux is a powerful, open-source operating system widely used for its stability, security, and flexibility.
It is the backbone of many servers, desktops, and embedded systems, making it an essential skill for
IT professionals. With a wide variety of distributions available, Linux caters to diverse needs, from
beginners to advanced users. In this assignment, you will explore the basics command-line usage,
and file management of Linux.

Rules:
1. Download the task files.
2. Carefully review all the commands.
3. Execute the required operations.
4. Capture screenshots and include them as evidence in your report.
5. For commands help use –-help flag after command.

Task Files Download Link:


https://drive.google.com/file/d/1RFyK3X7Et1ZNfsMaDC4yEUcVn0N2CDlT/view?usp=
sharing

• sudo command:

Short for superuser do, sudo is one of the most common Linux commands that lets you
perform tasks that require administrative or root permissions.

The command sudo su is used to switch to the root user (superuser) in a Linux system.

TASK 1: (5 marks)
• Open your terminal.
• Run the command sudo su to switch to the root user.
• Verify that you have successfully switched by checking the prompt (it should
change to #, indicating root access).
• Take a screenshot of your terminal.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• APT command:

Package management command to install, update, or remove software packages on


Debian-based systems.

The apt command is used for managing software packages on Debian-based Linux
distributions, allowing you to install, update, upgrade, and remove software. It often
requires sudo to execute commands with administrative privileges for system-wide
changes.

TASK 2: (5 marks)
• Write all commands in report & provide the screenshot of terminal.
• Open your terminal.
• Update and upgrade the linux
• Install tree and wget packages
• Write tree command in terminal.
• Use wget command to download some file from internet.
• MAN command:
Displays the manual page for a specified command, providing detailed information and
options.
Syntax: man (command)
Example: man cd
• LS command:
Lists files and directories in the current directory.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

ls: Lists files and directories in the current directory.


ls -la: Lists all files and directories, including hidden ones, with detailed information.
ls -a: Lists all files and directories, including hidden ones.
ls -l: Lists files and directories with detailed information such as permissions, owner,
and size.
• MKDIR command:
Creates a new directory.

The above command created a folder in current directory. We can also use path
traversal ways like:

"../" is used to navigate one directory up from the current directory.

• PWD command:
Prints the current working directory's full path.

• CD command:
Changes the current directory to the specified path.

• TOUCH command:
Creates an empty file or updates the timestamp of an existing file.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• CAT command:
Concatenates and displays the contents of files without opening it on editor or viewer.

▪ls: The ls command lists all the files and directories in the current directory. It
provides a quick overview of the contents, allowing you to see what is stored in
that location.
▪ echo Hello World! > i211910_MFaheem: This command prints "Hello World!" to
the terminal and redirects the output to a file named i211910_MFaheem. If the
file doesn't exist, it will be created; if it does exist, its contents will be
overwritten.
▪ cat i211910_MFaheem: The cat command reads and displays the contents of
the file i211910_MFaheem. It allows you to view the text "Hello World!" that was
previously written to the file.
• CP command:
Copies files or directories from one location to another.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

In this example the file i211910_c1.txt is replicated or another copy is created.


• MV command:
Moves or renames files or directories.

In this example, a test directory is created which was empty initially & after using mv
command the file i211910_c1.txt is moved to test directory.

TASK 3: (10 marks)


• Write all commands in report & provide the screenshot of terminal.
• Create a directory named i23xxxx_Name. (write your own Name & Roll #)
• Navigate into the directory.
• Check your current location/directory.
• Create an empty file named i23xxxx_c1.txt
• Insert a brief introduction about yourself in file.
• Display the contents of i23xxxx_c1.txt.
• Append text "Project Started" to i23xxxx_c1.txt
• Create a copy of i23xxxx_c1.txt named bac`kup_i23xxxx.txt
• Move the backup file to the parent directory.
• Navigate back to the parent directory.
• Verify the existence of the backup file.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• RM command:
Removes files or directories.

• RMDIR command:
Removes empty directories.

For nonempty directories.

• CHMOD command:
Changes the permissions of files or directories.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

The chmod command in Linux is used to change the permissions of files and
directories. It operates by setting read (r), write (w), and execute (x) permissions for the
owner (user), group, and others. Permissions can be set using symbolic mode (e.g.,
chmod u+x file to add execute permission for the user) or numeric mode (e.g., chmod
755 file), where each digit represents the permissions for the user, group, and others.
The first digit (user) is a sum of read (4), write (2), and execute (1); the same applies to
the group and others. For example, chmod 755 grants full permissions to the user and
read-execute permissions to the group and others. Symbolic mode allows for more
specific changes, like chmod g-w to remove write permissions for the group.
Additionally, chmod can recursively change permissions in a directory using the -R
option (e.g., chmod -R 755 directory).
• LOCATE command:
Quickly finds the location of files or directories in the filesystem.

• FIND command:
Searches for files and directories within a specified path.
1. Search for Files by Name:

"2> /dev/null" at the end of a command redirects error messages to /dev/null


instead of to stdout. That way you only see output from the command without
seeing any error messages. /dev/null is also known as the bit-bucket.
Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

2. Search for Directories:

3. Search for Files by Type:

4. Search for Files by Extension:

5. Search for Empty Files and Directories:

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• GREP command:
Searches text using patterns and displays matching lines.

TASK 4: (10 marks)


• Write all commands in report & provide the screenshot of terminal.
• Use the provided file named grep_task.txt.
• Execute the command: cd /
• locate the path to the grep_task.txt file on your system from root directory.
• Also find the grep_task.txt file starting from your current directory.
• Use the grep command to find the username mentioned in the file. (Hint: The
search should be case-insensitive.)
• Identify the password associated with that user in the file. (Hint: Pay close
attention to the line where the password is mentioned.)
• Search for any comment that the user left in the file.
• Create a new Python file named i23xxxx_addition.py. (replace i23xxxx with
your roll no.)
• In the i23xxxx_addition.py file, write a Python script that:
Takes two numbers as input.
Adds the two numbers together.
Prints the result in the format: (Hey i23xxxx, the sum of Two Numbers is: ...)
• Save the Python file.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

•change the file's permissions so that only the owner can read, write, and
execute the file, but others cannot.
• Execute the i23xxxx_addition.py file to ensure it runs correctly with the
changed permissions.
• print the permissions with ls command and take ss.
• HEAD command:
Displays the first few lines of a file.

• TAIL command:
Displays the last few lines of a file.

• CLEAR command:
Clears the terminal screen.
Syntax: clear
• RESET command:
Resets the terminal to its default settings.
Syntax: reset

• WC command:
Counts the number of lines, words, and characters in a file.

For i211910_c1.txt:
▪ 11 refers to the number of lines in the file.
▪ 90 refers to the number of words in the file.
▪ 490 refers to the number of characters in the file.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• DU command:
du is a command in Linux (short for disk usage) which helps you identify what
files/directories are consuming how much space.

• TR command:
Translate command(tr) can help you in number of ways, ranging from changing
character cases in a string to replacing characters in a string. REF. LINK

TASK 5: (10 marks)


• Write all commands in report & provide the screenshot of terminal.
• Run tr --help command and tell how will you select any digit character in the
string?
• What sequence is equivalent to [a-zA-Z] set?
• What sequence is equivalent to selecting hexadecimal characters?
• Use the provided file named grep_task.txt.
• Use the tr command to convert all lowercase letters in grep_task.txt to
uppercase.
• Remove all vowels (both lowercase and uppercase) from the text in
grep_task.txt using the tr command.
• Replace all spaces in grep_task.txt with underscores using the tr command.
• Compress any sequences of repeated characters in grep_task.txt using the tr
command.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Delete all non-alphanumeric characters from grep_task.txt using the tr


command.
• Replace all tab characters in grep_task.txt with spaces using the tr command.
• AWK command:
This is the most-est powerful tool in my arsenal; I can't think of any other command that
can do something and not awk.
Awk is a scripting language used for manipulating data and generating reports. The awk
command programming language requires no compiling, and allows the user to use
variables, numeric functions, string functions, and logical operators. Simply it is a
pattern scanning and processing language for text manipulation.
print a file with awk:

search for a pattern inside a file:

list me the words that are at 1st and 4th fields:

NR: (Number Record) is the variable that keeps count of the rows after each line's
execution.

FS: (Field Separator) is the variable to set in case you want to define the field for input
stream.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

RS: (Record Separator): By default, it separate rows with '\n', you can specify something
else too.

OFS: (Output Field Separator) You must have gathered some idea by the full form, it is to
specify a delimeter while outputing.

TASK 6: (10 marks)


• Write all commands in report & provide the screenshot of terminal.
• Use the provided file named awk_task.txt
• use awk command to print the following output:
ippsec:34024
john:50024
thecybermentor:25923
liveoverflow:45345
nahamsec:12365
stok:1234
• How will you make the output as following (there can be multiple; answer it
using the above specified variables in BEGIN pattern):

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

ippsec, john, thecybermentor, liveoverflow, nahamsec, stok,


• XARGS command:
xargs, a very simple command to use when it comes to make passed string a
command's argument, technically, positional argument. The official documentation
says, xargs is a command line tool used to build and execute command from the
standard input.
What if we want to run multiple command with xargs in one line.

You can see I defined a variable argVar to use later in the 2 commands I ran with bash -c.
There are few files created in the directory with all the words defined in echo command.
You can use xargs with conjunction to find command to enhance the search
results.

Note: The find command prints results to standard output by default, so the -print
option is normally not needed, but -print0 separates the filenames with a \0 (NULL) byte
so that names containing spaces or newlines can be interpreted correctly. rm -rf
specifies the recursive forceful deletion of all the mentioned files.
You can use xargs command to grep a text from any file in any directory meeting a
specific pattern/criteria.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

You can see that I used xargs to grep a pattern matching anything starting with r with any
bunch of characters[:alnum:] and ending with 0. Which returned me this string. If you
want to practice on your own, you can find flag.txt file inside the downloaded zip
archive. Pick a string find a unique pattern for it and then grep it. Peace.
TASK 7: (20 marks)
• Write all commands in report & provide the screenshot of terminal.
• Use the provided file named xarg_task.txt
• You're working in a team and your team leader sent you a list of files that needs
to be created ASAP within current directory so that he can fake the synopsis
report (that needs to be submitted within a minute or 2) to the invigilator and
change the permissions to read-only to only you (Numberic representation).
You can find the files list in the "one" folder.
Use the following flags in ASCII order:
▪ Verbose
▪ Take argument as "files"
• Your friend trying to run multiple commands in one line, and wanting to create
a short version of rockyou.txt, messed up by creating files instead of
redirecting the output into "shortrockyou". Now he messed up his home
directory by creating a ton of files. He deleted rockyou wordlist in that one liner
and can't seem to download it and do all that long process again.
He now seeks help from you, to create the wordlist and remove those extra
files in his directory. You being a pro in linux, show him how it's done in one
liner way.
Use the following flags in ASCII order:
▪ Take argument as "word"
Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

▪ Verbose
▪ Max number of arguments should be 1 in for each file
You can find the files for this task in two folders.
• Which flag to use to specify the max number of arguments in one line.
• How will you escape command line flags to positional arguments?

• CURL command:
cURL(stands for crawl URL; It outputs the data of a URLs webpage in a raw format).
Another amazing command to perform activities that you can do with your browser, in
just a terminal way. You can't download cat pictures from a direct google search and
right clicking > save the image. But with a little grepping and pattern matching iframes,
that can be possible too. There are a lot of things that you can do with curl, ranging from
getting an offline copy of a webpage (grepping the sensitive information later), to
download very large files or activating web shells (for a reverse connection) just by
curling the URL.
curl is a very easy command to use once you get hold of its flags.
Let’s see an example, i started a local python file sharing server & accessed from
browser.

then i will use the curl command without any flags to just see the response.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

TASK 8: (5 marks)
• Write all commands in report & provide the screenshot of terminal.
• Which flag allows you to limit the download/upload rate of a file?
• curl -A ‘juzztesting’ https://nuces.tools/
• Can curl perform upload operations? (Yea/Nah)

• WGET command:
A command line way of downloading stuff with wget(web-get) command.
If i want to download the file from the above file server using terminal, then i will use
wget. First copy the link of file or anything you want to download.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

The use the following command:

TASK 9: (5 marks)
• Write all commands in report & provide the screenshot of terminal.
• How will you enable time logging at every new activity that this tool initiates?
• What command will you use to download https://xyz.com/mypackage.zip
using wget, appending logs to an existing file named "package-logs.txt"
Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• Write the command to read URLs from "file.txt" and limit the download speed
to 1mbps.

• XXD command:
xxd, which is well known for hexdumps or even the reverse. This command is not very
vast to explore, but still knowing this command thoroughly will help you handling hex
strings and hex digits. Whether you're playing ctfs, or bypassing JWT with automation,
xxd can do it all. This command can take input from a file or the input can be passed
through piping or redirection.
Use of -E flag (For curious minds):

Also, just so you know EBCDIC is Extended Binary Coded Decimal Interchange.
Output in binary and C include format:

Specifying a length:

Seeking an offset:

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

Notice that the output seeked at the 0x10th(16th) byte and started dumping the file.
Seeking at offset from the end of the file:

Just by appending the offset's value with a hyphen the command starts dumping from
the end of the file.
TASK 10: (10 marks)
• Write all commands in report & provide the screenshot of terminal.
• Use the provided file named xxd_task.txt
• How will you seek at 10th byte (in hex) in xxd_task.txt and display only 50
bytes?
• How to display a n byte of hexdump in 3 columns with a group of 3 octets per
row from xxd_task.txt? (Use flags alphabetically)
• Which has more precedence over the other -c flag or -g flag?
• From xxd_task.txt file find the value of flag.

• TREE command:
Displays a directory structure in a tree-like format.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• FILE command:
Determines the type of a file based on its content.

• GZIP/ZIP command:
Compresses or decompresses files and directories.

• NETSTAT command:
Displays network connections, routing tables, and interface statistics.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• IFCONFIG/IP A command:
Displays or configures network interfaces.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

• SYSTEMCTL command:
Manages system services, controlling their status, startup, and shutdown.

This command checks and displays the current status of the Apache2 service (you can
replace apache2 with any other service name).

This command starts the Apache2 service. If it's already running, nothing will change.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

This command stops the Apache2 service if it is currently running.

This command restarts the Apache2 service, stopping and starting it again.

This command configures the Apache2 service to start automatically when the system
boots.

This command prevents the Apache2 service from starting automatically at boot time.

This command lists all currently active services on the system.

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120
CY-2004 Cyber Security Fall 2024 ASSIGNMENT No. 1

TASK 11: (20 marks)


• Write all commands in report & provide the screenshot of terminal.
• Install openssh-server via terminal in Linux.
• check whether the SSH service is currently running.
• If the SSH service is not running, start it and verify the status afterward.
• Stop the SSH service and confirm that it has stopped.
• Restart the SSH service and observe any changes.
• Ensure that the SSH service starts automatically when the system boots
• What command should I use to Prevent the SSH service from starting
automatically on boot.
• Make a change to the SSH configuration file (e.g., /etc/ssh/sshd_config) and
reload the SSH without restarting it.
• List all units related to SSH (including sockets)
• Intentionally introduce an error in the SSH configuration file and attempt to
restart the service. Investigate the error using ssh status and correct it.

<-------------------------------------------------------Part B------------------------------------------------------->

Bonus Question (10 marks)

1. You’ve just discovered a new Linux command!


a. What does it do, and what would you name it? (Feel free to get creative!)
2. If your life depended on using only one Linux command forever,
a. Which one would you choose and why? (Yes, it’s a matter of life and shell!)
3. Imagine a world where the man pages are replaced with memes.
a. Which meme best explains the ls command?

Deadline for submission: August 31, 2024 (11:59 PM) Total Marks:120

You might also like