telnetlib3


Nametelnetlib3 JSON
Version 2.0.4 PyPI version JSON
download
home_pagehttp://telnetlib3.rtfd.org/
SummaryPython 3 asyncio Telnet server and client Protocol library
upload_time2023-07-23 16:07:12
maintainer
docs_urlNone
authorJeff Quast
requires_python>=3.7
licenseISC
keywords telnet server client bbs mud utf8 cp437 api library asyncio talker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://coveralls.io/repos/jquast/telnetlib3/badge.svg?branch=master&service=github
    :alt: Coveralls Code Coverage
    :target: https://coveralls.io/github/jquast/telnetlib3?branch=master

.. image:: https://img.shields.io/pypi/v/telnetlib3.svg
    :alt: Latest Version
    :target: https://pypi.python.org/pypi/telnetlib3

.. image:: https://img.shields.io/pypi/dm/telnetlib3.svg
    :alt: Downloads
    :target: https://pypi.python.org/pypi/telnetlib3


Introduction
============

telnetlib3 is a Telnet Client and Server library for python.  This project
requires python 3.7 and later, using the asyncio_ module.

.. _asyncio: http://docs.python.org/3.11/library/asyncio.html

Quick Example
-------------

Authoring a Telnet Server using Streams interface that offers a basic war game:

.. code-block:: python

    import asyncio, telnetlib3

    async def shell(reader, writer):
        writer.write('\r\nWould you like to play a game? ')
        inp = await reader.read(1)
        if inp:
            writer.echo(inp)
            writer.write('\r\nThey say the only way to win '
                         'is to not play at all.\r\n')
            await writer.drain()
        writer.close()

    loop = asyncio.get_event_loop()
    coro = telnetlib3.create_server(port=6023, shell=shell)
    server = loop.run_until_complete(coro)
    loop.run_until_complete(server.wait_closed())

Authoring a Telnet Client that plays the war game with this server:

.. code-block:: python

    import asyncio, telnetlib3

    async def shell(reader, writer):
        while True:
            # read stream until '?' mark is found
            outp = await reader.read(1024)
            if not outp:
                # End of File
                break
            elif '?' in outp:
                # reply all questions with 'y'.
                writer.write('y')

            # display all server output
            print(outp, flush=True)

        # EOF
        print()

    loop = asyncio.get_event_loop()
    coro = telnetlib3.open_connection('localhost', 6023, shell=shell)
    reader, writer = loop.run_until_complete(coro)
    loop.run_until_complete(writer.protocol.waiter_closed)

Command-line
------------

Two command-line scripts are distributed with this package.

``telnetlib3-client``

  Small terminal telnet client.  Some example destinations and options::

    telnetlib3-client nethack.alt.org
    telnetlib3-client --encoding=cp437 --force-binary blackflag.acid.org
    telnetlib3-client htc.zapto.org


``telnetlib3-server``

  Telnet server providing the default debugging shell.  This provides a simple
  shell server that allows introspection of the session's values, for example::

     tel:sh> help
     quit, writer, slc, toggle [option|all], reader, proto

     tel:sh> writer
     <TelnetWriter server mode:kludge +lineflow -xon_any +slc_sim server-will:BINARY,ECHO,SGA client-will:BINARY,NAWS,NEW_ENVIRON,TTYPE>

     tel:sh> reader
     <TelnetReaderUnicode encoding='utf8' limit=65536 buflen=0 eof=False>

     tel:sh> toggle all
     wont echo.
     wont suppress go-ahead.
     wont outbinary.
     dont inbinary.
     xon-any enabled.
     lineflow disabled.

     tel:sh> reader
     <TelnetReaderUnicode encoding='US-ASCII' limit=65536 buflen=1 eof=False>

     tel:sh> writer
     <TelnetWriter server mode:local -lineflow +xon_any +slc_sim client-will:NAWS,NEW_ENVIRON,TTYPE>


Both command-line scripts accept argument ``--shell=my_module.fn_shell``
describing a python module path to a coroutine of signature
``shell(reader, writer)``, just as the above examples.

Features
--------

The following RFC specifications are implemented:

