libcap-ng python bindings | ||||
Back |
As of the 0.6 release, you can use libcap-ng in python. You must add this line to your program: import _capng as capng Then you can do the same 6 use cases like this: 1) Drop all capabilities
capng.capng_clear(capng.CAPNG_SELECT_BOTH) 2) Keep one capability
capng.capng_clear(capng.CAPNG_SELECT_BOTH) 3) Keep several capabilities
capng.capng_clear(capng.CAPNG_SELECT_BOTH) 4) Check if you have any capabilities
if capng.capng_have_capabilities(capng.CAPNG_SELECT_CAPS) > capng.CAPNG_NONE: 5) Check for certain capabilities
if capng.capng_have_capability(capng.CAPNG_EFFECTIVE, capng.CAP_CHOWN): 6) Retain capabilities across a uid change
capng.capng_clear(capng.CAPNG_SELECT_BOTH) |