import couchdb from urllib.parse import quote # Configuration user = "admin" password = "DonCucarach0!?" ip_address = "100.100.112.48" port = "5984" db_name = "obsidiandb" # Safe URL Construction safe_password = quote(password, safe="") url = f"http://{user}:{safe_password}@{ip_address}:{port}/" print(f"Connecting to {db_name}...") try: server = couchdb.Server(url) db = server[db_name] # Get all docs, skipping design docs # map_fun not needed if we just iterate db count = 0 encrypted_count = 0 print(f"\n--- šŸ“š Dumping Notes from {db_name} ---\n") for doc_id in db: if doc_id.startswith("_design"): continue doc = db[doc_id] # Try to find content content = doc.get("data") or doc.get("content") print(f"šŸ“„ [{count+1}] {doc_id}") if content: content_str = str(content) # Check for encryption markers if content_str.startswith("%=") or content_str.startswith("%") or doc.get("e_"): print(" šŸ”’ [ENCRYPTED DATA DETECTED]") encrypted_count += 1 else: # Show preview preview = content_str[:200].replace("\n", " ↵ ") print(f" šŸ“ Content: {preview}...") else: print(" āŒ [No content field found]") print("-" * 40) count += 1 print(f"\nāœ… Scan Complete.") print(f"Total Notes: {count}") print(f"Encrypted Notes: {encrypted_count}") except Exception as e: print(f"āŒ Error: {e}")