* `rfc-727`_, "Telnet Logout Option," Apr 1977.
* `rfc-779`_, "Telnet Send-Location Option", Apr 1981.
* `rfc-854`_, "Telnet Protocol Specification", May 1983.
* `rfc-855`_, "Telnet Option Specifications", May 1983.
* `rfc-856`_, "Telnet Binary Transmission", May 1983.
* `rfc-857`_, "Telnet Echo Option", May 1983.
* `rfc-858`_, "Telnet Suppress Go Ahead Option", May 1983.
* `rfc-859`_, "Telnet Status Option", May 1983.
* `rfc-860`_, "Telnet Timing mark Option", May 1983.
* `rfc-885`_, "Telnet End of Record Option", Dec 1983.
* `rfc-1073`_, "Telnet Window Size Option", Oct 1988.
* `rfc-1079`_, "Telnet Terminal Speed Option", Dec 1988.
* `rfc-1091`_, "Telnet Terminal-Type Option", Feb 1989.
* `rfc-1096`_, "Telnet X Display Location Option", Mar 1989.
* `rfc-1123`_, "Requirements for Internet Hosts", Oct 1989.
* `rfc-1184`_, "Telnet Linemode Option (extended options)", Oct 1990.
* `rfc-1372`_, "Telnet Remote Flow Control Option", Oct 1992.
* `rfc-1408`_, "Telnet Environment Option", Jan 1993.
* `rfc-1571`_, "Telnet Environment Option Interoperability Issues", Jan 1994.
* `rfc-1572`_, "Telnet Environment Option", Jan 1994.
* `rfc-2066`_, "Telnet Charset Option", Jan 1997.

.. _rfc-727: https://www.rfc-editor.org/rfc/rfc727.txt
.. _rfc-779: https://www.rfc-editor.org/rfc/rfc779.txt
.. _rfc-854: https://www.rfc-editor.org/rfc/rfc854.txt
.. _rfc-855: https://www.rfc-editor.org/rfc/rfc855.txt
.. _rfc-856: https://www.rfc-editor.org/rfc/rfc856.txt
.. _rfc-857: https://www.rfc-editor.org/rfc/rfc857.txt
.. _rfc-858: https://www.rfc-editor.org/rfc/rfc858.txt
.. _rfc-859: https://www.rfc-editor.org/rfc/rfc859.txt
.. _rfc-860: https://www.rfc-editor.org/rfc/rfc860.txt
.. _rfc-885: https://www.rfc-editor.org/rfc/rfc885.txt
.. _rfc-1073: https://www.rfc-editor.org/rfc/rfc1073.txt
.. _rfc-1079: https://www.rfc-editor.org/rfc/rfc1079.txt
.. _rfc-1091: https://www.rfc-editor.org/rfc/rfc1091.txt
.. _rfc-1096: https://www.rfc-editor.org/rfc/rfc1096.txt
.. _rfc-1123: https://www.rfc-editor.org/rfc/rfc1123.txt
.. _rfc-1184: https://www.rfc-editor.org/rfc/rfc1184.txt
.. _rfc-1372: https://www.rfc-editor.org/rfc/rfc1372.txt
.. _rfc-1408: https://www.rfc-editor.org/rfc/rfc1408.txt
.. _rfc-1571: https://www.rfc-editor.org/rfc/rfc1571.txt
.. _rfc-1572: https://www.rfc-editor.org/rfc/rfc1572.txt
.. _rfc-2066: https://www.rfc-editor.org/rfc/rfc2066.txt

Further Reading
---------------

Further documentation available at https://telnetlib3.readthedocs.org/

            

