Skip to content

speed server example is not working, and crashing  #272

@sanehab

Description

@sanehab

Hey,

While trying to browse through the examples i have found that the speed_server example is not working, due to the following code, findalldevs is undefined and not a function:

const pcap_session = pcap.createSession(process.argv[2], {
  filter: process.argv[3],
})

// Print all devices, currently listening device prefixed with an asterisk
console.log("All devices:")
console.log(pcap_session)
pcap_session.findalldevs().forEach(function (dev) {
    if (pcap_session.device_name === dev.name) {
        console.log("* ");
    }
    console.log(dev.name + " ");
    if (dev.addresses.length > 0) {
        dev.addresses.forEach(function (address) {
            console.log(address.addr + "/" + address.netmask);
        });
        console.log("\n");
    } else {
        console.log("no address\n");
    }
});

also note that the following code is not doing anything since the tcp_tracker does not emit any event called http request, this event was emitted however in previous versions

tcp_tracker.on("http request", function (session, http) {
  var matches = /send_file\?id=(\d+)/.exec(http.request.url)
  if (matches && matches[1]) {
    session.track_id = matches[1]
    console.log("Added tracking for " + matches[1])
  } else {
    console.log("Didn't add tracking for " + http.request.url)
  }
})

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions