本文介绍了Ruby / Python / REXX作为MUCK脚本语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有兴趣使用现成的解释语言作为MUCK的用户可访问的脚本语言。我只是不确定我是否能找到能满足我需要的一切的b $ b。 MUCK必须能够调用解释器并用它执行脚本,但解释器 也必须能够调用MUCK代码中的函数。然后有一个真正让我担心的安全问题是 。 。 。我必须能够限制解释器可以执行的内容。我不能让我的用户运行 脚本访问控制台,直接访问文件系统或套接字 ,或者调用MUCK之外的库或其他二进制文件。 /> 这实用吗?我正在考虑Ruby或Python,如果他们 可以满足要求。 我甚至可以考虑使用REXX。 。 。我记得我的Amiga时代的ARexx, 以及字符串操作和应用程序脚本的好坏。 但是。 。 。我的直接目标平台Mac OS X附带Ruby 和Python而不是REXX,所以这是一个缺点。 我的最终选择是创建我自己的语言插件,我可以控制所发生的一切。这就是MUCKs过去常做的。但结果总是古怪,有限的语言,如MUF(多用户Forth),这真的关闭了很多 编码器。此外,我之前从未创造过一种语言,而且它对我来说将是一项额外的工作。 - Tony Belding,Hamilton TexasI''m interested in using an off-the-shelf interpreted language as auser-accessible scripting language for a MUCK. I''m just not sure if Ican find one that does everything I need. The MUCK must be able tocall the interpreter and execute scripts with it, but the interpretermust also be able to call functions in the MUCK code. And then there''sthe security issue that really worries me. . . I have to be able tolimit what the interpreter can execute. I can''t have my users runningscripts that access the console, access the filesystem or socketsdirectly, or call libraries or other binaries outside the MUCK.Is this practical? I''m thinking of Ruby or Python for this, if theycan meet the requirements.I might even consider REXX. . . I remember ARexx from my Amiga days,and how great it was for string manipulation and application scripting.However. . . My immediate target platform, Mac OS X, comes with Rubyand Python but not REXX, so that''s a disadvantage.My final option would be to create my own language interpeter where Ihave control over everything that happens. That is what MUCKs havealways done in the past. But the result was always quirky, limitedlanguages like MUF (Multi-User Forth) which really turn off a lot ofcoders. Furthermore, I''ve never created a language before, and itwould be a lot of extra work for me.--Tony Belding, Hamilton Texas推荐答案 使用_why'的沙箱 包( http://code.whytheluckystiff.net/sandbox/) 。对于MUCK a 自定义语言可能会更好 - 为任何 创建沙箱传统语言可能太昂贵而无法重复 $ b $每隔一千个物体。一种自定义语言可以使它更容易管理安全性,同时保持良好的性能。Sandboxing is possible in recent versions of Ruby using _why''s sandboxpackage (http://code.whytheluckystiff.net/sandbox/). For a MUCK acustom language might be better though - creating sandboxes for anyconventional language is likely to be too expensive to repeat for athousand objects at regular intervals. A custom language would make itmuch easier to manage security while retaining decent performance. Python有一个沙箱模块,但由于安全问题而被丢弃了 问题。 如果你想在MacOS上运行它,你也可以看一下Tcl,它在MacOS上有很长的传统,它带有非常好的实现和完全的可定制的沙箱。首先,如果Tcl沙箱符合您的 要求,请查看此处: 安全Tcl概述: http://www.tcl.tk/software/plugin/safetcl.html 关于特定Tcl命令的文档,用于创建安全的解释器: http://www.tcl.tk/man/tcl8.4/TclCmd/interp.htm (参见 下三分之一页面atSafe Interpreters) http ://www.tcl.tk/man/tcl8.4/TclCmd/safe.htm 问候 StephanPython had a sandbox module, but is was discarded because of securityproblems.If you want it working on MacOS, you may also have a look at Tcl, which hasa long tradition on MacOS and it comes with a very good implemented andfully customizable sandbox. For a starting point, if Tcl sandbox meets yourrequirements, have a look here:Safe Tcl Overview: http://www.tcl.tk/software/plugin/safetcl.htmlDocs about the specific Tcl commands, to create safe interpreters: http://www.tcl.tk/man/tcl8.4/TclCmd/interp.htm (See in the lower third ofthe page at "Safe Interpreters") http://www.tcl.tk/man/tcl8.4/TclCmd/safe.htmRegardsStephan 这将成为杀手...... Python不再附带安全沙箱。模块,因为总有办法解决它。 That is going to be the killer... Python no-longer ships with a"secure sandbox" module, because there were always ways to work aroundit. 这篇关于Ruby / Python / REXX作为MUCK脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 15:54