Raw data

            {
    "_id": null,
    "home_page": "http://telnetlib3.rtfd.org/",
    "name": "telnetlib3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "telnet,server,client,bbs,mud,utf8,cp437,api,library,asyncio,talker",
    "author": "Jeff Quast",
    "author_email": "contact@jeffquast.com",
    "download_url": "https://files.pythonhosted.org/packages/ef/af/0fadfddd1764e627f4ba9c7381caaf121795ed459a1cc3d0fbb89a187954/telnetlib3-2.0.4.tar.gz",
    "platform": "any",
    "description": ".. image:: https://coveralls.io/repos/jquast/telnetlib3/badge.svg?branch=master&service=github\n    :alt: Coveralls Code Coverage\n    :target: https://coveralls.io/github/jquast/telnetlib3?branch=master\n\n.. image:: https://img.shields.io/pypi/v/telnetlib3.svg\n    :alt: Latest Version\n    :target: https://pypi.python.org/pypi/telnetlib3\n\n.. image:: https://img.shields.io/pypi/dm/telnetlib3.svg\n    :alt: Downloads\n    :target: https://pypi.python.org/pypi/telnetlib3\n\n\nIntroduction\n============\n\ntelnetlib3 is a Telnet Client and Server library for python.  This project\nrequires python 3.7 and later, using the asyncio_ module.\n\n.. _asyncio: http://docs.python.org/3.11/library/asyncio.html\n\nQuick Example\n-------------\n\nAuthoring a Telnet Server using Streams interface that offers a basic war game:\n\n.. code-block:: python\n\n    import asyncio, telnetlib3\n\n    async def shell(reader, writer):\n        writer.write('\\r\\nWould you like to play a game? ')\n        inp = await reader.read(1)\n        if inp:\n            writer.echo(inp)\n            writer.write('\\r\\nThey say the only way to win '\n                         'is to not play at all.\\r\\n')\n            await writer.drain()\n        writer.close()\n\n    loop = asyncio.get_event_loop()\n    coro = telnetlib3.create_server(port=6023, shell=shell)\n    server = loop.run_until_complete(coro)\n    loop.run_until_complete(server.wait_closed())\n\nAuthoring a Telnet Client that plays the war game with this server:\n\n.. code-block:: python\n\n    import asyncio, telnetlib3\n\n    async def shell(reader, writer):\n        while True:\n            # read stream until '?' mark is found\n            outp = await reader.read(1024)\n            if not outp:\n                # End of File\n                break\n            elif '?' in outp:\n                # reply all questions with 'y'.\n                writer.write('y')\n\n            # display all server output\n            print(outp, flush=True)\n\n        # EOF\n        print()\n\n    loop = asyncio.get_event_loop()\n    coro = telnetlib3.open_connection('localhost', 6023, shell=shell)\n    reader, writer = loop.run_until_complete(coro)\n    loop.run_until_complete(writer.protocol.waiter_closed)\n\nCommand-line\n------------\n\nTwo command-line scripts are distributed with this package.\n\n``telnetlib3-client``\n\n  Small terminal telnet client.  Some example destinations and options::\n\n    telnetlib3-client nethack.alt.org\n    telnetlib3-client --encoding=cp437 --force-binary blackflag.acid.org\n    telnetlib3-client htc.zapto.org\n\n\n``telnetlib3-server``\n\n  Telnet server providing the default debugging shell.  This provides a simple\n  shell server that allows introspection of the session's values, for example::\n\n     tel:sh> help\n     quit, writer, slc, toggle [option|all], reader, proto\n\n     tel:sh> writer\n     <TelnetWriter server mode:kludge +lineflow -xon_any +slc_sim server-will:BINARY,ECHO,SGA client-will:BINARY,NAWS,NEW_ENVIRON,TTYPE>\n\n     tel:sh> reader\n     <TelnetReaderUnicode encoding='utf8' limit=65536 buflen=0 eof=False>\n\n     tel:sh> toggle all\n     wont echo.\n     wont suppress go-ahead.\n     wont outbinary.\n     dont inbinary.\n     xon-any enabled.\n     lineflow disabled.\n\n     tel:sh> reader\n     <TelnetReaderUnicode encoding='US-ASCII' limit=65536 buflen=1 eof=False>\n\n     tel:sh> writer\n     <TelnetWriter server mode:local -lineflow +xon_any +slc_sim client-will:NAWS,NEW_ENVIRON,TTYPE>\n\n\nBoth command-line scripts accept argument ``--shell=my_module.fn_shell``\ndescribing a python module path to a coroutine of signature\n``shell(reader, writer)``, just as the above examples.\n\nFeatures\n--------\n\nThe following RFC specifications are implemented:\n\n* `rfc-727`_, \"Telnet Logout Option,\" Apr 1977.\n* `rfc-779`_, \"Telnet Send-Location Option\", Apr 1981.\n* `rfc-854`_, \"Telnet Protocol Specification\", May 1983.\n* `rfc-855`_, \"Telnet Option Specifications\", May 1983.\n* `rfc-856`_, \"Telnet Binary Transmission\", May 1983.\n* `rfc-857`_, \"Telnet Echo Option\", May 1983.\n* `rfc-858`_, \"Telnet Suppress Go Ahead Option\", May 1983.\n* `rfc-859`_, \"Telnet Status Option\", May 1983.\n* `rfc-860`_, \"Telnet Timing mark Option\", May 1983.\n* `rfc-885`_, \"Telnet End of Record Option\", Dec 1983.\n* `rfc-1073`_, \"Telnet Window Size Option\", Oct 1988.\n* `rfc-1079`_, \"Telnet Terminal Speed Option\", Dec 1988.\n* `rfc-1091`_, \"Telnet Terminal-Type Option\", Feb 1989.\n* `rfc-1096`_, \"Telnet X Display Location Option\", Mar 1989.\n* `rfc-1123`_, \"Requirements for Internet Hosts\", Oct 1989.\n* `rfc-1184`_, \"Telnet Linemode Option (extended options)\", Oct 1990.\n* `rfc-1372`_, \"Telnet Remote Flow Control Option\", Oct 1992.\n* `rfc-1408`_, \"Telnet Environment Option\", Jan 1993.\n* `rfc-1571`_, \"Telnet Environment Option Interoperability Issues\", Jan 1994.\n* `rfc-1572`_, \"Telnet Environment Option\", Jan 1994.\n* `rfc-2066`_, \"Telnet Charset Option\", Jan 1997.\n\n.. _rfc-727: https://www.rfc-editor.org/rfc/rfc727.txt\n.. _rfc-779: https://www.rfc-editor.org/rfc/rfc779.txt\n.. _rfc-854: https://www.rfc-editor.org/rfc/rfc854.txt\n.. _rfc-855: https://www.rfc-editor.org/rfc/rfc855.txt\n.. _rfc-856: https://www.rfc-editor.org/rfc/rfc856.txt\n.. _rfc-857: https://www.rfc-editor.org/rfc/rfc857.txt\n.. _rfc-858: https://www.rfc-editor.org/rfc/rfc858.txt\n.. _rfc-859: https://www.rfc-editor.org/rfc/rfc859.txt\n.. _rfc-860: https://www.rfc-editor.org/rfc/rfc860.txt\n.. _rfc-885: https://www.rfc-editor.org/rfc/rfc885.txt\n.. _rfc-1073: https://www.rfc-editor.org/rfc/rfc1073.txt\n.. _rfc-1079: https://www.rfc-editor.org/rfc/rfc1079.txt\n.. _rfc-1091: https://www.rfc-editor.org/rfc/rfc1091.txt\n.. _rfc-1096: https://www.rfc-editor.org/rfc/rfc1096.txt\n.. _rfc-1123: https://www.rfc-editor.org/rfc/rfc1123.txt\n.. _rfc-1184: https://www.rfc-editor.org/rfc/rfc1184.txt\n.. _rfc-1372: https://www.rfc-editor.org/rfc/rfc1372.txt\n.. _rfc-1408: https://www.rfc-editor.org/rfc/rfc1408.txt\n.. _rfc-1571: https://www.rfc-editor.org/rfc/rfc1571.txt\n.. _rfc-1572: https://www.rfc-editor.org/rfc/rfc1572.txt\n.. _rfc-2066: https://www.rfc-editor.org/rfc/rfc2066.txt\n\nFurther Reading\n---------------\n\nFurther documentation available at https://telnetlib3.readthedocs.org/\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "Python 3 asyncio Telnet server and client Protocol library",
    "version": "2.0.4",
    "project_urls": {
        "Homepage": "http://telnetlib3.rtfd.org/"
    },
    "split_keywords": [
        "telnet",
        "server",
        "client",
        "bbs",
        "mud",
        "utf8",
        "cp437",
        "api",
        "library",
        "asyncio",
        "talker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "784d9c87bdd58ac7df008d27b2cf0b0757a0beccb45a59d4354049302a4fe4f8",
                "md5": "2194fcce19938fa394cf8e2c08438ce2",
                "sha256": "b3c0f984a7fb1b6ee16e6fdaa410c56389b0dc492174a99c6661b1ba4c9d457d"
            },
            "downloads": -1,
            "filename": "telnetlib3-2.0.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2194fcce19938fa394cf8e2c08438ce2",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.7",
            "size": 93264,
            "upload_time": "2023-07-23T16:07:11",
            "upload_time_iso_8601": "2023-07-23T16:07:11.381827Z",
            "url": "https://files.pythonhosted.org/packages/78/4d/9c87bdd58ac7df008d27b2cf0b0757a0beccb45a59d4354049302a4fe4f8/telnetlib3-2.0.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "efaf0fadfddd1764e627f4ba9c7381caaf121795ed459a1cc3d0fbb89a187954",
                "md5": "2dfac7e10ed63c408da50ea712415f87",
                "sha256": "dbcbc16456a0e03a62431be7cfefff00515ab2f4ce2afbaf0d3a0e51a98c948d"
            },
            "downloads": -1,
            "filename": "telnetlib3-2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2dfac7e10ed63c408da50ea712415f87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 72422,
            "upload_time": "2023-07-23T16:07:12",
            "upload_time_iso_8601": "2023-07-23T16:07:12.818781Z",
            "url": "https://files.pythonhosted.org/packages/ef/af/0fadfddd1764e627f4ba9c7381caaf121795ed459a1cc3d0fbb89a187954/telnetlib3-2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-23 16:07:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "telnetlib3"
}
        
Elapsed time: 0.13051s