Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment the student will write a basic BASH script. The script will be used to inspect a log file. Script Requirements The script
For this assignment the student will write a basic BASH script. The script will be used to inspect a log file.
Script Requirements
The script may be against a specific log file, or have the log file name determined by the command line. The student may determine which log files or log file types to use. Note: Many log files are available in varsyslog
The script will iterate through the log file and determine some useful information based on what it finds in the log file. The student may determine particular information to pull from the log file.
Examples:
How many times did user X log in between January and December?
List the time of every after hours use of the printer.
The script must allow for and use at least command line arguments.
The command line arguments may either be used as a part of the determination eg user or dates
Or to change the behavior of the script eg count remote vrs local access
The script must include at least one function.
The script will follow the Scripting Best Practices as provided. The bash script needs to be built and tested using appropriate log files. In addition, it is recommended that the student have another student test their script to ensure it works correctly.
Submit a video report following the standard format, along with a copy of the script.
With the script completed and demonstrating its function, discuss how the script could be used by a security professional to aid in spotting, researching, or analyzing a potential security issue. When run with inappropriate arguments, scripts should print a usage message and exit. The same message could be printed with a help argument.
Validate inputs and sanity check derived values.
Return an appropriate exit code: zero for success and nonzero for failure.
Use appropriate naming conventions for variables, scripts, and routines.
User variable names that reflect the values they store.
Start every script with a comment block that tells what the script does and what parameters it takes. Include your name and the date. If the script requires nonstandard tools, libraries, or modules to be installed, list those as well.
Comment at a useful level. More complexity requires more comments.
Error messages should:
Go to STDERR, not STDOUT.
Include the name of the program thats issuing the error.
State the function of operation that failed.
If a system call fails, include the perror string.
Exit with a code other than give the code and the script
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started