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

Function profiler_update

Scripts/ButSystem.py:16298–16338  ·  view source on GitHub ↗

profiler_update. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: eid: Parameter. Returns: Varies.

(eid: int)

Source from the content-addressed store, hash-verified

16296 "bounty_price_display": (_fmt_bounty_price(r["bounty_price"]) if ("bounty_price" in r.keys() and r["bounty_price"] is not None) else None),
16297 "created_at": r["created_at"],
16298 "updated_at": r["updated_at"],
16299 }
16300 atts = []
16301 for a in att:
16302 atts.append({
16303 "id": a["id"],
16304 "filename": dtxt(a["filename_enc"], "file"),
16305 "mime": dtxt(a["mime_enc"], "application/octet-stream"),
16306 "created_at": a["created_at"],
16307 "stored_path": a["stored_path"],
16308 })
16309 return entry, atts
16310
16311def profiler_store_attachment(eid: int, file_storage):
16312 """Store a profiler attachment (plaintext on disk).
16313
16314 Profiler *text fields* remain encrypted in the database; only binary attachments
16315 are stored without encryption (per your request).
16316 """
16317 if not file_storage or not getattr(file_storage, "filename", ""):
16318 return
16319
16320 filename, mime = _validate_report_upload(file_storage)
16321
16322 conn = db_connect()
16323 cur = conn.cursor()
16324 cur.execute("""
16325 INSERT INTO profiler_attachments(entry_id, filename_enc, mime_enc, stored_path, created_at)
16326 VALUES(?,?,?,?,?)
16327 """, (eid, aesgcm_encrypt_text(filename), aesgcm_encrypt_text(mime), "PENDING", now_z()))
16328 aid = cur.lastrowid
16329
16330 stored_path = os.path.join(ATT_DIR, f"prof_att_{aid}.bin")
16331 try:
16332 size = _save_plain_upload(file_storage, stored_path)
16333 # Keep profiler attachments reasonably bounded to avoid DoS.
16334 if int(size) > CHAT_MAX_BYTES:
16335 try:
16336 os.remove(stored_path)
16337 except Exception:
16338 pass
16339 conn.execute("DELETE FROM profiler_attachments WHERE id=?", (aid,))
16340 conn.commit()
16341 conn.close()

Callers

nothing calls this directly

Calls 7

current_userFunction · 0.70
db_connectFunction · 0.70
aesgcm_encrypt_textFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected