How do I run the system commands in javascript?

后端 未结 5 820
执念已碎
执念已碎 2020-12-06 06:08

I need to list all the files in the javascript such as \"ls\"??

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 06:42

    The short answer is - you should NOT do this as it opens a huge attack vector against your application. Imagine someone running "rm -rf" :).

    If you MUST do this and you are 1000% sure you allow only a few commands which cannot cause any harm you can call a server page using Ajax. That page could run the specified command and return response. Again I emphasize this is a huge security risk and should better NOT be done.

提交回复
热议问题