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

Function db_connect

Scripts/ButSystem.py:650–663  ·  view source on GitHub ↗

db_connect. Database helper for connecting to or initializing the SQLite database. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

648
649This docstring was expanded to make future maintenance easier.
650
651Args:
652 src_path: Parameter.
653
654Returns:
655 Varies.
656"""
657 with open(src_path, "rb") as f:
658 hdr = f.read(HDR_LEN)
659 if len(hdr) != HDR_LEN or hdr[:len(MAGIC)] != MAGIC:
660 raise ValueError("Not an encrypted ButSystem blob.")
661 nonce = hdr[len(MAGIC):len(MAGIC)+NONCE_LEN]
662 tag = hdr[len(MAGIC)+NONCE_LEN:HDR_LEN]
663
664 cipher = Cipher(algorithms.AES(MASTER_KEY), modes.GCM(nonce, tag))
665 decryptor = cipher.decryptor()
666

Callers 15

db_initFunction · 0.70
get_user_prefsFunction · 0.70
set_user_prefsFunction · 0.70
dm_unread_countsFunction · 0.70
user_cardsFunction · 0.70
_trusted_device_lookupFunction · 0.70
_trusted_device_touchFunction · 0.70
_issue_trusted_deviceFunction · 0.70
_admins_listFunction · 0.70
_chat_lock_existsFunction · 0.70
_chat_lock_setFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected