Giter Site home page Giter Site logo

satheesh1997 / webpty Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 5.0 201 KB

A helpful package that helps you access shell & shell-based applications via web application

Home Page: https://replit.com/@satheesh1997/webpty

License: MIT License

Python 57.89% HTML 12.34% CSS 2.08% JavaScript 27.32% Procfile 0.38%
xterm-js tornado websocket pty pkg python

webpty's Introduction

webpty

Web based application to access shell & shell based applications via a browser.

PyPI version

Installation

Use pip and install webpty.

pip install webpty

Usage

webpty

Creates a tornado server which will be serving bash shell on http://localhost:8000/

Change Shell

webpty -c $SHELL

or

webpty --cmd=$SHELL

This $SHELL can be bash, sh, python, vim, wtfutil, etc. that is available in the system.

Change Port

webpty -p $PORT

or

webpty --port=$PORT

Creates a tornado server that server on the specified port http://localhost:$PORT/

Change Allowed Hosts

By default, server will accept request from all the hosts without any restriction, to make it accept only from certain hosts,

webpty -ah $ALLOWED_HOSTS

or

webpty --allowed-hosts=$ALLOWED_HOSTS

Server accepts only requests from $ALLOWED_HOSTS. This $ALLOWED_HOSTS should be list of strings seperated by a comma.

Screenshots

Bash

Online Bash Shell

Python

Online Python Shell

Vim

Online Vim

Contributing

Pull requests are welcome. Raise a issue and start a discussion before submitting a pr.

Python Powered

webpty's People

Contributors

dependabot[bot] avatar rushabhd97 avatar satheesh1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

webpty's Issues

Scroll function not working properly on browser

Describe the bug
Currently when we the scroll to the top the scrollbar is going only 1 step, but we need some infinite scroll.

To Reproduce
Steps to reproduce the behavior:

  1. Open webpty shell in browser
  2. Press enter until the cursor reaches the end of browser, press even after that
  3. Scroll up
  4. You will be able to scroll and see only 1 or 2 lines above the current screen.

Expected behavior
Ideally the should be working like the actual scroll in shell

Desktop (please complete the following information):

  • OS: all supported
  • Browser: all
  • Version: 2.0.8

Adds support to requests from multiple allowed origins

  1. Add support to command line args as -ah or --allowed-hosts which by default should be None and should only accept comma-separated strings.
  2. When a comma-separated string is passed it will allow requests only from those origins otherwise it should accept requests from all origins.
  3. Update the readme file

UnicodeDecodeError when using wtfutil shell application

Hey,

any idea what kann i do?

(webty) /t/webty webpty -c wtfutil
Server listening on http://0.0.0.0:8000
ERROR:asyncio:Future exception was never retrieved
future: <Future finished exception=UnicodeDecodeError('utf-8', b';0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                         \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[11;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                         \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[12;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                         \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[13;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                         \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[14;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                         \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[15;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                  \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\x1b[16;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\x1b[17;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                                           \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[18;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                                           \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[19;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                                           \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\x1b[20;1H\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94\x82\xe2\x94\x82\x1b(B\x1b[m\x1b[48;2;0;0;0m                                                \x1b(B\x1b[m\x1b[38;2;128;128;128;48;2;0;0;0m\xe2\x94', 4093, 4095, 'unexpected end of data')>
Traceback (most recent call last):
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/lib/python3.9/site-packages/tornado/gen.py", line 775, in run
    yielded = self.gen.send(value)
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/lib/python3.9/site-packages/webpty/server.py", line 36, in read_and_update_web_terminal
    output = os.read(options.file_descriptor, 1024 * 20).decode()
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 4093-4094: unexpected end of data
^CTraceback (most recent call last):
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/bin/webpty", line 8, in <module>
    sys.exit(main())
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/lib/python3.9/site-packages/webpty/server.py", line 130, in main
    start_server()
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/lib/python3.9/site-packages/webpty/server.py", line 102, in start_server
    tornado.ioloop.IOLoop.instance().start()
  File "/home/sam/.local/share/virtualenvs/webty-4mBFoPQF/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 199, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
    self._run_once()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1854, in _run_once
    event_list = self._selector.select(timeout)
  File "/usr/lib/python3.9/selectors.py", line 469, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt

greeting sam

Request for Real Login Page for Webpty

It would be interesting to replace the dialog box asking for a password with a real login page.

I think it might be interesting to not put the terminal on the first route / by /terminal for example and put a home or login page there, that would be really better I think.

Reserving the route / for the connection or a nice page inviting to use the terminal could be really interesting

And I think that for serious security reasons it would be necessary to have a page, it is really dangerous because anyone on a local network could execute commands from the server

--

I also suggest that from the first launch you are offered to choose a password directly from a register page:

Server responds with exception on exiting the shell application

When a shell application is closed from the webpty shell we should either reload the shell again or we should handle the exception .

Currently, the users are seeing the below error in the browser.

Traceback (most recent call last): File "webpty/server.py", line 118, in <module> main() File "webpty/server.py", line 114, in main start_server() File "webpty/server.py", line 96, in start_server tornado.ioloop.IOLoop.instance().start() File "/Users/satheesh/.pyenv/versions/3.8.2/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199, in start self.asyncio_loop.run_forever() File "/Users/satheesh/.pyenv/versions/3.8.2/lib/python3.8/asyncio/base_events.py", line 570, in run_forever self._run_once() File "/Users/satheesh/.pyenv/versions/3.8.2/lib/python3.8/asyncio/base_events.py", line 1823, in _run_once event_list = self._selector.select(timeout) File "/Users/satheesh/.pyenv/versions/3.8.2/lib/python3.8/selectors.py", line 558, in select kev_list = self._selector.control(None, max_ev, timeout) OSError: [Errno 9] Bad file descriptor

Special keys not working from 3.6 release

Describe the bug
The special keys like space, caps lock, num lock, etc are not working expected after the 3.6 release. Looks like these key actions are getting skipped.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to the web UI.
  2. Use space btn or any buttons specified.
  3. See the error

Desktop (please complete the following information):

  • OS: macOS
  • Browser [e.g. chrome, safari] chrome & safari

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.