Node-restrict

码农软件 · 软件分类 · Node.js 扩展 · 2019-04-14 18:29:44

软件介绍

Node-restrict 能够阻止应用程序使用 procss.binding('process_wrap'), process.kill 和 child_process 的 Nodejs 模块。

代码示例:

var restrict = require('restrict');
// ls is whitelisted
restrict({
    'whitelist': ['ls'],
    'whitelistPath': ['/bin']
});

//set whitelist can be invoked, if the whitelist is dynamic
restrict.setWhitelist(['grep'], ['/bin', '/usr/bin']);

var child_process = require('child_process');
try {
    // ls is whitelisted. So you can see the output of ls
    child_process.exec('/bin/ls', function (err, stdout, stderr) {
        console.log(stdout);
    });
    // grep is not whitelisted. Exception thrown
    child_process.spawn('grep', ['ssh']);
} catch (e) {
    //this will throw an error
    //[Error: Function call spawn() is prohibited in this environment.]
    console.log(e);
}
try {
    process.kill(30);
} catch (e) {
    //this will throw an error
    //[Error: Function call process.kill() is prohibited in this environment.]
    console.log(e);
}

本文地址:https://www.codercto.com/soft/d/3582.html

六度分隔

六度分隔

邓肯·J·瓦茨 / 陈禹 / 中国人民大学出版社 / 2011-3 / 46.00元

正如副标题所表明的,《六度分隔:一个相互连接的时代的科学》的基本内容是介绍一门正在形成中的新科学——关于网络的一般规律的科学。有这样一门科学吗?它的内容和方法是什么?近年来,这门学科有什么实质性的进展吗?在《六度分隔:一个相互连接的时代的科学》中,作者根据自己的亲身经历娓娓道来,用讲故事的方式,对于这些问题给出了令人信服的回答 除了简要的背景和总结以外,《六度分隔:一个相互连接的时代的科学》......一起来看看 《六度分隔》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试