This is a bash project script for my File Systems - Linux course. It provides a set of tools to audit a deployment directory for security vulnerabilities, suspicious files, and other issues.
- File Type Audit: Counts the number of files of each type (e.g.,
.sh,.conf,.js) in the deployment directory. - Suspicious File Scan: Identifies files with potentially sensitive names, such as those containing "debug," "test," or "temp," and extensions like
.bak,.old, or.tmp. - Dangerous Command Detection: Scans all
.shfiles for potentially harmful commands, includingrm -rf,scp,curl, andsudo. - Log Analysis: Analyzes
access.loganderror.logfiles to extract key metrics, such as the number of unique IP addresses, the top 3 most visited pages, and any "File does not exist" errors. - Hardcoded Secrets Detection: Searches configuration files (e.g.,
.env,.conf,.json,.pem) for hardcoded secrets, passwords, keys, or other sensitive credentials.
- A Bash-compatible shell (e.g., Git Bash on Windows, or any standard Linux/macOS terminal).
- The
unzipcommand-line tool. - A
deployment_dir.zipfile in the same directory as the script, containing the deployment files to be audited.
-
Place the script and the
deployment_dir.zipfile in the same directory. -
Make the script executable:
chmod +x deploymentAudit.sh
-
Run the script:
./deploymentAudit.sh
-
Follow the on-screen menu to select an audit task. The script will guide you through the available options.
- Option 1: Audit file types - Counts and displays the number of files for each file extension.
- Option 2: Check for suspicious files - Lists any files with suspicious names or extensions.
- Option 3: Check for dangerous commands (.sh) - Reports any
.shfiles containing potentially dangerous commands. - Option 4: Analyze logs - Provides an analysis of
access.loganderror.log. - Option 5: Scan for secrets - Searches for and displays any hardcoded credentials found in configuration files.
-
View the output. The results of each task are saved to a corresponding output file (e.g.,
task1Output.txt,task2Output.txt, etc.).
To exit the script, type end at the menu prompt.