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://codercto.com/soft/d/3582.html

复杂:信息时代的连接、机会与布局

复杂:信息时代的连接、机会与布局

罗家德 / 中信出版集团股份有限公司 / 2017-8-1 / 49.00 元

信息科技一方面创造了人们互联的需要,另一方面让人们在互联中抱团以寻找归属感,因此创造了大大小小各类群体的认同和圈子力量的兴起,即互联的同时又产生了聚群,甚至聚群间的相斥。要如何分析这张网?如何预测它的未来变化?如何在网中寻找机会,实现突围?本书提出了4个关键概念──关系、圈子、自组织与复杂系统: • 关系 关系是人与人的连接,又可以被分为强关系和弱关系。强关系就是和你拥有亲密关系的人,......一起来看看 《复杂:信息时代的连接、机会与布局》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具