Sync all scripts from website downloads — 352 scripts total

Includes updated JS challenge scripts with Claude-User whitelist,
same-site referer bypass, Blackbox-Exporter allowed bot, and all
new exporters, cheat sheets, and automation scripts.
This commit is contained in:
2026-05-25 03:31:08 +02:00
parent dbd6bf0324
commit a1a17e81a1
332 changed files with 174509 additions and 1106 deletions
+73 -44
View File
@@ -1,15 +1,22 @@
#!/bin/bash
########################################################################################
#### users_logged_in.sh ####
#### ####
#### This script monitors and reports information about users currently logged into ####
#### a Linux system. It's designed to work with Prometheus monitoring system to ####
#### track user activity on Amazon, Ubuntu, and RedHat Linux servers. ####
#### ####
#### Contact: Phil Connor contact@mylinux.work ####
#### Version 3.3.1-20250923 ####
########################################################################################
################################################################################
# Script Name: users-logged-in.sh
# Version: 3.4.0-20260415
# Description: Prometheus exporter for user login activity — tracks sessions,
# terminals, sudo commands, failed logins, and session durations
#
# Author: Phil Connor
# Contact: contact@mylinux.work
# Website: https://mylinux.work
# License: MIT
#
# Usage:
# ./users-logged-in.sh # Output to stdout
# ./users-logged-in.sh --textfile # Write to textfile collector
# ./users-logged-in.sh --dry-run # Preview metrics
# ./users-logged-in.sh -o /tmp/out.prom # Write to custom file
################################################################################
set -euo pipefail
@@ -18,7 +25,11 @@ DRY_RUN=false
VERBOSE=false
QUIET=false
NO_CRON=false
SCRIPT_VERSION="3.3.1-20250923"
SCRIPT_VERSION="3.4.0-20260415"
# Output configuration
TEXTFILE_DIR="/var/lib/node_exporter"
OUTPUT_FILE=""
# Parse command line arguments
parse_arguments() {
@@ -37,6 +48,14 @@ parse_arguments() {
QUIET=true
shift
;;
--textfile)
OUTPUT_FILE="$TEXTFILE_DIR/usrlogins.prom"
shift
;;
-o|--output)
OUTPUT_FILE="$2"
shift 2
;;
--no-cron)
NO_CRON=true
shift
@@ -52,6 +71,8 @@ parse_arguments() {
echo "Monitor user login activity and export Prometheus metrics"
echo ""
echo "Options:"
echo " --textfile Write to node_exporter textfile collector"
echo " -o, --output Output file path"
echo " --dry-run Output metrics to console instead of file"
echo " --verbose Enable verbose debug output"
echo " --quiet Suppress non-error output"
@@ -492,34 +513,11 @@ output_metric() {
echo "${metric_value:-$default_value}"
}
# Main function - Orchestrate the entire monitoring process
main() {
# Parse command line arguments first
parse_arguments "$@"
# Record script start time for runtime metric
# Generate all metrics to stdout
generate_metrics() {
local script_start_time
script_start_time=$(date +%s.%N)
# Add dry-run header if applicable
if [[ "$DRY_RUN" == "true" ]]; then
echo "=== DRY RUN MODE - Metrics that would be written to $NODE_EXPORTER_DIR/usrlogins.prom ===" >&2
fi
trap cleanup EXIT # Ensure cleanup runs when script exits
# Initialize environment and commands
find_commands
# Skip setup in dry-run mode
if [[ "$DRY_RUN" == "false" ]]; then
setup_directory
setup_lockfile
install_cron_job
fi
# Generate and output all Prometheus metrics
# Metric 1: Individual user sessions with details
local users
users=$(get_logged_users)
@@ -604,16 +602,47 @@ main() {
script_runtime=$(echo "$script_end_time - $script_start_time" | bc -l 2>/dev/null || echo "0")
output_metric "node_user_monitor_runtime_seconds" "Script execution time in seconds" "gauge" \
"node_user_monitor_runtime_seconds $script_runtime" "node_user_monitor_runtime_seconds 0"
if [[ "$DRY_RUN" == "true" ]]; then
}
# Main function - Orchestrate the entire monitoring process
main() {
parse_arguments "$@"
trap cleanup EXIT
find_commands
if [[ "$DRY_RUN" == "false" ]]; then
setup_directory
setup_lockfile
install_cron_job
fi
if [[ -n "$OUTPUT_FILE" ]]; then
local output_dir
output_dir="$(dirname "$OUTPUT_FILE")"
mkdir -p "$output_dir"
local temp_file
temp_file=$(mktemp "${output_dir}/.usrlogins_metrics.XXXXXX")
if ! generate_metrics > "$temp_file" 2>/dev/null; then
rm -f "$temp_file"
echo "ERROR: Failed to generate metrics" >&2
exit 1
fi
chmod 644 "$temp_file"
mv -f "$temp_file" "$OUTPUT_FILE"
log_info "Metrics written to $OUTPUT_FILE"
elif [[ "$DRY_RUN" == "true" ]]; then
echo "=== DRY RUN MODE ===" >&2
generate_metrics
echo "=== END DRY RUN OUTPUT ===" >&2
else
generate_metrics
fi
}
# Script entry point
main "$@"
# 2025-09-23
# Fixed: Prometheus parsing errors with single quotes (\' sequences)
# Fixed: Prometheus parsing errors with backslash escapes (\u, \x, etc.)
# Improved: Domain regex pattern now handles any us.*.net domain instead of just us.calormen.net