Skip to main content

SOCKS client and server based on asyncio

Project description

gera2ld.socks

PyPI

This is a SOCKS server and client package built with asyncio (requires Python 3.5+).

Installation

$ pip3 install gera2ld.socks

Usage

  • SOCKS server

    shell command:

    # Start a server
    $ python3 -m gera2ld.socks.server -b 127.0.0.1:1080
    

    or python script:

    from gera2ld.pyserve import run_forever
    from gera2ld.socks.server import Config, SOCKSServer
    
    config = Config('127.0.0.1:1080')
    run_forever(SOCKSServer(config).start_server())
    
  • SOCKS client

    import asyncio
    from gera2ld.socks.client import create_client
    
    client = create_client('socks5://127.0.0.1:1080')
    loop = asyncio.get_event_loop()
    loop.run_until_complete(client.handle_connect(('www.google.com', 80)))
    client.writer.write(b'...')
    print(loop.run_until_complete(client.reader.read()))
    
  • SOCKS handler for urllib

    from urllib import request
    from gera2ld.socks.client.handler import SOCKSProxyHandler
    
    handler = SOCKSProxyHandler('socks5://127.0.0.1:1080')
    
    opener = request.build_opener(handler)
    r = opener.open('https://www.example.com')
    print(r.read().decode())
    

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

gera2ld.socks-0.2.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

gera2ld.socks-0.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file gera2ld.socks-0.2.1.tar.gz.

File metadata

  • Download URL: gera2ld.socks-0.2.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Darwin/19.5.0

File hashes

Hashes for gera2ld.socks-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5c0827fba387bdf1b85565964f95e60e97af0195398014d59c0ea8d97ce0f71d
MD5 181eec5b39e7acbec0148292733624c6
BLAKE2b-256 faf3e5a96758336ee5f8c6620e4c8be6120af438a627a6fd5aa0b818337be291

See more details on using hashes here.

File details

Details for the file gera2ld.socks-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: gera2ld.socks-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.3 Darwin/19.5.0

File hashes

Hashes for gera2ld.socks-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1e1566677f5f83130468777f3e9a2b582345707c804709319fc02845fd5b5ae
MD5 2a3c879a80ca16ccecb59e06ae79250b
BLAKE2b-256 59877b5369b1a63f1fc9760f18bc97066e050a625e609aaa4a191e9fcb035921

See more details on using hashes here.

Supported by

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