'少'linux命令的替代程序/使'少'安全

cha*_*ank 3 c linux bash less-unix

我想为Linux编写一个像'less'命令这样的交互式程序.原因我在我的设置中不能少用,因为你可以在较少提示的'!cmd'中执行shell命令,这可能是任何生产盒的主要安全风险.

我的首选语言是C,但是,如果有人可以建议任何其他类似的程序也会很棒,因为我手上有时间.

我知道一个选项是浏览较少的源代码,但看起来这在短时间内不是很直接.

cha*_*ank 9

太棒了,我在Man页面中得到了答案.您可以使用其中一个变量禁用这些内容.

安全性当环境变量LESSSECURE设置为1时,较少以"安全"模式运行.这意味着这些功能被禁用:

          !      the shell command

          |      the pipe command

          :e     the examine command.

          v      the editing command

          s  -o  log files

          -k     use of lesskey files

          -t     use of tags files

                 metacharacters in filenames, such as *

                 filename completion (TAB, ^L)

   Less can also be compiled to be permanently in "secure" mode.
Run Code Online (Sandbox Code Playgroud)