Auth Capture Proxy

1.3.7 · active · verified Tue Apr 14

Auth Capture Proxy (authcaptureproxy) is a Python library and tool designed to create a proxy that captures authentication information from web pages. This is particularly useful for scenarios requiring the capture of OAuth login details without direct access to a third-party OAuth provider. The current version is 1.3.7, and the project maintains an active release cadence with frequent bug fixes and minor improvements.

Warnings

Install

Imports

Quickstart

This example demonstrates how to set up and run the `AuthCaptureProxy` programmatically using `asyncio`. It starts a proxy server on port 5000, forwarding requests to `httpbin.org`, and will capture authentication-related information. The proxy runs until manually interrupted.

import asyncio
from auth_capture_proxy.proxy import AuthCaptureProxy

async def run_proxy_example():
    # Instantiate the proxy to listen on port 5000
    # and forward requests to a target URL (e.g., a login page).
    # authcaptureproxy will attempt to capture authentication details
    # from the traffic passing through it.
    proxy = AuthCaptureProxy(
        listen_port=5000,
        base_url="https://httpbin.org", # Use a real target URL for actual use
        verbose=True
    )

    print("Starting Auth Capture Proxy on http://127.0.0.1:5000")
    print("Forwarding traffic to https://httpbin.org")
    print("Visit http://127.00.1:5000 in your browser to test.")
    print("Press Ctrl+C to stop.")

    try:
        # Start the proxy server. This is an async operation.
        await proxy.start()
        # Keep the proxy running until interrupted.
        # In a real application, integrate this into your event loop.
        await asyncio.Event().wait()
    except asyncio.CancelledError:
        pass # Handle graceful shutdown
    finally:
        await proxy.stop()
        print("Auth Capture Proxy stopped.")

if __name__ == "__main__":
    try:
        asyncio.run(run_proxy_example())
    except KeyboardInterrupt:
        print("\nExiting Auth Capture Proxy example.")

view raw JSON →