封装8开源传感器python grpc绑定
capsule8的Python项目详细描述
capsule8 api python
此repo作为Capsule8传感器api的包装repo。
使用PIP安装
pip install capsule8
使用virtualenv安装
virtualenv test_capsule8
cd test_capsule8
source bin/activate
pip install capsule8
示例
为了运行这些示例,您需要在机器上安装一个正在运行的capsule8传感器。一旦你有一个运行传感器,你可以运行的例子。确保胶囊8传感器插座被当前用户咬碎。
sudo chown $USER /var/run/capsule8/sensor.sock
然后您可以运行sensorclient并开始流式胶囊8传感器遥测。在本例中,每个进程事件pid都将打印到stdout
from capsule8.sensor import SensorClient
from itertools import islice
s = SensorClient()
s.subscribe({"event_filter": {
"process_events": [
{"type": "PROCESS_EVENT_TYPE_FORK"},
{"type": "PROCESS_EVENT_TYPE_EXEC"},
{"type": "PROCESS_EVENT_TYPE_EXIT"}
]
}})
max_events = 5
for event in islice(s.telemetry(), max_events):
print(event.events[0].event.process_pid)