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"""
649 with open(src_path, "rb") as f:
650 hdr = f.read(HDR_LEN)
651 if len(hdr) != HDR_LEN or hdr[:len(MAGIC)] != MAGIC:
652 raise ValueError("Not an encrypted ButSystem blob.")
653 nonce = hdr[len(MAGIC):len(MAGIC)+NONCE_LEN]
654 tag = hdr[len(MAGIC)+NONCE_LEN:HDR_LEN]
655
656 cipher = Cipher(algorithms.AES(MASTER_KEY), modes.GCM(nonce, tag))
657 decryptor = cipher.decryptor()
658
659 while True:
660 chunk = f.read(CHUNK)
661 if not chunk:
662 break
663 out = decryptor.update(chunk)
664 if out:
665 yield out
666 out = decryptor.finalize()

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