Dotfiles/.config/scripts/daily_sec_check.sh

39 lines
1.2 KiB
Bash

#!/bin/bash
# Set the directory for report storage
REPORT_DIR="$HOME/.config/sec"
# Create the directory if it doesn't exist
mkdir -p "$REPORT_DIR"
# Get the current date
DATE=$(date +"%Y-%m-%d")
# Define report filenames based on the date
LINPEAS_REPORT="$REPORT_DIR/linpeas_report_$DATE.txt"
LSE_REPORT="$REPORT_DIR/lse_report_$DATE.txt"
# Check if today's reports already exist
if [ -f "$LINPEAS_REPORT" ] && [ -f "$LSE_REPORT" ]; then
echo "Reports for $DATE already exist. Exiting."
exit 0
fi
# Run linpeas if the report doesn't exist
if [ ! -f "$LINPEAS_REPORT" ]; then
echo "Running linpeas..."
curl -sSL https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | bash > "$LINPEAS_REPORT" 2>&1
echo "linpeas report saved to $LINPEAS_REPORT"
else
echo "linpeas report already exists: $LINPEAS_REPORT"
fi
# Run lse if the report doesn't exist
if [ ! -f "$LSE_REPORT" ]; then
echo "Running linux-smart-enumeration (lse)..."
curl -sSL https://github.com/diego-treitos/linux-smart-enumeration/releases/latest/download/lse.sh | bash > "$LSE_REPORT" 2>&1
echo "lse report saved to $LSE_REPORT"
else
echo "lse report already exists: $LSE_REPORT"
fi