Javascript-is the shell in the webpage a real shell or something else?

Source: Internet
Author: User
I have seen some websites such as Tryit on the official Docker website. Terminal in it really sends the command to the server for execution and returns the result or how to do it? PS: I tried to write a code in PHP. The front-end submits the obtained command and PHP executes the code using exec () and other functions. DockerTry it on the official website. TerminalIs it true that the command is sent to the server for execution and the result is returned?

PS:

I tried to write one in PHP. The front-end submits the obtained command.exec()And the like. However, although some simple commands can be executed in this way, it can be said that it cannot achieve the effect of others. First, it is insecure, and second, it cannot run images.iPythonAnd other interactive environments.

Reply content:

I see some websites suchDockerTry it on the official website.TerminalIs it true that the command is sent to the server for execution and the result is returned?

PS:

I tried to write one in PHP. The front-end submits the obtained command.exec()And the like. However, although some simple commands can be executed in this way, it can be said that it cannot achieve the effect of others. First, it is insecure, and second, it cannot run images.iPythonAnd other interactive environments.

  1. First, it is clear that it is sent to the server rather than js for execution.
  2. I personally guess that it is unlikely to be a simulator, because it is necessary to re-implement almost all docker commands. It is possible that the program name is filtered out first (for example, only commands such as help and docker are allowed), and then the exec function is called.
  3. For security, you can switch to a restricted user before executing the program.

I have seen a similar jslinux, it should be a shell simulated by js (not very sure)

Http://bellard.org/jslinux/

However, there is a similar Terminal in VPS, which seems to be a real shell.

Https://github.com/jcubic/jquery.terminal. This can be real.
It's easy.

Wssh solves the problem you want [nodejs is doing well in this aspect

Docker will prompt you after entering ls-l:

This is an emulator, not a shell. Try following the instructions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.