我正在查看使用"if(err){// code //);"的Node.js代码示例.用于控制其函数输出的语句 - 但是当调用函数时,我没有看到任何传递给它们的东西,就好像"err"参数是由幕后的隐形代码定义的......
以下代码是异步的,并使用SDK中的外部模块,如果需要注意的话.
/* "client.sendEvent" sends the data contained within the variable "message"
to its destination, when this is complete the callback function "printResultFor"
is called and a string is passed to that */
client.sendEvent(message, printResultFor('Message'));
//printResultFor looks like this:
var printResultFor = function (op) {
return function printResult(err, res) {
if (err) console.log(op + ' error: ' + err.toString());
if (res) {
console.log(op + ' status: ' + res.constructor.name);
};
};
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:
和
我正在尝试创建一个简单的规则,当“MZ”是 HTTP 正文中的前两个字符时发出警报。
我目前的规则是:
alert tcp any any -> any any (msg:"Test"; content:"MZ"; depth: 2; http_client_body; sid:51; rev:1;)
Run Code Online (Sandbox Code Playgroud)
但是,尽管“MZ”确实存在于 HTTP 正文中,但仍找不到任何结果。
非常感谢您的帮助。