Files
Control_Panel/server/scratch/find_db_settings.py
T
2026-07-15 18:37:19 +09:00

22 lines
1.1 KiB
Python

import os
def search_files(directory):
for root, dirs, files in os.walk(directory):
if "venv" in root or "__pycache__" in root or ".git" in root or ".gemini" in root:
continue
for file in files:
if file.endswith((".py", ".json", ".ini", ".conf", ".cfg", ".yml", ".yaml")):
path = os.path.join(root, file)
try:
with open(path, "r", encoding="utf-8", errors="ignore") as f:
content = f.read()
if "mysql" in content.lower() or "db_host" in content.lower() or "host =" in content.lower():
print(f"Found in {path}:")
for line in content.splitlines():
if any(x in line.lower() for x in ["host", "port", "user", "password", "db"]):
print(f" {line.strip()}")
except Exception as e:
pass
search_files("D:\\04_CTNT\\01_카본절단MC(CC)\\CC0324_양산_V0\\02_전장제어\\PLC_Communication_MQTT\\step5_modify")