You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

gera2ld.socks

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gera2ld.socks

SOCKS client and server based on asyncio


Maintainers
1

Readme

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())
    
  • SOCKS client for UDP

    import asyncio
    from gera2ld.socks.client import create_client
    
    async def main():
        client = create_client('socks5://127.0.0.1:1080')
        udp = await client.handle_udp()
        udp.write_data(b'\xc9\xa7\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03www\x06google\x03com\x00\x00\xff\x00\x01', ('114.114.114.114', 53))
        print(await udp.results.get())
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc