Commands

Demo Link

  1. Create a route /commands that takes in an input box that lets you execute commands directly on your server.
  2. You must be able to see the response on the page.
  3. Use execFile or spawn function from Node's child_process library to execute the command.
  4. To protect your code from malicious users, you should only allow these commands: ls, cat, pwd.

P.S.: The child_process library also includes a exec function which takes a string containing the entire command to execute. This potentially may be used to trigger arbitrary command execution, and so, it's a unsafer alternative.