Major performance and storage improvements
- live-attack-monitor.sh: Remove snapshot loading, fix Apache log monitoring, add IP file sync for auto-blocking - bot-analyzer.sh: * Implement gzip compression for large temp files (10-20x space savings) * Move temp files from /tmp to toolkit/tmp directory * Prevents filling up system /tmp on large servers - run.sh: Add HISTFILE fallback to prevent crashes when sourced - user-manager.sh: * Initialize TEMP_SESSION_DIR to fix user indexing errors * Remove unnecessary temp file I/O for faster user indexing
This commit is contained in:
+10
-10
@@ -192,7 +192,7 @@ get_interworx_user_info() {
|
|||||||
local email=""
|
local email=""
|
||||||
if [ -x "/usr/local/interworx/bin/nodeworx.pex" ] && [ -n "$primary_domain" ]; then
|
if [ -x "/usr/local/interworx/bin/nodeworx.pex" ] && [ -n "$primary_domain" ]; then
|
||||||
email=$(nodeworx -u -n -c Siteworx -a listAccounts 2>/dev/null | \
|
email=$(nodeworx -u -n -c Siteworx -a listAccounts 2>/dev/null | \
|
||||||
grep -F "\"domain\" => \"$primary_domain\"" 2>/dev/null | head -1 | \
|
grep "\"domain\" => \"$primary_domain\"" 2>/dev/null | head -1 | \
|
||||||
grep "\"email\"" 2>/dev/null | head -1 | sed 's/.*=> "\(.*\)".*/\1/')
|
grep "\"email\"" 2>/dev/null | head -1 | sed 's/.*=> "\(.*\)".*/\1/')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -251,11 +251,11 @@ get_cpanel_user_domains() {
|
|||||||
local username="$1"
|
local username="$1"
|
||||||
|
|
||||||
# Primary domain (format: domain: user)
|
# Primary domain (format: domain: user)
|
||||||
grep -F ": ${username}" /etc/trueuserdomains 2>/dev/null | grep "${username}$" 2>/dev/null | cut -d: -f1 || true
|
grep ": ${username}$" /etc/trueuserdomains 2>/dev/null | cut -d: -f1 || true
|
||||||
|
|
||||||
# Addon domains
|
# Addon domains
|
||||||
if [ -f "/etc/userdatadomains" ]; then
|
if [ -f "/etc/userdatadomains" ]; then
|
||||||
grep -F "==${username}" /etc/userdatadomains 2>/dev/null | grep "${username}$" 2>/dev/null | cut -d: -f1 || true
|
grep "==${username}$" /etc/userdatadomains 2>/dev/null | cut -d: -f1 || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ get_cpanel_user_databases() {
|
|||||||
local username="$1"
|
local username="$1"
|
||||||
|
|
||||||
# cPanel databases typically follow pattern: username_dbname
|
# cPanel databases typically follow pattern: username_dbname
|
||||||
mysql -e "SHOW DATABASES" 2>/dev/null | grep -F "${username}_" 2>/dev/null || true
|
mysql -e "SHOW DATABASES" 2>/dev/null | grep "^${username}_" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
get_plesk_user_databases() {
|
get_plesk_user_databases() {
|
||||||
@@ -398,7 +398,7 @@ select_user_interactive() {
|
|||||||
local users=($(list_all_users))
|
local users=($(list_all_users))
|
||||||
local total_users=${#users[@]}
|
local total_users=${#users[@]}
|
||||||
|
|
||||||
if [ $total_users -eq 0 ]; then
|
if [ "${total_users:-0}" -eq 0 ]; then
|
||||||
print_error "No users found" >&2
|
print_error "No users found" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -427,7 +427,7 @@ select_user_interactive() {
|
|||||||
echo "-------------------------------------------------------------------------------"
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
# Auto-show list if 10 or fewer users
|
# Auto-show list if 10 or fewer users
|
||||||
if [ $total_users -le 10 ]; then
|
if [ "${total_users:-0}" -le 10 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
for user in "${users[@]}"; do
|
for user in "${users[@]}"; do
|
||||||
echo -e " ${GREEN}$user${NC} - ${user_primary_domain[$user]} (${user_domain_count[$user]} domains)"
|
echo -e " ${GREEN}$user${NC} - ${user_primary_domain[$user]} (${user_domain_count[$user]} domains)"
|
||||||
@@ -438,7 +438,7 @@ select_user_interactive() {
|
|||||||
echo "-------------------------------------------------------------------------------"
|
echo "-------------------------------------------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
if [ $total_users -gt 10 ]; then
|
if [ "${total_users:-0}" -gt 10 ]; then
|
||||||
echo " L - List all $total_users users"
|
echo " L - List all $total_users users"
|
||||||
fi
|
fi
|
||||||
echo " S [text] - Search/filter users (e.g., 's pick' or 's example.com')"
|
echo " S [text] - Search/filter users (e.g., 's pick' or 's example.com')"
|
||||||
@@ -565,7 +565,7 @@ select_user_interactive() {
|
|||||||
|
|
||||||
# Not exact match
|
# Not exact match
|
||||||
print_error "User '$choice' not found" >&2
|
print_error "User '$choice' not found" >&2
|
||||||
if [ $total_users -gt 10 ]; then
|
if [ "${total_users:-0}" -gt 10 ]; then
|
||||||
echo " Tip: Type 'L' to list all users" >&2
|
echo " Tip: Type 'L' to list all users" >&2
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
@@ -580,14 +580,14 @@ select_user_interactive() {
|
|||||||
get_user_processes() {
|
get_user_processes() {
|
||||||
local username="$1"
|
local username="$1"
|
||||||
|
|
||||||
ps aux | grep -F "$username" 2>/dev/null | grep -v grep
|
ps aux | grep "$username" 2>/dev/null | grep -v grep
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user_top_processes() {
|
get_user_top_processes() {
|
||||||
local username="$1"
|
local username="$1"
|
||||||
local limit="${2:-10}"
|
local limit="${2:-10}"
|
||||||
|
|
||||||
ps aux | grep -F "$username" 2>/dev/null | grep -v grep | sort -k3 -rn | head -n "$limit"
|
ps aux | grep "$username" 2>/dev/null | grep -v grep | sort -k3 -rn | head -n "$limit"
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user