# Capsule8 api-python
This repo is as a wrapper repo around the [Capsule8](https://github.com/capsule8/capsule8) sensor api.
## Install with pip
```
pip install capsule8
```
## Install with virtualenv
```
virtualenv test_capsule8
cd test_capsule8
source bin/activate
pip install capsule8
```
## Examples
In order to run the examples you need to have a running [capsule8](https://github.com/capsule8/capsule8) sensor on your machine. Once you have a running sensor you can run the examples. Be sure that the capsule8 sensor socket chowned by the current user.
```
sudo chown $USER /var/run/capsule8/sensor.sock
```
Then you can run the SensorClient and start streaming capsule8 sensor telemetry. In this example, every process events pid will be printed to 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)
```
This repo is as a wrapper repo around the [Capsule8](https://github.com/capsule8/capsule8) sensor api.
## Install with pip
```
pip install capsule8
```
## Install with virtualenv
```
virtualenv test_capsule8
cd test_capsule8
source bin/activate
pip install capsule8
```
## Examples
In order to run the examples you need to have a running [capsule8](https://github.com/capsule8/capsule8) sensor on your machine. Once you have a running sensor you can run the examples. Be sure that the capsule8 sensor socket chowned by the current user.
```
sudo chown $USER /var/run/capsule8/sensor.sock
```
Then you can run the SensorClient and start streaming capsule8 sensor telemetry. In this example, every process events pid will be printed to 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)
```
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
capsule8-1.4.tar.gz
(31.1 kB
view details)
File details
Details for the file capsule8-1.4.tar.gz.
File metadata
- Download URL: capsule8-1.4.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6607ffe72ea77424ea386c9710e18d316c03d0808e0852156475237283571d5e
|
|
| MD5 |
1a30cb67a7cec44c417a0ebdf3d0fab8
|
|
| BLAKE2b-256 |
b325c39f9ddc17d8001d5403dcfb3b9b1638702f82d03752d6ea7adf2b934c18
|