PDA

View Full Version : root privilege libpcap Elevation Problem mac os x



abiusx
24th January 2011, 12:52
I'm trying to do a sniffer in Qt 4.7 (Mac OS X 10.6.6), already added

QMAKE_LFLAGS += -lpcap



to .pro file. The problem is, libpcap can only access network devices when whole application is run with root privileges, So everytime I run the program in Qt Creator, it fails and closes. If I run it with

sudo open QtCap.app

in terminal, It fades as well. Same happens when Qt Creator is run with sudo open.

Only if I run the terminal app:

sudo /QtCap.app/Contents/MacOs/QtCap

It will work alright, which is not an acceptable solution since I can't easily develop and debug in this mode.

The thing I think i need is, Elevating program when its being run and gaining root privileges, Then initiating libpcap.

Mac OS X Snow Leopard 10.6.6 64 bit (32 bit kernel loaded)
Last available version of libpcap
Qt SDK 4.7

Regards
AbiusX