With Wireshark, I capture a websoket packet with the below code
var device = Cap.findDevice('192.168.1.161');
var filter = 'tcp and dst port 54592';
Now I have hex stream of a packet like d5404e297c8575b980c20b32501801fcb35c0000
I want to send the packet from nodejs code, but the below code doesn't work?
var Cap = require('cap').Cap;
var c = new Cap();
var device = Cap.findDevice('192.168.1.161');
var filter = 'tcp';
var bufSize = 10 * 1024 * 1024;
var buffer = Buffer.alloc(65535);
var linkType = c.open(device, filter, bufSize, buffer);
var buffer = Buffer.from("d5404e297c8575b980c20b32501801fcb35c0000");
try {
c.send(buffer, buffer.length);
console.log("sent");
} catch (e) {
console.log("Error sending packet:", e);
}
With Wireshark, I capture a websoket packet with the below code
var device = Cap.findDevice('192.168.1.161');
var filter = 'tcp and dst port 54592';
Now I have hex stream of a packet like d5404e297c8575b980c20b32501801fcb35c0000
I want to send the packet from nodejs code, but the below code doesn't work?
var Cap = require('cap').Cap;
var c = new Cap();
var device = Cap.findDevice('192.168.1.161');
var filter = 'tcp';
var bufSize = 10 * 1024 * 1024;
var buffer = Buffer.alloc(65535);
var linkType = c.open(device, filter, bufSize, buffer);
var buffer = Buffer.from("d5404e297c8575b980c20b32501801fcb35c0000");
try {
c.send(buffer, buffer.length);
console.log("sent");
} catch (e) {
console.log("Error sending packet:", e);
}