A small collection of Bash scripts that demonstrate basic Linux/WSL system auditing tasks (system identity, package inspection, directory audit, log analysis, and generating a short “open-source manifesto”).
Repository:
saksham-stack/oss-audit-24BAI10009
Scripts live in:scripts/
Example outputs/screenshots live in:screenshots/
- Project Overview
- Repository Structure
- Environment Setup
- Dependencies (Table)
- How to Run
- Scripts Description
- Notes / Troubleshooting
- License
This repository contains 5 Bash scripts that:
- Print system identity information (kernel, user, uptime, etc.)
- Check whether an open-source package (Git) is installed and show package metadata
- Audit directory permissions and disk usage for common system paths
- Scan a system log file for a keyword and report match counts
- Interactively generate a short manifesto text file based on user input
oss-audit-24BAI10009/
├── LICENSE
├── README.md
├── scripts/
│ ├── script1_system_identity.sh
│ ├── script2_PackageInspector.sh
│ ├── script3_Disk_Permission_Auditor.sh
│ ├── script4_fileAnalyzer.sh
│ └── script5_manifestoGenerator.sh
└── screenshots/
├── script1_output.png
├── script2_output.png
├── script3_output.png
├── script4_output.png
└── script5_output.png
These scripts are designed for:
- Ubuntu / Debian-based Linux, or
- WSL (Windows Subsystem for Linux) running Ubuntu/Debian
Some commands (like dpkg) assume a Debian-based environment.
- A Bash shell (
bash) - Basic GNU/Linux utilities (most are installed by default on Ubuntu)
- Optional but recommended:
git(also inspected by Script 2)
git clone https://github.com/saksham-stack/oss-audit-24BAI10009.git
cd oss-audit-24BAI10009| Script / Component | Commands Used | Package / Source | Notes |
|---|---|---|---|
| All scripts | bash |
system (Bash shell) | Scripts have #!/bin/bash shebang |
Script 1: script1_system_identity.sh |
uname, whoami, uptime, date, env var HOME |
coreutils / procps (typical default) | Prints identity + kernel + uptime + date |
Script 2: script2_PackageInspector.sh |
dpkg, grep, dpkg -l, dpkg -s |
dpkg (Debian/Ubuntu) |
Will not work as-is on Fedora/Arch/macOS |
Script 3: script3_Disk_Permission_Auditor.sh |
ls, awk, du, cut |
coreutils + awk | Audits /etc, /var/log, /home, /usr/bin, /tmp |
Script 4: script4_fileAnalyzer.sh |
grep, tail, while read |
grep/coreutils | Reads /var/log/alternatives.log and searches keyword |
Script 5: script5_manifestoGenerator.sh |
read, whoami, date, cat |
bash + coreutils | Writes manifesto_<user>.txt in repo directory |
From the repo root:
chmod +x scripts/*.shExamples:
./scripts/script1_system_identity.sh
./scripts/script2_PackageInspector.sh
./scripts/script3_Disk_Permission_Auditor.sh
./scripts/script4_fileAnalyzer.sh
./scripts/script5_manifestoGenerator.shFile: scripts/script1_system_identity.sh
What it does
- Prints a header and basic machine/user information:
- Kernel version (
uname -r) - Current user (
whoami) - Home directory (
$HOME) - Uptime (
uptime -p) - Date/time (
date)
- Kernel version (
- Includes a short note about GNU GPL licensing.
Run
./scripts/script1_system_identity.shFile: scripts/script2_PackageInspector.sh
What it does
- Checks whether Git is installed using
dpkg - If installed:
- prints package status and selected metadata (Version/License/Description)
- Prints a short “philosophy” statement using a
casestatement
Run
./scripts/script2_PackageInspector.shNote
- This script assumes a Debian/Ubuntu system because it uses
dpkg.
File: scripts/script3_Disk_Permission_Auditor.sh
What it does
- Iterates over common directories:
/etc,/var/log,/home,/usr/bin,/tmp
- For each directory that exists, prints:
- Permissions + owner/group (via
ls -ldandawk) - Total size (via
du -sh)
- Permissions + owner/group (via
Run
./scripts/script3_Disk_Permission_Auditor.shFile: scripts/script4_fileAnalyzer.sh
What it does
- Reads
/var/log/alternatives.logline-by-line - Counts how many lines match a keyword (case-insensitive)
- Displays the last 3 matching lines
Current configuration
LOGFILE="/var/log/alternatives.log"KEYWORD="status"
Run
./scripts/script4_fileAnalyzer.shNote
- If
alternatives.logdoes not exist on your distro, changeLOGFILEto a log file that exists (for example/var/log/syslogon Ubuntu).
File: scripts/script5_manifestoGenerator.sh
What it does
- Prompts the user for 3 inputs:
- open-source tool used daily
- what “freedom” means (one word)
- what the user would build and share
- Writes a file named:
manifesto_<username>.txt
- Prints the saved manifesto
Run
./scripts/script5_manifestoGenerator.shOutput
- A text file is created in the current directory (usually repo root if run from there).
- Permission denied when running scripts:
chmod +x scripts/*.sh - Script 2 fails on non-Ubuntu/non-Debian:
- Replace
dpkgusage with your distro equivalent (e.g.,rpm -qi,pacman -Qi, etc.).
- Replace
- Script 4 log file not found:
- Edit
LOGFILEinsidescripts/script4_fileAnalyzer.shto a valid log path for your system.
- Edit
See LICENSE.