Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create forensics tool #1094

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions forensics tool
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Forensics Tool Script
# Author: Your Name
# Date: YYYY-MM-DD
# Description: A simple forensics tool to gather system info and check for modified files.

# Function to gather system information
gather_system_info() {
echo "Gathering system information..."
echo "Hostname: $(hostname)"
echo "Operating System: $(uname -o)"
echo "Kernel Version: $(uname -r)"
echo "Uptime: $(uptime -p)"
echo "Users currently logged in:"
who
echo "-----------------------------------"
}

# Function to check for modified files
check_modified_files() {
echo "Checking for modified files in /etc..."
find /etc -type f -mtime -7 -exec ls -l {} \; | sort
echo "-----------------------------------"
}

# Function to analyze log files
analyze_logs() {
echo "Analyzing system logs..."
echo "Last 10 entries in /var/log/auth.log:"
tail -n 10 /var/log/auth.log
echo "-----------------------------------"
}

# Function to display help
display_help() {
echo "Usage: $0 [option]"
echo "Options:"
echo " -s Gather system information"
echo " -m Check for modified files"
echo " -l Analyze log files"
echo " -h Display this help message"
}

# Main script logic
if [ $# -eq 0 ]; then
echo "No options provided. Use -h for help."
exit 1
fi

while getopts ":smlh" opt; do
case $opt in
s)
gather_system_info
;;
m)
check_modified_files
;;
l)
analyze_logs
;;
h)
display_help
;;
\?)
echo "Invalid option: -$OPTARG" >&2
display_help
exit 1
;;
esac
done

# End of script
echo "Forensics tool execution completed."