#!/usr/bin/env python3 import json import sys import tarfile path = sys.argv[1] with tarfile.open(path) as t: install = t.extractfile("./device-install.sh").read().decode() cfg = json.loads(t.extractfile("./config/config.json").read().decode()) print("reset_support:", "BUTTONTASK_RESET_CONFIG" in install) print("password:", cfg.get("settings", {}).get("password")) print("buttons:", len(cfg.get("buttons", []))) for b in cfg.get("buttons", []): print(" -", b.get("id"), b.get("label"), (b.get("action") or {}).get("url", "")[:50])