Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TrafficAnalyser.prototype.add = function (data) {
const stream = new BinaryStream(data);
if (argv.block) {
console.log(hexDump(data));
return;
}
const messageHeader = opcua.readMessageHeader(stream);
if (messageHeader.msgType === "ERR") {
var err = new s.TCPErrorMessage();
err.decode(stream);
console.log(" Error 0x" + err.statusCode.toString() + " reason:" + err.reason);
console.log(hexDump(data));
}
const messageBuild = new MessageBuilder();
messageBuild.on("full_message_body", function (full_message_body) {
console.log(hexDump(full_message_body));
try {
analyseExtensionObject(full_message_body);
}
catch (err) {
console.log("ERROR : ".red, err);
}
});
messageBuild.on("full_message_body", function (full_message_body) {
console.log(hexDump(full_message_body));
try {
analyseExtensionObject(full_message_body);
}
catch (err) {
console.log("ERROR : ".red, err);
}
});