Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a shell script which uses the bash shell called ZZ012_script.sh The resulting script being run will produce output similar to the terminal screenshot below.

Write a shell script which uses the "bash" shell called ZZ012_script.sh The resulting script being run will produce output similar to the terminal screenshot below. The bold text represents input to be entered in by the user running the script. The USER HOST in the first line represent place holders for the information which will reflect the username of the person running the script and the host where the script is being run. The XX:XX:XX XX and XX/XX/XXXX in the first line represent place holders and format of the information which will reflect the time and date the script is run. The shell script does not need to be compiled.

$ ./hynes_script.sh auth.log OR $ ./hynes_script.sh Enter the log filename auth.log USER ran this script on HOST at XX:XX:XX XX on XX/XX/XXXX: File directory.txt has the list of the current directory. The auth.log file has 297377 lines. Now searching auth.log file. Putting search results in the report.txt file. File new_directory.txt has the list of the current directory. File reverse.txt has reverse sort of new_directory.txt file. File changes.txt has the differences between the directory list files. The script is done!

Requirements

  • Put the first line of information in the report.txt file.
  • Put a list the directory contents using long listing format to directory.txt file.
  • Print out the line count for the auth.log file.
  • Search the auth.logimage text in transcribed for the number of times the following phrases are found:
    • Invalid user
    • oleg from 187.144.46.203
    • oleg from
    • Bye Bye
    • Authentication failure
    • Accepted keyboard-interactive/pam
  • Put the results of those searches in report.txt
  • Put a list the directory contents using long listing format to new_directory.txt file.
  • Sort the contents of new_directory.txt in reverse order put the results in reverse.txt file.
  • Use a command to compare the difference between new_directory.txt and directory.txt files put output from that command in changes.txt file.

#!/bin/bash # NAME file=$1 if [ ! $1 ] then echo "Enter the log filename" read file echo "" if [ ! -f $file ] then echo "Error" exit 1 fi fi echo "The script is done!" Inside report.txt nicolehy ran this script on shell at 12:06:24 PM on 02/03/2020: The auth.log file has 297377 lines. There were 146929 'Invalid user' logged. There were 9778 'oleg from 187.144.46.203' logged. There were 9778 'oleg from' logged. There were 303 'Bye Bye' logged. There were 96 'Authentication failure' logged. There were 41 'Accepted keyboard-interactive/pam' logged.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

How would you train others to perform the task? Explain.

Answered: 1 week ago

Question

=+what kinds of policies and practices should be developed?

Answered: 1 week ago