Answer the question
In order to leave comments, you need to log in
Why is the output through JS Socket and telnet/nc different?
There is a fairly simple task: devices (radio towers) are given that have only Telnet from the interaction interfaces, physically. There is a task to remove logs from them in real time, i.e. after entering certain commands, she starts to issue information about what is happening to her.
I dashed a script on JS, BUT for some reason the output "rides" and some left symbols appear.
For example, if you remove the log with telnet or nc, it will be something like this:
const NetcatClient = require("netcat/client");
const client = new NetcatClient();
client
.addr("192.168.10.10")
.port(23)
.connect();
client.on("connect", () => {
console.log("Connected!");
});
client.on("data", data => {
console.log(data.toString());
data = data.toString().split(/\r\n/gm);
data.forEach(value => {
switch (value.trim()) {
case "VxWorks login:":
client.send("bts\n");
break;
case "Password:":
client.send("12345678\n");
break;
case "->":
// Основное приглашение
client.send("reDirect 0\n");
break;
default:
// console.log(data);
break;
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question