Week 8 assignment
Description
This assignment will hone your skills as a Bash shell programmer.
In this script you will pull various information out of an authentication log. Begin by manually downloading this into a directory for this assignment. You need not extract it, zcat
will cat it out for you. The script should be run like: ./parse_log.sh auth.log.2.gz
.
Write a script that will do the following:
- test to see if the file actually exists, if not print out a usage message to the user.
- present a menu to the user:
- If the user selects option 1, the script will dump all the unique invalid username login attempts to a file called
users.txt
, sorted alphabetically. (Just the usernames will be in this file) - if the user selects option 2, the script will dump all the unique IP’s to a file called
ips.txt
, sorted ascending. - if the user selects option 3, the script will display all the users that tried to login between 11:00 and 11:15 on a particular date. The script should prompt for the Month and day that you want to look for. Dump it to a file
early_users.txt
(just usernames again) - Option 4 will quit the script
- Any other option will display an error message to the user and redisplay the menu.
- If the user selects option 1, the script will dump all the unique invalid username login attempts to a file called
** Challenge ** This isn’t graded, but see if you can figure out how to ask the user for the time interval that they would like to search for on option 3. Validate that they are actually keying in numbers. It would be a good idea to know how to validate stuff using regular expressions for the exam.
Pass off
This should be passed off in class.
Last Updated 02/07/2025