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

Function _client_ip

Scripts/ButSystem.py:3564–3585  ·  view source on GitHub ↗

Real client IP with anti-spoofing. We only trust forwarded headers when the request comes from loopback (i.e., a local reverse-proxy like cloudflared/tor on the SAME device).

()

Source from the content-addressed store, hash-verified

3562 if row and row["pic_path"] and os.path.exists(row["pic_path"]):
3563 try:
3564 os.remove(row["pic_path"])
3565 except Exception:
3566 pass
3567 conn.execute("UPDATE profiles SET pic_path=NULL, pic_mime=NULL, updated_at=? WHERE username=?",
3568 (now_z(), username))
3569 conn.commit()
3570 conn.close()
3571
3572def user_root(username: str) -> str:
3573 """user_root.
3574
3575Internal helper function.
3576
3577This docstring was added automatically to improve maintainability.
3578
3579Args:
3580 username: Parameter.
3581
3582Returns:
3583 Varies.
3584"""
3585 p = os.path.join(STORAGE_DIR, username)
3586 os.makedirs(p, exist_ok=True)
3587 return p
3588

Callers 6

_is_local_admin_requestFunction · 0.70
loginFunction · 0.70
signupFunction · 0.70
device_accessFunction · 0.70
two_factorFunction · 0.70
recoverFunction · 0.70

Calls 1

_is_loopbackFunction · 0.70

Tested by

no test coverage detected