{ "info": { "author": "Ritiek Malhotra", "author_email": "ritiekmalhotra123@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "muxnect\n=======\n\n|Pypi Version| |Build Status|\n\nSend input to just about any interactive command-line tool through a local\nweb server.\n\nmuxnect is a tool that invokes tmux to create a session and then wraps\naround its method of sending mouse-events or key-strokes to the terminal\nthrough a local web server.\n\nQuick Introduction\n------------------\n\nA bare-bones method to muxnect any interactive CLI tool:\n\n.. code:: bash\n\n $ muxnect -w -c \n\nNow just nail up some POST requests to\nhttp://localhost:6060/muxnect/tmux_window_name\n\nLet's try using Python:\n\n.. code:: python\n\n >>> import requests\n >>> url = 'http://localhost:6060/muxnect/'\n >>> requests.post(url, data={'keys': 'wonderful keystrokes'})\n \n\nThat's it, our web server just sent ``wonderful keystrokes`` to\n````.\n\nExamples\n--------\n\nOkay, that probably left you confused.\n\nHere are some cool examples to cover up:\n\nHello World - Python\n~~~~~~~~~~~~~~~~~~~~\n\nHere we'll print hello world in Python through muxnect.\n\nLet's call muxnect to launch a Python console where it is supposed to\nprint hello world:\n\n.. code:: bash\n\n $ muxnect -w hello_world -c python\n\nNow hook up another Python console and using it let's send a POST\nrequest to muxnect's server:\n\n.. code:: python\n\n >>> import requests\n >>> url = 'http://localhost:6060/muxnect/hello_world'\n >>> hello_world = 'print(\"Hello World!\")'\n # send return key after it is done sending `keys`\n >>> requests.post(url, data={'keys':hello_world, 'enter':'true'})\n \n\n(of course, you can use any good way to make POST requests and not just\nstay limited to Python requests)\n\nThere's our ``Hello World!`` on the Python console we launched through\nmuxnect.\n\nNow, let's go through the ``separator`` parameter:\n\n.. code:: python\n\n # send KeyboardInterrupt after sending keys\n >>> requests.post(url, data={'keys':'send Ctrl+c; C-c', 'separator':'; '})\n \n # separator will split keys to preserve any special keys\n # here it will send \"send Ctrl+c\" and then immediately \"C-c\" (Ctrl+c, KBInterrupt)\n # you can use any number of separator blocks in `keys` param\n\n # try similar code without using separators\n >>> requests.post(url, data={'keys':'no Ctrl+c; C-c'})\n \n # note how it sends raw keys directly\n\n # send return key and EOF (Ctrl+d) to end our python session\n >>> requests.post(url, data={'keys':'Enter; C-d', 'separator':'; '})\n \n\nSeparators are helpful when we need to send a combination of\nraw keys and special keys. Without it, the ``key`` param will be\ninterpreted rawly.\n\nFrom the `tmux official docs `__,\nhere are all the special keys that may be used:\n\n tmux allows a command to be bound to most keys, with or without a prefix key.\n When specifying keys, most represent themselves (for example \u2018A\u2019 to \u2018Z\u2019).\n Ctrl keys may be prefixed with \u2018C-\u2019 or \u2018^\u2019, and Alt (meta) with \u2018M-\u2019.\n In addition, the following special key names are accepted:\n Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape,\n F1 to F12, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab.\n\nWe're done. Exit the running tmux session in muxnect with Ctrl+d.\n\nControl Media Playback\n~~~~~~~~~~~~~~~~~~~~~~\n\nFor a real-world example, let's try controlling media playback in\n`mpv-player `__.\n\nYou can install ``mpv`` from apt if you don't have it already.\n\nLet's play some video though mpv using muxnect:\n\n.. code:: bash\n\n $ muxnect -w playback -c \"mpv --loop-file https://github.com/mediaelement/mediaelement-files/raw/master/big_buck_bunny.mp4\"\n\nHold on for the video to show up and then we'll send input to this\nrunning instance of mpv:\n\n.. code:: python\n\n >>> import requests\n >>> url = 'http://localhost:6060/muxnect/playback'\n # space key pauses the video in mpv by default\n >>> requests.post(url, data={'keys':' '})\n \n # kill this tmux window\n >>> requests.post(url, data={'kill':'true'})\n \n\nSyntactic Sugar\n---------------\n\nmuxnect also provides a simple API for Python to make POST requests:\n\n.. code:: python\n\n >>> import muxnect\n >>> url = 'http://localhost:6060/muxnect/cute_cli'\n >>> client = muxnect.Client(url, default_data={'enter':'true'})\n >>> client.send('type this, press enter and kill session', data={'kill':'true'})\n\nInstallation\n------------\n\nYou must have `tmux `__ installed to use\nthis. You may have to install it from source, if it ain't in\nyour `apt` repositories.\n\nmuxnect works best with Python 3.\n\nInstall the latest stable release from pypa:\n\n::\n\n $ pip install muxnect\n\nOr install the latest development version:\n\n::\n\n $ git clone https://github.com/ritiek/muxnect\n $ cd muxnect\n $ python setup.py install\n\nUsage\n-----\n\n::\n\n usage: muxnect [-h] -c CMD -w WINDOW_NAME [-d] [-s SESSION_NAME]\n [-b BIND_ADDRESS] [-p PORT]\n\n Send input to just about any interactive command-line tool through a local web\n server\n\n optional arguments:\n -h, --help show this help message and exit\n -d, --detach detach from ongoing session (default: False)\n -s SESSION_NAME, --session-name SESSION_NAME\n tmux's session name (default: muxnect)\n -b BIND_ADDRESS, --bind-address BIND_ADDRESS\n address to bind on, local network: 0.0.0.0 (default:\n 127.0.0.1)\n -p PORT, --port PORT port number to listen on (default: 6060)\n\n required arguments:\n -c CMD, --cmd CMD interactive command to send input to (default: None)\n -w WINDOW_NAME, --window-name WINDOW_NAME\n tmux's window name (default: None)\n\nThe URL is generated in the form:\n\n::\n\n http://://\n\nThe POST request can take the following parameters:\n\n::\n\n keys - mouse events/keystrokes to send (Default: None)\n separator - split `keys` parameter on a character or string (Default: None)\n enter - send enter key immediately after sending `keys` (Default: False)\n kill - kill tmux window after proceeding with any other params (Default: False)\n\nSecurity Note\n-------------\n\nSince there is no way to authenticate at the moment, please use this tool only on systems (and local networks) you completely trust. If an attacker somehow gets to know the URL muxnect is listening on, **nothing stops them from running arbitrary shell commands and completely mess you up.** Please take care!\n\nExtending Further\n-----------------\n\nEver wanted to control that movie running on your laptop but is placed meters away from you? Well, now you can with an android app such as `HTTP-Shortcuts `_ (built by `@Waboodoo `_) which can be used to create custom HTTP requests.\n\nWe'll leave the rest to you :)\n\nWhy ``muxnect`` though?\n-----------------------\n\ntmux + connect = muxnect :heart:\n\nLicense\n-------\n\n|License|\n\n.. |Pypi Version| image:: https://img.shields.io/pypi/v/muxnect.svg\n :target: https://pypi.org/project/muxnect/\n.. |Build Status| image:: https://travis-ci.org/ritiek/muxnect.svg?branch=master\n :target: https://travis-ci.org/ritiek/muxnect\n.. |License| image:: https://img.shields.io/github/license/ritiek/muxnect.svg\n :target: https://github.com/ritiek/muxnect/blob/master/LICENSE\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/ritiek/muxnect/archive/v0.2.4.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/ritiek/muxnect", "keywords": "tmux,connect,send,input,command-line,interactive,local,network", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "muxnect", "package_url": "https://pypi.org/project/muxnect/", "platform": "", "project_url": "https://pypi.org/project/muxnect/", "project_urls": { "Download": "https://github.com/ritiek/muxnect/archive/v0.2.4.tar.gz", "Homepage": "https://www.github.com/ritiek/muxnect" }, "release_url": "https://pypi.org/project/muxnect/0.2.4/", "requires_dist": [ "requests", "Flask", "libtmux" ], "requires_python": "", "summary": "Send input to just about any interactive command-line tool through a local web server", "version": "0.2.4" }, "last_serial": 3877556, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4c59984873e9b3c012e48bbe1696bd60", "sha256": "57716882f01fc111585b51a52edb8ecb7d109e6298240cc45f521157309dfd81" }, "downloads": -1, "filename": "muxnect-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c59984873e9b3c012e48bbe1696bd60", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8286, "upload_time": "2017-12-28T11:51:39", "url": "https://files.pythonhosted.org/packages/f3/38/638ab42712b226838f5ea70c49feaa1caf197df76ed70f13d2b78aa9af3a/muxnect-0.1.0-py2.py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c8a0f42e926bf3b95dc950510a256961", "sha256": "c40eaff514adc1323e5c39ed633b25c6d4a32aaed1bfc08c26452b6762df7150" }, "downloads": -1, "filename": "muxnect-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c8a0f42e926bf3b95dc950510a256961", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8294, "upload_time": "2017-12-28T12:01:05", "url": "https://files.pythonhosted.org/packages/24/2d/1874d8c31ea3b90b91a33bb772d18aaeebb945342fada825c44791f76673/muxnect-0.1.1-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e2b2afd7058b36b62e85ef4c1d68bb2c", "sha256": "a053b33afd7dd7590459d777d2c393ab07f326f705e49b61a4da321681088f6c" }, "downloads": -1, "filename": "muxnect-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e2b2afd7058b36b62e85ef4c1d68bb2c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10248, "upload_time": "2017-12-30T10:08:06", "url": "https://files.pythonhosted.org/packages/fd/08/d9d8f0c8b849f98e2740a1aab0c052abfc63cbb1ddcb637d01c1d270e6b5/muxnect-0.2.0-py2.py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "df21e035916f8d5f366adc2183aede8f", "sha256": "c37b05ce9bbee2e0ef0080cde10139423af263fb12f9d250fa1805b569a2096b" }, "downloads": -1, "filename": "muxnect-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "df21e035916f8d5f366adc2183aede8f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10715, "upload_time": "2018-01-21T15:12:07", "url": "https://files.pythonhosted.org/packages/59/c7/3cd25cde54b2c6bab4daefe2a10b8fdd3774b716455981f0b21e97661952/muxnect-0.2.1-py2.py3-none-any.whl" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "58e752b183f76d376a757de9c32c45f9", "sha256": "5140de52daa026c6c90835a3a7ece25adc9f434c6be9742f12a6766d08204b9f" }, "downloads": -1, "filename": "muxnect-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "58e752b183f76d376a757de9c32c45f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10792, "upload_time": "2018-05-18T13:03:39", "url": "https://files.pythonhosted.org/packages/88/97/e2daa3869743bfdc0fe79769e7a53704eb1b116332a17b173328d2da205d/muxnect-0.2.2-py2.py3-none-any.whl" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "2f3206a366e4633c0876ed96820c26bc", "sha256": "5e2ea2958df402a4fa3dc23e5a86af5831b6ebf11fcf58bb3902eb0771439460" }, "downloads": -1, "filename": "muxnect-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f3206a366e4633c0876ed96820c26bc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10824, "upload_time": "2018-05-18T20:24:37", "url": "https://files.pythonhosted.org/packages/a7/07/a387ca6742004edeb3cd6f4778c147cf3ed523f3e294560e2d0bc6f1f7d6/muxnect-0.2.3-py2.py3-none-any.whl" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "e855592f918fdf1e2e3ebbe722c7a26d", "sha256": "c8fa0954551205a59c056824d0e429283d5d3c928c9d91d2fa95a47309c5c37f" }, "downloads": -1, "filename": "muxnect-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e855592f918fdf1e2e3ebbe722c7a26d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10825, "upload_time": "2018-05-18T20:50:42", "url": "https://files.pythonhosted.org/packages/22/97/f4254a1272654be2c710df9a2340af8732327e7a4ea598a7b80350541d0a/muxnect-0.2.4-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e855592f918fdf1e2e3ebbe722c7a26d", "sha256": "c8fa0954551205a59c056824d0e429283d5d3c928c9d91d2fa95a47309c5c37f" }, "downloads": -1, "filename": "muxnect-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e855592f918fdf1e2e3ebbe722c7a26d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10825, "upload_time": "2018-05-18T20:50:42", "url": "https://files.pythonhosted.org/packages/22/97/f4254a1272654be2c710df9a2340af8732327e7a4ea598a7b80350541d0a/muxnect-0.2.4-py2.py3-none-any.whl" } ] }