✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server.blackpussy.asia ​🇻​♯➤ 5.14.0-611.20.1.el9_7.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 163.245.207.76 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.243
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗞 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ mail,mb_send_mail
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /tmp//wpmm-firewall-dedi3.candidate
#!/usr/bin/env python3
import argparse
import fcntl
import ipaddress
import json
import os
import pathlib
import subprocess
import tempfile


STATE_DIR = pathlib.Path("/etc/wpmm-firewall")
DENY_FILE = STATE_DIR / "permanent.deny"
LOCK_FILE = STATE_DIR / ".lock"
WATCHDOG_CONFIG = pathlib.Path("/etc/wpmm-watchdog.json")
TABLE = "wpmm_guard"


def run(args, input_text=None, check=True):
    result = subprocess.run(args, input=input_text, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    if check and result.returncode:
        raise RuntimeError((result.stderr or result.stdout or "nftables 操作失敗").strip())
    return result


def canonical(value):
    text = str(value or "").strip()
    network = ipaddress.ip_network(text, strict=True)
    if network.version != 4 or not network.network_address.is_global:
        raise ValueError("僅允許公開 IPv4 或 IPv4 網段")
    if network.prefixlen not in (24, 32):
        raise ValueError("只允許單一 IPv4 或 /24 C-class 網段")
    return str(network.network_address) if network.prefixlen == 32 else str(network)


def protected_ips():
    values = {"127.0.0.1", "::1"}
    try:
        data = json.loads(WATCHDOG_CONFIG.read_text(encoding="utf-8"))
        values.update(str(value).strip() for value in data.get("connection_whitelist_ips", []) if str(value).strip())
    except Exception:
        pass
    return values


def reject_protected(target):
    network = ipaddress.ip_network(target if "/" in target else target + "/32", strict=False)
    conflicts = []
    for value in protected_ips():
        try:
            address = ipaddress.ip_address(value)
            if address.version == 4 and address in network:
                conflicts.append(str(address))
        except ValueError:
            continue
    if conflicts:
        raise ValueError("此範圍包含白名單 IP({}),禁止封鎖".format("、".join(sorted(conflicts))))


def ensure_structure():
    if run(["nft", "list", "table", "inet", TABLE], check=False).returncode != 0:
        rules = """
add table inet wpmm_guard
add set inet wpmm_guard blocked_ipv4 { type ipv4_addr; flags interval; }
add set inet wpmm_guard temporary_ipv4 { type ipv4_addr; flags interval,timeout; }
add chain inet wpmm_guard input { type filter hook input priority -10; policy accept; }
add rule inet wpmm_guard input tcp dport 111 counter drop comment "wp-MM-System block public rpcbind TCP"
add rule inet wpmm_guard input udp dport 111 counter drop comment "wp-MM-System block public rpcbind UDP"
add rule inet wpmm_guard input ip saddr @blocked_ipv4 counter drop comment "wp-MM-System permanent block"
add rule inet wpmm_guard input ip saddr @temporary_ipv4 counter drop comment "wp-MM-System temporary block"
"""
        run(["nft", "-f", "-"], input_text=rules)
        return
    checks = (
        (["nft", "list", "set", "inet", TABLE, "blocked_ipv4"],
         "add set inet wpmm_guard blocked_ipv4 { type ipv4_addr; flags interval; }\n"),
        (["nft", "list", "set", "inet", TABLE, "temporary_ipv4"],
         "add set inet wpmm_guard temporary_ipv4 { type ipv4_addr; flags interval,timeout; }\n"),
        (["nft", "list", "chain", "inet", TABLE, "input"],
         "add chain inet wpmm_guard input { type filter hook input priority -10; policy accept; }\n"),
    )
    for command, rule in checks:
        if run(command, check=False).returncode != 0:
            run(["nft", "-f", "-"], input_text=rule)
    chain = run(["nft", "list", "chain", "inet", TABLE, "input"]).stdout
    additions = []
    if "tcp dport 111" not in chain:
        additions.append('add rule inet wpmm_guard input tcp dport 111 counter drop comment "wp-MM-System block public rpcbind TCP"')
    if "udp dport 111" not in chain:
        additions.append('add rule inet wpmm_guard input udp dport 111 counter drop comment "wp-MM-System block public rpcbind UDP"')
    if "@blocked_ipv4" not in chain:
        additions.append('add rule inet wpmm_guard input ip saddr @blocked_ipv4 counter drop comment "wp-MM-System permanent block"')
    if "@temporary_ipv4" not in chain:
        additions.append('add rule inet wpmm_guard input ip saddr @temporary_ipv4 counter drop comment "wp-MM-System temporary block"')
    if additions:
        run(["nft", "-f", "-"], input_text="\n".join(additions) + "\n")


def load_permanent():
    if not DENY_FILE.exists():
        return []
    result = []
    for line in DENY_FILE.read_text(encoding="utf-8").splitlines():
        line = line.strip()
        if not line or line.startswith("#"):
            continue
        try:
            value = canonical(line)
            reject_protected(value)
            if value not in result:
                result.append(value)
        except (ValueError, RuntimeError):
            continue
    return result


def apply_permanent(values):
    ensure_structure()
    commands = ["flush set inet wpmm_guard blocked_ipv4"]
    if values:
        commands.append("add element inet wpmm_guard blocked_ipv4 { " + ", ".join(values) + " }")
    run(["nft", "-f", "-"], input_text="\n".join(commands) + "\n")


def save_permanent(values):
    STATE_DIR.mkdir(mode=0o700, parents=True, exist_ok=True)
    fd, name = tempfile.mkstemp(prefix="permanent.", dir=str(STATE_DIR), text=True)
    try:
        with os.fdopen(fd, "w", encoding="utf-8") as handle:
            handle.write("# Managed by wp-MM-System\n")
            for value in values:
                handle.write(value + "\n")
            handle.flush()
            os.fsync(handle.fileno())
        os.chmod(name, 0o600)
        os.replace(name, DENY_FILE)
    finally:
        if os.path.exists(name):
            os.unlink(name)


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("action", choices=("restore", "add", "temporary", "status"))
    parser.add_argument("target", nargs="?")
    parser.add_argument("duration", nargs="?", type=int, default=21600)
    args = parser.parse_args()
    STATE_DIR.mkdir(mode=0o700, parents=True, exist_ok=True)
    with LOCK_FILE.open("a+") as lock:
        os.chmod(LOCK_FILE, 0o600)
        fcntl.flock(lock, fcntl.LOCK_EX)
        if args.action == "status":
            ensure_structure()
            print(json.dumps({"backend":"nftables","permanent":load_permanent()}, ensure_ascii=False))
            return
        if args.action == "restore":
            values = load_permanent()
            apply_permanent(values)
            print(json.dumps({"status":"success","restored":len(values)}, ensure_ascii=False))
            return
        target = canonical(args.target)
        reject_protected(target)
        ensure_structure()
        if args.action == "temporary":
            if args.duration not in (3600, 21600, 86400):
                raise ValueError("不支援的暫時封鎖時間")
            run(["nft", "add", "element", "inet", TABLE, "temporary_ipv4",
                 "{", target, "timeout", str(args.duration) + "s", "}"])
            print(json.dumps({"status":"success","target":target,"mode":"temporary","duration":args.duration}, ensure_ascii=False))
            return
        values = load_permanent()
        if target not in values:
            updated = values + [target]
            apply_permanent(updated)
            try:
                save_permanent(updated)
            except Exception:
                apply_permanent(values)
                raise
            values = updated
        print(json.dumps({"status":"success","target":target,"mode":"permanent","total":len(values)}, ensure_ascii=False))


if __name__ == "__main__":
    try:
        main()
    except (ValueError, RuntimeError) as exc:
        raise SystemExit(str(exc))

Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]

Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
12 Sep 2026 2.17 PM
root / root
0555
lost+found
--
17 Jan 2026 3.15 PM
root / root
0700
lshttpd
--
12 Sep 2026 9.23 AM
nobody / nobody
0751
systemd-private-ca77e09721aa4fcf9ffff7e345728903-chronyd.service-iRpFK7
--
20 Aug 2026 6.54 PM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-dbus-broker.service-mWwJQf
--
20 Aug 2026 6.54 PM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-ea-php82-php-fpm.service-q7F1D3
--
11 Sep 2026 3.28 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-ea-php82-php-fpm.service-ybHSbN
--
11 Sep 2026 3.28 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-irqbalance.service-Ciqla8
--
10 Sep 2026 4.57 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-irqbalance.service-KqdlIp
--
10 Sep 2026 4.57 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-kdump.service-B6YZbO
--
20 Aug 2026 6.55 PM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-kdump.service-KCT1LN
--
20 Aug 2026 6.55 PM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-pdns.service-qNCpXY
--
26 Aug 2026 4.57 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-pdns.service-xO0yHj
--
26 Aug 2026 4.57 AM
root / root
0700
systemd-private-ca77e09721aa4fcf9ffff7e345728903-systemd-logind.service-PDQ6FF
--
20 Aug 2026 6.54 PM
root / root
0700
107336.LOGD___WAITING_FOR_CHILD_TO_PROCESS_LOGS__.qbQKqABD.tmp
0 KB
12 Sep 2026 3.18 PM
blackpussy03 / blackpussy03
0600
diag-body
1.222 KB
11 Sep 2026 3.30 AM
root / root
0644
diagnose_setup_403_target.py
1.81 KB
10 Sep 2026 4.27 AM
root / root
0644
find_publisher_ip.py
2.185 KB
9 Sep 2026 11.00 AM
root / root
0700
install_auto_bclass_block_target.sh
3.461 KB
10 Sep 2026 4.28 AM
root / root
0644
install_dedi3_rpcbind_protection.sh
1.576 KB
10 Sep 2026 1.32 AM
root / root
0644
install_port111_guard_target.sh
2.617 KB
10 Sep 2026 4.27 AM
root / root
0644
install_wp_request_htaccess_protection.py
3.226 KB
10 Sep 2026 4.55 AM
root / root
0644
other-body
0 KB
11 Sep 2026 3.17 AM
root / root
0644
possibility-after-restart
1.222 KB
11 Sep 2026 3.22 AM
root / root
0644
possibility-final-_
7.181 KB
11 Sep 2026 3.29 AM
root / root
0644
possibility-final-_index_php
1.222 KB
11 Sep 2026 3.29 AM
root / root
0644
possibility-final-_wp-login_php
1.222 KB
11 Sep 2026 3.29 AM
root / root
0644
possibility-home-after-restart
7.181 KB
11 Sep 2026 3.22 AM
root / root
0644
possibility-local-body
5.937 KB
11 Sep 2026 3.15 AM
root / root
0644
possibility-permission-fix
7.233 KB
11 Sep 2026 3.35 AM
root / root
0644
possibility-php-body
1.222 KB
11 Sep 2026 3.16 AM
root / root
0644
possibility-title
1.222 KB
11 Sep 2026 3.32 AM
root / root
0644
possibility-verify-_
7.181 KB
11 Sep 2026 3.29 AM
root / root
0644
possibility-verify-_index_php
1.222 KB
11 Sep 2026 3.29 AM
root / root
0644
possibility-verify-_wp-login_php
1.222 KB
11 Sep 2026 3.29 AM
root / root
0644
validate_basic_capabilities_target.sh
2.356 KB
10 Sep 2026 4.54 AM
root / root
0644
verify_auto_bclass_safety.sh
1.676 KB
10 Sep 2026 5.00 AM
root / root
0644
verify_request_protection_target.py
2.292 KB
10 Sep 2026 4.56 AM
root / root
0644
verify_watchdog_extended_target.sh
1.146 KB
10 Sep 2026 4.41 AM
root / root
0644
wpmm-apache-configtest.out
0.01 KB
9 Sep 2026 11.29 PM
root / root
0644
wpmm-curl-body
10.178 KB
10 Sep 2026 4.27 AM
root / root
0644
wpmm-firewall-dedi3.candidate
7.54 KB
10 Sep 2026 1.32 AM
root / root
0644
wpmm-httpd-reload.out
30.742 KB
9 Sep 2026 11.29 PM
root / root
0644
wpmm-port111-guard.candidate
0.668 KB
10 Sep 2026 4.27 AM
root / root
0644
wpmm-port111-guard.service.candidate
0.249 KB
10 Sep 2026 4.27 AM
root / root
0644
wpmm-preflight.stderr
0 KB
10 Sep 2026 4.54 AM
root / root
0644
wpmm-preflight.stdout
44.845 KB
10 Sep 2026 4.54 AM
root / root
0644
wpmm-v3-report.json
17.37 KB
9 Sep 2026 6.09 PM
root / root
0644
wpmm-watchdog-dedi3.json
0.119 KB
9 Sep 2026 6.55 AM
root / root
0644
wpmm-watchdog-monitoring
18.875 KB
9 Sep 2026 8.35 AM
root / root
0644
wpmm-watchdog-monitoring-v2
18.954 KB
9 Sep 2026 8.55 AM
root / root
0644
wpmm-watchdog-monitoring-v3
27.3 KB
9 Sep 2026 6.09 PM
root / root
0644
wpmm-watchdog.autoblock
39.53 KB
10 Sep 2026 4.28 AM
root / root
0644
wpmm-watchdog.py36-candidate
11.718 KB
9 Sep 2026 6.55 AM
root / root
0644
wpmm-watchdog.service.candidate
0.222 KB
9 Sep 2026 6.55 AM
root / root
0644
wpmm-watchdog.sucuri-candidate
12.228 KB
9 Sep 2026 6.59 AM
root / root
0644
wpmm-watchdog.timer.autoblock
0.185 KB
10 Sep 2026 4.28 AM
root / root
0644
wpmm-watchdog.timer.candidate
0.191 KB
9 Sep 2026 6.55 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF