Node-web-console (hereinafter referred to as NWC) is a Web shell application developed based on Node.js. Its idea comes from a group discussion of SDN related projects in the laboratory. The requirement is to embed shell in Web pages roughly. Then the virtual machine node can be directly managed from the network topology displayed on the front page. The implementation is based on Web-Console, a project developed in one of the world’s best languages.

Here’s a screenshot of the interface:

In terms of experience, NWC is not that different from the real shell. This is, of course, thanks to the efforts of the jquery.terminal plugin. In terms of implementation principles, NWC (and Web-console) are not complicated. The underlying communication is based on the JSON-RPC 2.0 specification on top of HTTP. Json-rpc is a stateless and lightweight remote procedure call (RPC) protocol. The backend server of NWC receives the command input from the user, starts the child process, executes it, and returns the result.

In addition, NWC has the following features:

  • Easy to configure. NWC is developed based on Node.js, install dependency -> start server -> done! It is very convenient
  • Mobile-friendly. After NWC is deployed, mobile devices can access the page and perform operations (at the expense of automatic completion and other functions), so that they can access their own servers anytime and anywhere
  • Easy to expand. The project was developed based on Koa and used as little middleware as possible. You can easily extend it or integrate it into your own projects
  • High safety factor. Before using NWC, users need to log in, and its page is marked, and search engine index is not allowed. You can also configure HTTPS for your server to improve security even further

Of course, NWC still has some problems, for example, it cannot execute vi, ping and other commands that need to wait for user input or perform some operations indefinitely. This is because the current version of NWC’s underlying communication RPC is based on HTTP, and its characteristics determine that the server can only passively respond to the client’s request and cannot actively push the results for many times. The next iteration will attempt to address this issue by replacing HTTP with Websocket.

Finally, the project address is here: github.com/ChrisCindy/… Be direct with me). Welcome star, welcome to brick.

This article was first published on my blog (click here to view it).