Due Wednesday by 11:59pm Points 100 Submitting a file upload Available Jan 29 at 1pm – Feb 5 at 11:59pm 7 days Write a shell script which uses the “bash” shell called netID_script.sh where netID is your personal netID. 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. Remember your assignment must be submitted by 11:59pm on the due date listed, or it will not be accepted.
$ ./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.logLinks to an external site.Preview the document 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. Grading
Your grade will be based on adhesion to coding standards spoke about in class, design, organization, documentation (comments), and functionality (whether it does everything it is supposed to do). If your program does not run, you will need to explain why it does not and/or under what special conditions it does not. Write your own code and do not copy code from others. Please document any use of online resources or help from others in class.