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 socks_host,
):
browser = p.chromium.launch(
headless=True,
proxy={"server": socks_host}, # 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).
__enter__() -> str
Start the proxy and return the local SOCSK5 uri.
__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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slippers_proxy-0.2.1.tar.gz.
File metadata
- Download URL: slippers_proxy-0.2.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.8 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05f444781c6d065fcc1f6f612ee7510d2fffb2f3fe56cd0821f8c9468f6b4624
|
|
| MD5 |
9d8bb8458139485e8856bda40a2ae1c8
|
|
| BLAKE2b-256 |
51d5654e6205ca433ae2a0258caa25567556c2352f730936a1041c54c3a115a8
|
File details
Details for the file slippers_proxy-0.2.1-py3-none-any.whl.
File metadata
- Download URL: slippers_proxy-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3358b6e0259c467c43079b532e91944cd82beb445a3123da6065a27fc7a9a067
|
|
| MD5 |
9f746e68a6c383c7c37dd746c7290c9a
|
|
| BLAKE2b-256 |
7fc38c1b5703aa2e6b927b97f86cfc149d60ebabb6489dfb30e3f3a7e15674fa
|