mohammed-lvw644-IS1003_Lab-03

pdf

School

University of Texas, San Antonio *

*We aren’t endorsed by this school

Course

1003

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

9

Uploaded by BailiffGuanacoMaster519

Report
1 IS-1003-ON1-Spring-2022-Unlocking Cyber Lab 03 Bash Scripting Author : Fiona Mohammed Course Section : IS-1003-ON1-Spring-2022-Unlocking Cyber Date : March 27, 2022 I NTRODUCTION The objective of this Lab is to use a text editor (e.g., nano) in Linux, to create some basic scripts in a Bash shell, differentiate between Bash keywords/functions and programmer-defined variables/values. Interpreting and analyzing low-level scripts is an essential skill for a cybersecurity professional, so in this lab, I'll learn how to "bash" around in my virtual machine. In the process of completing this lab, I'll be able to use the coding concepts we covered in Modules 03-06. P ROCESS Function of the $ sign within the script : End of Line. In a regular expression, a “$” addresses the end of a line of text. Below is a screenshot of Phase 01: Variables and Assignments. I realized I skipped the “whoami” command, so I went back into my nano and fixed it. (Breakpoint #1a a screenshot of my code in nano) (Breakpoint #1b screenshot of my script execution and output)
2 Filenames and Executables: Let me start with what the term executable mean when referring to a script. An executable refers to a file containing instructions and data meant for performing a sequence of tasks on a computer. The contents of the executable file must be interpreted by an operating system to a meaningful machine code instructions to be used by physical central processing unit. I renamed my v2 file copy to u2 due to an initial error that caused my whole system to freeze and VM to lag for over 20hrs. Below are my images. (Breakpoint #2a screenshot of my v2 (now u2) code in nano) (Breakpoint #2b a screenshot of my file commands, copy command, and bash executable command, along with its output)
3 Appending to a Bash Shell Script: The script for the Bash Shell Version is a fully-fledged programming language in itself. It is the variables not the value. When the shell finds the directory that “ls” exists in, it will create something known as a process. Below are my images for Phase 3: (Breakpoint #3a about-me.sh code) (Breakpoint #3b a screenshot of your echo and cat commands)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4 Functions: When was my Last Login: 18:03 My UID: 1000 My GID: 1000 (Breakpoint #4a a screenshot of my code in nano) (Breakpoint #4b a screenshot of my script execution and output)
5 Conditional Statements: Function code does not execute automatically, in other words; it must be explicitly called. So, what happens if you include a function body, but do not call a function within a script? You get an error. Below are my images for Phase (5) which was mistakenly labeled as Phase (4) on the Instruction file. (Breakpoint #5a a screenshot of my code in nano) (Breakpoint #5b a screenshot of my script execution and output.)
6 Loops: What is the purpose of the variable SCRIPTNAME in the given code? It finds the name of the script being run, stripping out its directory. Below are images of my Phase (6) with the error message that appears when I execute the command. We tried troubleshooting the cause of the error during the last zoom meeting with the students, but it was unsuccessful. You (Prof. Professor Collazo) said I could go ahead and submit it like that, no penalty. (Breakpoint #6a a screenshot of my code in nano.) (Breakpoint #6b a screenshot of my script execution and output with error message.)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
7 Positional Parameters and Associative Arrays: What is the purpose/function of the [@] symbol in the given code? “$@” expands to all arguments to the current function or all arguments to the script, if you're not in a function. If it's unquoted, the arguments will gets split on $IFS characters. If it's double quoted, it'll be as if each separate argument was double quoted. Below are images of my Phase (7) with the error message that outputs after I execute the command. It is the other command we tried troubleshooting on the last zoom with the class. You (Prof. Professor Collazo) said to go ahead and submit, and I would not be penalized. (Breakpoint #7a a screenshot of my code in nano.) (Breakpoint #7b a screenshot of my script execution and output with error message.) L IMITATIONS /C ONCLUSION This lab took me over 30hours of actively working on it. I started on Sunday and was only able to complete it by Tuesday evening. I found out a little too late that my brand- new Samsung Laptop might not be compatible with the Virtual Machine, which is probably why the VM keeps freezing, lagging, and taking hours at a time to start up Ubuntu. I would have thoroughly enjoyed this lab if the Virtual Machine had worked smoothly, and if I did not encounter the last two errors in Phase 6 and 7. I still enjoyed learning and executing bash scripts, but it saddens me that I spent over $1,000 for a laptop that would not allow Ubuntu and VM to properly run and give me the latitude to learn and do my labs fluidly.
8 R EFERENCES University of San Antonio Library (Last updated: Feb 3 2021). Cite It Right APA Style 7 th Edition. https://libguides.utsa.edu/cite/APA Welcome to Virtualbox.org! Oracle VM VirtualBox. (n.d.). Retrieved March 11, 2022, from https://www.virtualbox.org/ Enterprise open source and linux. Ubuntu. (n.d.). Retrieved March 11, 2022, from https://ubuntu.com/ (n.d.). Retrieved from http://linuxsig.org/files/bash_scripting.html Sign - script command lumerical support . (n.d.). Retrieved March 30, 2022, from https://support.lumerical.com/hc/en-us/articles/360034926393-sign-Script-command Bash function & how to use it {variables, arguments, return} . Knowledge Base by phoenixNAP. (2021, December 23). Retrieved March 29, 2022, from https://phoenixnap.com/kb/bash- function Motlke. (2021, September 22). Bash scripting - functions explained with examples . OSTechNix. Retrieved March 29, 2022, from https://ostechnix.com/bash-functions-shell-scripting/ How to format date for display or use in a shell script ... (n.d.). Retrieved March 30, 2022, from https://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/ Rendek, L. (2020, May 28). Bash scripting tutorial for Beginners . Linux Tutorials - Learn Linux Configuration. Retrieved March 30, 2022, from https://linuxconfig.org/bash-scripting- tutorial-for-beginners Typeerror: "X" is not a function - javascript: MDN . JavaScript | MDN. (n.d.). Retrieved March 30, 2022, from https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference/Errors/Not_a_functi on Unix & Linux Stack Exchange. Retrieved March 30, 2022, from https://unix.stackexchange.com/questions/410822/script-shebang-bin-bash-works-in- ubuntu-mate-not-lubuntu-minimal-lxde
9 C OLLABORATION Troubleshooting with Prof. Professor Collazo and two other students (I did not take down their names) via the Tuesday Zoom Student Drop-in Hours.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help