From 15e69604e0851f06eefc06e4aa7f1dd913dbe39e Mon Sep 17 00:00:00 2001 From: Nicolai Van Der Storm Date: Thu, 5 Dec 2024 21:39:56 +0100 Subject: [PATCH] Added daily security check script to use remote linpeas and ls --- .config/scripts/daily_sec_check.sh | 38 ++++++++++++++++++++++++++++++ .zshrc | 5 ++++ 2 files changed, 43 insertions(+) create mode 100644 .config/scripts/daily_sec_check.sh diff --git a/.config/scripts/daily_sec_check.sh b/.config/scripts/daily_sec_check.sh new file mode 100644 index 0000000..4b3d1b7 --- /dev/null +++ b/.config/scripts/daily_sec_check.sh @@ -0,0 +1,38 @@ +#!/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 diff --git a/.zshrc b/.zshrc index 28c0a6b..cd0aa3d 100644 --- a/.zshrc +++ b/.zshrc @@ -1,3 +1,5 @@ + + # Set the directory we want to store zinit and plugins ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/shere}/zinit/zinit.git" @@ -65,3 +67,6 @@ eval "$(fzf --zsh)" eval "$(zoxide init --cmd cd zsh)" source /usr/share/nvm/init-nvm.sh + +bash $HOME/.config/daily_sec_check.sh +