import json, os, glob, re low = os.path.expandvars(r"%LOCALAPPDATA%\ToDesk") hits = [] for p in glob.glob(os.path.join(low, "*.json")): try: s = open(p, encoding="utf-8", errors="ignore").read() except Exception: continue for m in re.finditer(r'"(\w*(?:device|Device)\w*id\w*)"\s*:\s*"(\d{8,12})"', s): hits.append((os.path.basename(p), m.group(1), m.group(2))) for h in hits[:8]: print(h) print("hits:", len(hits))