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

Function profiler_combine

Scripts/ButSystem.py:16061–16164  ·  view source on GitHub ↗

profiler_combine. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

16059
16060Internal helper function.
16061
16062This docstring was added automatically to improve maintainability.
16063
16064Args:
16065 optional_enc: Parameter.
16066
16067Returns:
16068 Varies.
16069"""
16070 if not optional_enc:
16071 return {}
16072 try:
16073 raw = aesgcm_decrypt_text(optional_enc)
16074 data = json.loads(raw) if raw else {}
16075 if isinstance(data, dict):
16076 # keep only known keys, but don't break older/newer
16077 return {k: str(v) for k, v in data.items() if v is not None}
16078 return {}
16079 except Exception:
16080 return {}
16081
16082# ---------------------------
16083# Auto-sync: My Profile -> Profiler (per-user, encrypted)
16084# ---------------------------
16085
16086_AUTOSYNC_TYPE = "user_profile"
16087
16088def _split_name_from_nick(nick: str, fallback_last: str) -> Tuple[str, str]:
16089 """Split a nickname into first/last. Ensures last is non-empty."""
16090 nick = (nick or "").strip()
16091 if not nick:
16092 return fallback_last, fallback_last
16093 parts = [p for p in re.split(r"\s+", nick) if p]
16094 if not parts:
16095 return fallback_last, fallback_last
16096 first = parts[0].strip()
16097 last = " ".join(parts[1:]).strip()
16098 if not last:
16099 last = fallback_last
16100 return first[:120], last[:120]
16101
16102def _clean_num(s: str) -> str:
16103 s = (s or "").strip()
16104 if not s:
16105 return ""
16106 # Keep digits and a dot/comma (best-effort).
16107 s2 = re.sub(r"[^0-9\.,]", "", s)
16108 return s2.strip()
16109
16110def profiler_sync_from_user_profile(username: str):
16111 """Ensure a user's My Profile is mirrored into their Profiler list.
16112
16113 This creates (or updates) one special encrypted Profiler entry owned by the same user.
16114 No username is excluded from the profile -> profiler sync.
16115 """
16116 if not username:
16117 return
16118 prof = get_profile(username) or {}

Callers

nothing calls this directly

Calls 10

current_userFunction · 0.70
downloads_dirFunction · 0.70
db_connectFunction · 0.70
aesgcm_decrypt_textFunction · 0.70
now_zFunction · 0.70
aesgcm_encrypt_textFunction · 0.70
guess_mimeFunction · 0.70
aesgcm_encrypt_streamFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected