OPS435 Lab 6 - Bash

From CDOT Wiki
Revision as of 21:42, 24 March 2016 by Andrew (talk | contribs) (Created page with 'Write a script that will examine the latest 15 log files, looking for potential attacks on Apache. Specifically: * The files it will examine start with access_log.1, access_log.…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Write a script that will examine the latest 15 log files, looking for potential attacks on Apache. Specifically:

  • The files it will examine start with access_log.1, access_log.2 and end with access_log.15
    • Use a for(()) loop to iterate through all these filenames.
    • If the file contains the string "Access denied" - the name of the file should be added to an array.
  • After your loop finishes - your array will contain the filename of every log file that contains a potential attack.
  • Use another for(()) loop to print all these filenames.

You could solve the problem without for(()) loops and the array but since that's the point of the exercise - please use them.