{"id":15357223,"url":"https://github.com/gera2ld/pysocks","last_synced_at":"2025-06-26T13:36:00.295Z","repository":{"id":57433904,"uuid":"65057175","full_name":"gera2ld/pysocks","owner":"gera2ld","description":"A SOCKS server and client package built with asyncio.","archived":false,"fork":false,"pushed_at":"2021-08-21T13:04:28.000Z","size":81,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-16T05:20:07.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gera2ld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-06T00:24:59.000Z","updated_at":"2023-02-05T00:37:49.000Z","dependencies_parsed_at":"2022-08-27T22:30:43.844Z","dependency_job_id":null,"html_url":"https://github.com/gera2ld/pysocks","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/gera2ld/pysocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fpysocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fpysocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fpysocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fpysocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gera2ld","download_url":"https://codeload.github.com/gera2ld/pysocks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fpysocks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260415154,"owners_count":23005508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T12:34:05.724Z","updated_at":"2025-06-26T13:36:00.270Z","avatar_url":"https://github.com/gera2ld.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gera2ld.socks\n\n[![PyPI](https://img.shields.io/pypi/v/gera2ld.socks.svg)](https://pypi.org/project/gera2ld.socks/)\n\nThis is a SOCKS server and client package built with `asyncio` (requires Python 3.5+).\n\n## Installation\n\n``` sh\n$ pip3 install gera2ld.socks\n```\n\n## Usage\n\n* SOCKS server\n\n  shell command:\n  ``` sh\n  # Start a server\n  $ python3 -m gera2ld.socks.server -b 127.0.0.1:1080\n  ```\n\n  or python script:\n  ``` python\n  from gera2ld.pyserve import run_forever\n  from gera2ld.socks.server import Config, SOCKSServer\n\n  config = Config('127.0.0.1:1080')\n  run_forever(SOCKSServer(config).start_server())\n  ```\n\n* SOCKS client\n\n  ``` python\n  import asyncio\n  from gera2ld.socks.client import create_client\n\n  client = create_client('socks5://127.0.0.1:1080')\n  loop = asyncio.get_event_loop()\n  loop.run_until_complete(client.handle_connect(('www.google.com', 80)))\n  client.writer.write(b'...')\n  print(loop.run_until_complete(client.reader.read()))\n  ```\n\n* SOCKS handler for `urllib`\n\n  ``` python\n  from urllib import request\n  from gera2ld.socks.client.handler import SOCKSProxyHandler\n\n  handler = SOCKSProxyHandler('socks5://127.0.0.1:1080')\n\n  opener = request.build_opener(handler)\n  r = opener.open('https://www.example.com')\n  print(r.read().decode())\n  ```\n\n* SOCKS client for UDP\n\n  ``` python\n  import asyncio\n  from gera2ld.socks.client import create_client\n\n  async def main():\n      client = create_client('socks5://127.0.0.1:1080')\n      udp = await client.handle_udp()\n      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))\n      print(await udp.results.get())\n\n  loop = asyncio.get_event_loop()\n  loop.run_until_complete(main())\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fpysocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgera2ld%2Fpysocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fpysocks/lists"}