MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / load_or_create_device_id

Function load_or_create_device_id

Scripts/ButSystem.py:372–392  ·  view source on GitHub ↗

Stable per-device id stored in persistent Homework folder.

()

Source from the content-addressed store, hash-verified

370 shutil.copytree(src, dst, dirs_exist_ok=True)
371 else:
372 shutil.copy2(src, dst)
373 except Exception as e:
374 try:
375 print(f"[ButSystem] Legacy migration skipped: {e}")
376 except Exception:
377 pass
378
379_migrate_legacy_data()
380
381for d in (BASE_DIR, DATA_DIR, STORAGE_DIR, KEYS_DIR, LOG_DIR, TOR_DIR, ATT_DIR, PFP_DIR, DM_FILES_DIR, DISC_FILES_DIR, FACE_DETECTOR_DIR):
382 os.makedirs(d, exist_ok=True)
383
384# ---------------------------
385# Device binding (protect admin from remote/conflicts)
386# ---------------------------
387
388DEVICE_ID_PATH = os.path.join(KEYS_DIR, "device.id")
389
390def load_or_create_device_id() -> str:
391 """Stable per-device id stored in persistent Homework folder."""
392 try:
393 if os.path.exists(DEVICE_ID_PATH):
394 raw = open(DEVICE_ID_PATH, "r", encoding="utf-8").read().strip()
395 if raw:

Callers 1

ButSystem.pyFile · 0.70

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected