Git Product home page Git Product logo

Comments (6)

 avatar commented on July 24, 2024 12

sudo chmod o+r /dev/bpf* should help in reading of Berkley Packet Filter.

from cap.

mscdex avatar mscdex commented on July 24, 2024

I have no idea, I don't use macos. However, the tests all run fine on macos via Travis.

from cap.

carloscuba avatar carloscuba commented on July 24, 2024

Thanks for your quick reply!
Any clues about why this can be happening? When I start the App from the terminal and using sudo it's working fine.

large

from cap.

mscdex avatar mscdex commented on July 24, 2024

Most likely a lack of permissions as the error text suggests. On most platforms you have to have special privileges to be able to start capturing packets on most network interfaces.

from cap.

robsontenorio avatar robsontenorio commented on July 24, 2024

@mscdex I have a similar problem on LINUX. I have libpcap and libpcap-dev installed.

But at

var linkType = c.open(device, filter, bufSize, buffer);

I got

Error: socket: Operation not permited

Do i need root privilege to able to start capturing packets on linux?

from cap.

mscdex avatar mscdex commented on July 24, 2024

Yes, the best solution is to start as root, start listening for packets, and then drop the privileges of the process using process.setgid() and process.setuid() to something more appropriate, such as the current user and group (or perhaps nobody/nobody). Perform these steps before doing anything else (including require()ing other non-node core modules). This way you can ensure that nothing else in the node process (e.g. third party modules) gets superuser privileges, which is good for security.

This is also a better solution than what you may find elsewhere online which may suggest to use setcap on the node executable which is a huge security issue because the same node executable is used to execute any and all scripts, not just the one using cap (and setcap can't be used on a shell script or limited to a specific node script).

from cap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.