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

Function _issue_trusted_device

Scripts/ButSystem.py:1422–1441  ·  view source on GitHub ↗

Create or rotate a trusted-device token for (username, fp). Returns raw token.

(username: str, fp: str, approved_by: Optional[str]=None)

Source from the content-addressed store, hash-verified

1420def _handle_unexpected_web_error(error):
1421 """Log full web exceptions to the file and the Termux error monitor."""
1422 if isinstance(error, HTTPException):
1423 return error
1424 try:
1425 request_id = getattr(g, "request_id", "-")
1426 method = getattr(request, "method", "?")
1427 path = getattr(request, "path", "?")
1428 log.error(
1429 "Unhandled web exception request_id=%s method=%s path=%s error=%s",
1430 request_id, method, path, error,
1431 exc_info=(type(error), error, error.__traceback__),
1432 )
1433 except Exception:
1434 traceback.print_exc()
1435 return Response(
1436 "Internal Server Error\n\nThe complete error was printed in Termux below the generated links and saved to the ButSystem log.",
1437 status=500,
1438 mimetype="text/plain",
1439 )
1440# Respect X-Forwarded-* headers when running behind Cloudflared / reverse proxies.
1441# This helps correct URL generation (scheme/host) and client IP for security logs.
1442# Only trust X-Forwarded-* when the direct peer is loopback (cloudflared/tor connect locally).
1443class _LoopbackProxyFix:
1444 def __init__(self, wsgi_app):

Callers 2

device_access_pollFunction · 0.70
_complete_login_sessionFunction · 0.70

Calls 3

_sha256_hexFunction · 0.70
db_connectFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected