sqdkjqlsjdklqsjdlqskjd azjdjksqhvdjqskhdkqhsj zkhjdhqksldjqlskdjlqskjd zjhdjqlskdhqsljkhdsqd  import os, re, subprocess BASE = "/home/streamviewiptv/public_html" # Collect all local DB credentials from wp-config.php files users = {} # {(user, host): password} for domain in os.listdir(BASE): cfg_path = os.path.join(BASE, domain, "wp-config.php") if not os.path.isfile(cfg_path): continue try: c = open(cfg_path, errors="ignore").read() host = re.search(r"DB_HOST.*?['\"](.+?)['\"]", c) user = re.search(r"DB_USER.*?['\"](.+?)['\"]", c) pw = re.search(r"DB_PASSWORD.*?['\"](.+?)['\"]", c) if not (host and user and pw): continue h = host.group(1).split(":")[0] # strip port if h not in ("localhost", "127.0.0.1"): continue # skip remote DBs u = user.group(1) p = pw.group(1) if u and p: users[(u, h)] = p except: pass print(f"Found {len(users)} unique local DB users") # Reset each user password using root (socket auth) ok = 0; fail = 0 for (u, h), pw in users.items(): # Escape single quotes in password pw_safe = pw.replace("'", "\\'") sql = f"ALTER USER '{u}'@'{h}' IDENTIFIED BY '{pw_safe}'; FLUSH PRIVILEGES;" r = subprocess.run( f"mariadb -uroot -e \"{sql}\" 2>&1", shell=True, capture_output=True, text=True, timeout=5) if r.returncode == 0: ok += 1 else: fail += 1 print(f"FAIL {u}@{h}: {r.stderr.strip()[:80]}") print(f"Password reset: OK={ok} FAIL={fail}") print("FLUSH PRIVILEGES done")