How to use node-opcua-packet-analyzer - 7 common examples

To help you get started, we’ve selected a few node-opcua-packet-analyzer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / message_builder.ts View on Github external
private _safe_decode_message_body(fullMessageBody: Buffer, objMessage: any, binaryStream: BinaryStream) {
        try {
            // de-serialize the object from the binary stream
            const options = this.objectFactory;
            objMessage.decode(binaryStream, options);
        } catch (err) {
            console.log(err);
            console.log(err.stack);
            console.log(hexDump(fullMessageBody));
            analyseExtensionObject(fullMessageBody, 0, 0);

            console.log(" ---------------- block");
            let i = 0;
            this.messageChunks.forEach((messageChunk) => {
                console.log(" ---------------- chunk i=", i++);
                console.log(hexDump(messageChunk));
            });
            return false;
        }
        return true;
    }
}
github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / server / server_secure_channel_layer.ts View on Github external
channelId: this.securityToken.channelId,
            chunkSize: this.transport.receiveBufferSize,
            requestId,
            tokenId: this.securityToken.tokenId
        };

        const securityOptions =
            msgType === "OPN" ? this._get_security_options_for_OPN() : this._get_security_options_for_MSG();
        options = _.extend(options, securityOptions);

        response.responseHeader.requestHandle = request.requestHeader.requestHandle;

        /* istanbul ignore next */
        if (0 && doDebug) {
            console.log(" options ", options);
            analyze_object_binary_encoding(response as any as BaseUAObject);
        }

        /* istanbul ignore next */
        if (doTraceMessage) {
            console.log(
                chalk.cyan.bold("xxxx   >>>> ---------------------------------------- "),
                chalk.green.bold(response.schema.name),
                requestId
            );
            console.log(response.toString());
            console.log(chalk.cyan.bold("xxxx   >>>> ----------------------------------------|\n"));
        }

        if (this._on_response) {
            this._on_response(msgType, response, message);
        }
github node-opcua / node-opcua / packages / node-opcua-secure-channel / src / server / server_secure_channel_layer.js View on Github external
};

    assert(options.secureChannelId > 0);

    const security_options =
        msgType === "OPN" ? self._get_security_options_for_OPN() : self._get_security_options_for_MSG();
    options = _.extend(options, security_options);

    //xx assert(_.isFinite(request.requestHeader.requestHandle));

    response.responseHeader.requestHandle = request.requestHeader.requestHandle;

    /* istanbul ignore next */
    if (0 && doDebug) {
        console.log(" options ", options);
        analyze_object_binary_encoding(response);
    }

    //xx console.log(" sending request ".bgWhite.red,requestId,message.request.constructor.name);

    /* istanbul ignore next */
    if (do_trace_message) {
        console.log(
            "xxxx   >>>> ---------------------------------------- ".cyan.bold,
            response._schema.name.green.bold,
            requestId
        );
        console.log(response.toString());
        console.log("xxxx   >>>> ----------------------------------------|\n".cyan.bold);
    }

    if (self._on_response) {
github node-opcua / node-opcua / packages / node-opcua-secure-channel / src / message_builder.js View on Github external
MessageBuilder.prototype._safe_decode_message_body = function (full_message_body, objMessage, binaryStream) {
    try {
        // de-serialize the object from the binary stream
        const options = this.objectFactory;
        objMessage.decode(binaryStream, options);
    }
    catch (err) {
        console.log(err);
        console.log(err.stack);
        console.log(hexDump(full_message_body));
        packet_analyzer(full_message_body);

        console.log(" ---------------- block");
        let i=0;
        this.message_chunks.forEach(function (messageChunk) {
            console.log(" ---------------- chunk i=",i++);
            console.log(hexDump(messageChunk));
        });
        return false;
    }
    return true;
};
github node-opcua / node-opcua / packages / node-opcua-secure-channel / test_helpers / mock / mock_transport.ts View on Github external
}
                assert(replies.length >= 1, " expecting at least one reply " + JSON.stringify(reply));
                replies.forEach((reply1: any) => {
                    debugLog("\nFAKE SERVER SEND");
                    debugLog(chalk.red(hexDump(reply1)));
                    this._mockTransport.server.write(reply1);
                });

            } else {
                const msg = " MockServerTransport has no more packets to send to client to" +
                  " emulate server responses.... ";
                console.log(chalk.red.bold(msg));
                console.log(chalk.blue.bold(hexDump(data)));

                display_trace_from_this_projet_only();
                analyseExtensionObject(data, 0, 0, {});

                this.emit("done");
            }
        });
    }
github node-opcua / node-opcua / packages / node-opcua-secure-channel / test_helpers / verify_message_chunk.ts View on Github external
messageBuilder.on("full_message_body", (fullMessageBody: Buffer) => {
        console.log("full_message_body received:");
        analyseExtensionObject(fullMessageBody, 0, 0);
    });
    messageBuilder.on("start_chunk", (info) => {
github node-opcua / node-opcua / packages / node-opcua-secure-channel / test_helpers / verify_message_chunk.js View on Github external
messageBuilder.on("full_message_body", function (full_message_body) {
        console.log("full_message_body received:");
        packet_analyzer(full_message_body);
    });
    messageBuilder.on("start_chunk", function (info, data) {

node-opcua-packet-analyzer

pure nodejs OPCUA SDK - module packet-analyzer

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis