{ "info": { "author": "Aaron Gallagher", "author_email": "_@habnab.it", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Twisted", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2 :: Only", "Topic :: Internet" ], "description": ".. image:: https://img.shields.io/travis/habnabit/txsocksx/master.svg?style=flat-square\n :target: https://travis-ci.org/habnabit/txsocksx\n\n.. image:: https://img.shields.io/coveralls/habnabit/txsocksx/master.svg?style=flat-square\n :target: https://coveralls.io/r/habnabit/txsocksx?branch=master\n\n\n========\ntxsocksx\n========\n\n|txsocksx| is SOCKS4/4a and SOCKS5 client endpoints for `Twisted`_ 10.1 or\ngreater. The code is available on github: https://github.com/habnabit/txsocksx\n\n\nExamples\n========\n\nThese examples assume familiarity with how to use `Twisted endpoints`_. For\nsimplicity, most of the examples will use SOCKS5.\n\n\nAuthenticating\n--------------\n\nOne specifies authentication methods to a |SOCKS5ClientEndpoint| via the\n*methods* parameter. For example, to connect using the username ``spam`` and\npassword ``eggs``::\n\n exampleEndpoint = SOCKS5ClientEndpoint(\n 'example.com', 6667, proxyEndpoint, methods={'login': ('spam', 'eggs')})\n\nHowever, this will disable anonymous authentication. To use either login or\nanonymous authentication, specify both methods::\n\n exampleEndpoint = SOCKS5ClientEndpoint(\n 'example.com', 6667, proxyEndpoint, methods={'login': ('spam', 'eggs'),\n 'anonymous': ()})\n\nThe ``methods`` dict must always map from a string to a tuple.\n\n\nSOCKS4\n~~~~~~\n\nSOCKS4 has no authentication, but does have a configurable \"user ID\" which\ndefaults to an empty string::\n\n exampleEndpoint = SOCKS4ClientEndpoint(\n 'example.com', 6667, proxyEndpoint, user='spam')\n\n\nConnecting to a thing over tor\n------------------------------\n\nTo connect to ``example.com`` on port 6667 over tor, one creates a\n|SOCKS5ClientEndpoint| wrapping the endpoint of the tor server::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n exampleEndpoint = SOCKS5ClientEndpoint('example.com', 6667, torServerEndpoint)\n\nEstablishing the connection from there proceeds like usual::\n\n deferred = exampleEndpoint.connect(someFactory)\n\n|txsocksx| will not do any DNS resolution, so the hostname ``example.com``\nwill not leak; tor will receive the hostname directly and do the DNS lookup\nitself.\n\nTor allows connections by SOCKS4 or SOCKS5, and does not expect a user ID to be\nsent when using the SOCKS4 client.\n\n\nCancelling a connection\n-----------------------\n\nSometimes one tires of waiting and wants to abort the connection attempt. For\nexample, to abort the whole connection attempt after ten seconds::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n exampleEndpoint = SOCKS5ClientEndpoint('example.com', 6667, torServerEndpoint)\n deferred = exampleEndpoint.connect(someFactory)\n reactor.callLater(10, deferred.cancel)\n\nThis is a trivial example; real code should cancel the `IDelayedCall`_ returned\nby ``reactor.callLater`` when the deferred fires. The code would then look like\nthis::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n exampleEndpoint = SOCKS5ClientEndpoint('example.com', 6667, torServerEndpoint)\n deferred = exampleEndpoint.connect(someFactory)\n canceler = reactor.callLater(10, deferred.cancel)\n\n def cancelCanceler(result):\n if canceler.active():\n canceler.cancel()\n return result\n deferred.addBoth(cancelCanceler)\n\n\nMaking HTTP requests\n--------------------\n\nTwisted's builtin `Agent`_ HTTP client did not support being handed an\narbitrary endpoint before 15.0, so |txsocksx| provides an ``Agent`` for maximum\ncompatibility.\n\nWhile |txsocksx| requires only Twisted 10.1, |txsocksx.http| requires Twisted\n12.1 or greater. Its usage is almost identical to normal ``Agent`` usage::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n agent = SOCKS5Agent(reactor, proxyEndpoint=torServerEndpoint)\n deferred = agent.request('GET', 'http://example.com/')\n\nNote that the ``proxyEndpoint`` parameter *must* be passed as a keyword\nargument. There is a second, optional, keyword-only argument for passing\nadditional arguments to the |SOCKS5ClientEndpoint| as |SOCKS5Agent|\nconstructs it::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n agent = SOCKS5Agent(reactor, proxyEndpoint=torServerEndpoint,\n endpointArgs=dict(methods={'login': ('spam', 'eggs')}))\n deferred = agent.request('GET', 'http://example.com/')\n\n|SOCKS5Agent| transparently supports HTTPS via |TLSWrapClientEndpoint|.\n\nFor users with Twisted 15.0 or greater, |SOCKS5Agent| also implements\n`IAgentEndpointFactory`_.\n\n\nUpgrading to TLS\n----------------\n\nSometimes one wants to switch to speaking TLS as soon as the proxy negotiation\nis finished. For that, there is |txsocksx.tls|. After wrapping an endpoint with\n|TLSWrapClientEndpoint|, the connection will be upgraded to using TLS\nimmediately after proxy negotiation finishes::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n exampleEndpoint = SOCKS5ClientEndpoint('example.com', 6667, torServerEndpoint)\n tlsEndpoint = TLSWrapClientEndpoint(exampleEndpoint)\n deferred = tlsEndpoint.connect(someFactory)\n\n\nProxying over a proxy\n---------------------\n\nBecause of |txsocksx|'s composable design, it's trivial to connect from one SOCKS\nproxy to another::\n\n torServerEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)\n firstProxyEndpoint = SOCKS5ClientEndpoint(\n 'first-proxy.example.com', 1080, torServerEndpoint)\n secondProxyEndpoint = SOCKS4ClientEndpoint(\n 'second-proxy.example.com', 1080, firstProxyEndpoint)\n finalHop = SOCKS5ClientEndpoint(\n 'example.com', 113, secondProxyEndpoint)\n deferred = finalHop.connect(someFactory)\n\n\n.. _Twisted: http://twistedmatrix.com/\n.. _Twisted endpoints: http://twistedmatrix.com/documents/current/core/howto/endpoints.html\n.. _IDelayedCall: http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IDelayedCall.html\n.. _Agent: http://twistedmatrix.com/documents/current/web/howto/client.html\n.. _IAgentEndpointFactory: http://twistedmatrix.com/documents/current/api/twisted.web.iweb.IAgentEndpointFactory.html\n\n.. |SOCKS5ClientEndpoint| replace:: ``SOCKS5ClientEndpoint``\n.. |SOCKS5Agent| replace:: ``SOCKS5Agent``\n.. |TLSWrapClientEndpoint| replace:: ``TLSWrapClientEndpoint``\n.. |txsocksx| replace:: ``txsocksx``\n.. |txsocksx.http| replace:: ``txsocksx.http``\n.. |txsocksx.tls| replace:: ``txsocksx.tls``", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/habnabit/txsocksx", "keywords": null, "license": "ISC", "maintainer": null, "maintainer_email": null, "name": "txsocksx", "package_url": "https://pypi.org/project/txsocksx/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/txsocksx/", "project_urls": { "Homepage": "https://github.com/habnabit/txsocksx" }, "release_url": "https://pypi.org/project/txsocksx/1.15.0.2/", "requires_dist": null, "requires_python": null, "summary": "Twisted client endpoints for SOCKS{4,4a,5}", "version": "1.15.0.2" }, "last_serial": 1662274, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "68558e36f0cccd77d991df64692df562", "sha256": "88e7fb323721d7532b5e37a946cdfa0ed02cb41fc1a02cfc5171a4e77f948060" }, "downloads": -1, "filename": "txsocksx-0.0.1.tar.gz", "has_sig": false, "md5_digest": "68558e36f0cccd77d991df64692df562", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4628, "upload_time": "2013-01-05T00:04:46", "url": "https://files.pythonhosted.org/packages/ae/cb/15e8db29b31e6732c64489ad0e9583976a51bb669a8513d6e829dbc69aa5/txsocksx-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "496baa77dbcde569681ad953e8908035", "sha256": "ee5bfc45636ba32444f28008736c36804b71f55ed59f5815c0ca7873af5d70dc" }, "downloads": -1, "filename": "txsocksx-0.0.2.tar.gz", "has_sig": true, "md5_digest": "496baa77dbcde569681ad953e8908035", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5397, "upload_time": "2013-02-27T11:09:00", "url": "https://files.pythonhosted.org/packages/20/ae/acdc93f89dce1889c3f46066988fdfd334ddbdf3a97dcc2b28c7f179b341/txsocksx-0.0.2.tar.gz" } ], "1.13.0.0": [ { "comment_text": "", "digests": { "md5": "57ffcc91e6cd2b347fba4baf986040e1", "sha256": "a7f2102db8c6fa8d0e6066518bbd36d908f5dd8e8fbd6c3d4949eacb797e1d83" }, "downloads": -1, "filename": "txsocksx-1.13.0.0.tar.gz", "has_sig": true, "md5_digest": "57ffcc91e6cd2b347fba4baf986040e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18990, "upload_time": "2013-10-05T18:59:03", "url": "https://files.pythonhosted.org/packages/ed/68/932ef0183a4a8635562df3fc3c2250838b3e69f3bf70fde015188705bee9/txsocksx-1.13.0.0.tar.gz" } ], "1.13.0.0rc1": [ { "comment_text": "", "digests": { "md5": "1b9c4034231bb0e28e0787cb02ff58e3", "sha256": "15edacd494684fa2b62074efe7025a8711fbc4e05d76cac09e8f5c69d550c1a7" }, "downloads": -1, "filename": "txsocksx-1.13.0.0rc1.tar.gz", "has_sig": false, "md5_digest": "1b9c4034231bb0e28e0787cb02ff58e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16350, "upload_time": "2013-08-26T12:01:08", "url": "https://files.pythonhosted.org/packages/aa/12/cf5b7bc19059b194f8ea823a794f572ddb9256cf59e53c8877d90479ad15/txsocksx-1.13.0.0rc1.tar.gz" } ], "1.13.0.0rc2": [ { "comment_text": "", "digests": { "md5": "8b61b3a47d2083777beabf61696b8531", "sha256": "00e9f4d9fa10e627f0ea4551480a1e93d36b4812517a8d8faf17550c59330d1c" }, "downloads": -1, "filename": "txsocksx-1.13.0.0rc2.tar.gz", "has_sig": false, "md5_digest": "8b61b3a47d2083777beabf61696b8531", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16993, "upload_time": "2013-08-26T12:11:19", "url": "https://files.pythonhosted.org/packages/98/1b/2201912724324ac11c981a9763ef988b7c8e37c105170a0bd9dd0e7e5a90/txsocksx-1.13.0.0rc2.tar.gz" } ], "1.13.0.1": [ { "comment_text": "", "digests": { "md5": "7286cf0e41c72898fc8740a27c99d052", "sha256": "f4eb94aab3ea9eecf39cef46e87b742765cf0c19dbe544fc5ca221e7006a750f" }, "downloads": -1, "filename": "txsocksx-1.13.0.1.tar.gz", "has_sig": true, "md5_digest": "7286cf0e41c72898fc8740a27c99d052", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18996, "upload_time": "2013-11-08T04:10:49", "url": "https://files.pythonhosted.org/packages/dc/4b/2ebecfdffdbd44d7fe5bab8e84d23ca953d6905111c4ad8da186c546c1e2/txsocksx-1.13.0.1.tar.gz" } ], "1.13.0.2": [ { "comment_text": "", "digests": { "md5": "c0da97677bcc09e7ba027e00e6e6ecb0", "sha256": "b90e0c450a7f95e0db12f0764f59b0adaef787cb53847a9b2990526b8e144772" }, "downloads": -1, "filename": "txsocksx-1.13.0.2.tar.gz", "has_sig": false, "md5_digest": "c0da97677bcc09e7ba027e00e6e6ecb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19024, "upload_time": "2014-03-30T22:23:57", "url": "https://files.pythonhosted.org/packages/7e/f8/a9d0f943afb1745f2e6cae2b91aebb57fe13ade655eb52a183afb5ec9d3e/txsocksx-1.13.0.2.tar.gz" } ], "1.13.0.3": [ { "comment_text": "", "digests": { "md5": "05d03a7137a11affe4bcb7c8effba220", "sha256": "df1a9e7062c7e3693c39953705b75e0feb7b8746a05135ffb2b8cd98708c9c43" }, "downloads": -1, "filename": "txsocksx-1.13.0.3.tar.gz", "has_sig": true, "md5_digest": "05d03a7137a11affe4bcb7c8effba220", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19147, "upload_time": "2014-05-06T16:21:07", "url": "https://files.pythonhosted.org/packages/71/f5/ee940a6593b21524184112a92a60f52277fe72c927825a950277e48c558a/txsocksx-1.13.0.3.tar.gz" } ], "1.15.0.2": [ { "comment_text": "", "digests": { "md5": "cc398b8aa01e1e0f11998253c13d4f30", "sha256": "a71321e6bc22683dc3c7f85d1f784989f3d8f3ea55a95bdc07c2837521c3071b" }, "downloads": -1, "filename": "txsocksx-1.15.0.2-py2-none-any.whl", "has_sig": true, "md5_digest": "cc398b8aa01e1e0f11998253c13d4f30", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 23567, "upload_time": "2015-08-03T17:20:58", "url": "https://files.pythonhosted.org/packages/f9/27/534646269c5e63ddbec6c889fc25d8e9d87eebdcbd577fafbc69316ab070/txsocksx-1.15.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0266b9ae7b58f7550a49683afebf65ba", "sha256": "4f79b5225ce29709bfcee45e6f726e65b70fd6f1399d1898e54303dbd6f8065f" }, "downloads": -1, "filename": "txsocksx-1.15.0.2.tar.gz", "has_sig": true, "md5_digest": "0266b9ae7b58f7550a49683afebf65ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19350, "upload_time": "2015-08-03T17:20:52", "url": "https://files.pythonhosted.org/packages/ed/36/5bc796eb2612b500baa26a68481d699e08af5382152a9de18e5a45b44ea7/txsocksx-1.15.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cc398b8aa01e1e0f11998253c13d4f30", "sha256": "a71321e6bc22683dc3c7f85d1f784989f3d8f3ea55a95bdc07c2837521c3071b" }, "downloads": -1, "filename": "txsocksx-1.15.0.2-py2-none-any.whl", "has_sig": true, "md5_digest": "cc398b8aa01e1e0f11998253c13d4f30", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 23567, "upload_time": "2015-08-03T17:20:58", "url": "https://files.pythonhosted.org/packages/f9/27/534646269c5e63ddbec6c889fc25d8e9d87eebdcbd577fafbc69316ab070/txsocksx-1.15.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0266b9ae7b58f7550a49683afebf65ba", "sha256": "4f79b5225ce29709bfcee45e6f726e65b70fd6f1399d1898e54303dbd6f8065f" }, "downloads": -1, "filename": "txsocksx-1.15.0.2.tar.gz", "has_sig": true, "md5_digest": "0266b9ae7b58f7550a49683afebf65ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19350, "upload_time": "2015-08-03T17:20:52", "url": "https://files.pythonhosted.org/packages/ed/36/5bc796eb2612b500baa26a68481d699e08af5382152a9de18e5a45b44ea7/txsocksx-1.15.0.2.tar.gz" } ] }