Added daily security check script to use remote linpeas and ls

This commit is contained in:
Nicolai Van der Storm 2024-12-05 21:39:56 +01:00
parent d134439d55
commit 15e69604e0
2 changed files with 43 additions and 0 deletions

View File

@ -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

5
.zshrc
View File

@ -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