import glob
import re

rows = {}
for fn in glob.glob("/root/recon/crowd_*.properties") + glob.glob("/root/recon/atl_deep/*crowd.properties"):
    try:
        txt = open(fn, encoding="utf-8", errors="replace").read()
    except Exception:
        continue
    kv = {}
    for line in txt.splitlines():
        line = line.strip()
        if not line or line.startswith("#") or "=" not in line:
            continue
        k, v = line.split("=", 1)
        kv[k.strip()] = v.strip()
    url = kv.get("crowd.server.url", "")
    app = kv.get("application.name", "")
    pw = kv.get("application.password", "")
    key = (url, app, pw)
    rows.setdefault(key, []).append(fn.split("/")[-1])

print("distinct crowd configs:", len(rows))
for (url, app, pw), files in sorted(rows.items(), key=lambda x: -len(x[1])):
    print("%-60s app=%-22s pw=%-12s hosts=%d %s" % (url[:60], app[:22], pw[:12], len(files), files[0][:50]))
