Skip to main content

No project description provided

Project description

Slippers is a lightweight, zero-dependency SOCKS5 proxy that runs locally and transparently forwards traffic to an upstream SOCKS5 proxy requiring authentication. It allows clients that don't support SOCKS5 authentication (like some browsers) to use an authenticated proxy indirectly.

Installation

pip install slippers-proxy

CLI Usage

python -m slippers "socks5://username:password@my-socks-server.net:1080"

By default, slippers listens on localhost:1080

You can now use your local unauthenticated SOCKS5 endpoint

curl --socks5-hostname "socks5://127.0.0.1:1080" https://ifconfig.io/country_code
US
python -m slippers "socks5://username:password@my-socks-server.net:1080"
16:04:07 [INFO] Listening on localhost:1080 (4)
16:04:09 [INFO] Tunnel from 127.0.0.1:64633 (7) to my-socks-server.net:1080 (8) established
16:04:10 [INFO] Tunnel from 127.0.0.1:64633 (7) to my-socks-server.net:1080 (8) closed

Programmatic Usage

import os
import slippers
from playwright.sync_api import sync_playwright

username = os.getenv("SOCKS_USERNAME")
password = os.getenv("SOCKS_PASSWORD")


def main():
    with (
        sync_playwright() as p,
        slippers.Proxy(
            f"socks5://{username}:{password}@my-socks-server.net:1080"
        ) as proxy,
    ):
        browser = p.chromium.launch(
            headless=True,
            proxy={"server": proxy.url(dns=True)},  # point to slippers local server
        )
        page = browser.new_page()
        page.goto("https://ifconfig.io/country_code", wait_until="domcontentloaded")
        print(page.text_content("body").strip())
        browser.close()


if __name__ == "__main__":
    main()

API

class slippers.Proxy(proxy: str, host: str = "localhost", port: int = 1080)

Create a handler for a local, unauthenticated SOCKS5 server which forwards traffic to an upstream authenticated SOCKS5 proxy.

    start() -> None

    Start the local proxy in a background process. Once started it can start accepting connections.

    stop() -> None

    Stop the background proxy process (if running).

    url(dns: bool = False) -> str

    Return the SOCKS5 URL string. If dns is True then the scheme will be socks5h which clients use to connect with DNS resolution from the upstream SOCKS5 server.

    __enter__() -> Self

    Start the proxy and return the Proxy object.

    __exit__(exc_type, exc_value, traceback) -> None

    Stop the proxy when exiting the with block.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slippers_proxy-0.3.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slippers_proxy-0.3.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file slippers_proxy-0.3.0.tar.gz.

File metadata

  • Download URL: slippers_proxy-0.3.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.8 Darwin/24.5.0

File hashes

Hashes for slippers_proxy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1fe7fdcd24ed31b70af833869e7ed91d354e3cc5dbff3ce234cba2a402d33a8c
MD5 b29360b4f0aa56968eb355dc3dd7b8be
BLAKE2b-256 0e1fefd560dcfeef6def8cd47392a66bf7f6e9a0d76efe5f164fe638cd7228aa

See more details on using hashes here.

File details

Details for the file slippers_proxy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: slippers_proxy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.8 Darwin/24.5.0

File hashes

Hashes for slippers_proxy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8301a8a2250ef0b6a4477b24334aeca86913453f1f8c543f14c2cc44ed5e85
MD5 b4519e72890aefcc3bf4965ade10db38
BLAKE2b-256 a78d509f890e08c94fb11e13ef5effc03a0ec08de773f3fa39f2b25f2dae5aca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page