63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
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}")
|