-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from Wenzel/python_bindings
pyapi: generate basic python bindings with PyO3
- Loading branch information
Showing
44 changed files
with
1,522 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
- [Introduction](./README.md) | ||
|
||
|
||
# Tutorial | ||
|
||
- [Introduction](./tutorial/intro.md) | ||
- [Memory dump example in Rust](./tutorial/rust.md) | ||
- [Memory dump example in C](./tutorial/c.md) | ||
- [Installation](./tutorial/installation.md) | ||
- [Packaged](./tutorial/packaged.md) | ||
- [Source](./tutorial/source.md) | ||
- [Memory dump example on Xen](./tutorial/mem-dump-example.md) | ||
- [Rust](./tutorial/rust.md) | ||
- [C](./tutorial/c.md) | ||
- [Python](./tutorial/python.md) | ||
- [Integration](./tutorial/integration.md) | ||
- [volatility3](./tutorial/integration/volatility3.md) | ||
|
||
# Reference | ||
|
||
- [API](./reference/api.md) | ||
- [Build Options](./reference/build_options.md) | ||
- [Python API](./reference/python_api.md) | ||
- [Drivers](./reference/drivers.md) | ||
- [Integration Status](./reference/integration_status.md) | ||
|
||
# Explanation | ||
|
||
- [VMI API](./explanation/vmi_api.md) | ||
- [VMI Fragmentation](./explanation/vmi_ecosystem.md) | ||
|
||
# Developer | ||
|
||
- [Python](./developer/python.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Python Bindings | ||
|
||
## Nox | ||
|
||
The project uses [Nox](https://nox.thea.codes/en/stable/) to facilite and automate the developer workflow. | ||
Please install this tool before you start | ||
|
||
Running `nox` without any argument will run the default sessions. | ||
|
||
## Generating the Wheels | ||
|
||
Distributing a Python native extension compatible with many systems and a large set of Python interpreters is a challenging task. | ||
|
||
The [manylinux](https://github.com/pypa/manylinux) project comes to the rescue here. | ||
|
||
The extension is built based on the [`manylinux2014`](https://www.python.org/dev/peps/pep-0599/) platform tag. | ||
|
||
Generation of the wheels is managed by `nox` and requires [`Docker`](https://www.docker.com/) to build a custom manylinux2014 CentOS image, and | ||
execute the script inside it. | ||
|
||
To start the generation: | ||
|
||
~~~ | ||
$ cd libmicrovmi/python | ||
$ nox -r -s generate_wheels -- --features xen | ||
~~~ | ||
|
||
you can activate more drivers | ||
|
||
~~~ | ||
$ nox -r -s generate_wheels -- --features xen,kvm,virtualbox | ||
~~~ | ||
|
||
and enable the release mode as well | ||
|
||
~~~ | ||
nox -r -s generate_wheels -- --features xen --release | ||
~~~ | ||
|
||
After the execution, the wheels will be available in `libmicrovmi/python/dist/manylinux`. | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Drivers | ||
|
||
This section documents the drivers available and the requirements to compile them. | ||
|
||
## Features | ||
|
||
| Feature | Description | | ||
|--------------|-----------------------------| | ||
| `xen` | Build the Xen driver | | ||
| `kvm` | Build the KVM driver | | ||
| `virtualbox` | Build the VirtualBox driver | | ||
| `hyper-v` | Build the Hyper-V driver | | ||
|
||
Example | ||
~~~ | ||
$ cargo build --features xen,kvm | ||
~~~ | ||
|
||
## Xen | ||
|
||
~~~ | ||
$ sudo apt install clang libxen-dev | ||
~~~ | ||
|
||
Compatibility: Xen >= 4.11.0 | ||
|
||
## KVM | ||
|
||
The KVM driver depends on [libkvmi](https://github.com/bitdefender/libkvmi) | ||
|
||
~~~ | ||
$ git clone https://github.com/bitdefender/libkvmi.git | ||
$ cd libkvmi | ||
$ git checkout bf5776319e1801b59125c994c459446f0ed6837e | ||
$ ./bootstrap | ||
$ ./configure | ||
$ make | ||
$ sudo make install | ||
~~~ | ||
|
||
## VirtualBox | ||
|
||
The VirtualBox driver depends on [libFDP](https://github.com/thalium/icebox/tree/master/src/FDP) | ||
|
||
~~~ | ||
$ git clone --depth 1 https://github.com/thalium/icebox | ||
$ cd icebox/src/FDP | ||
$ g++ -std=c++11 -shared -fPIC FDP.cpp -o libFDP.so | ||
$ sudo mv include/* /usr/local/include/ | ||
$ sudo mv libFDP.so /usr/local/lib/ | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Python API | ||
|
||
### Initializing libmicrovmi | ||
|
||
~~~Python | ||
from microvmi import Microvmi | ||
|
||
micro = Microvmi("Windows10") | ||
~~~ | ||
|
||
### Specifying the hypervisor | ||
|
||
~~~Python | ||
from microvmi import Microvmi, DriverType | ||
|
||
micro = Microvmi("Windows10", DriverType.XEN) | ||
~~~ | ||
|
||
### Adding driver initialization parameters | ||
|
||
~~~Python | ||
from microvmi import Microvmi, DriverType, DriverInitParam | ||
|
||
init_param = DriverInitParam.kvmi_unix_socket("/tmp/introspector") | ||
micro = Microvmi("Windows10", DriverType.KVM, init_param) | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Installation | ||
|
||
This section will teach you how to: | ||
|
||
- install libmicrovmi either from official repositories or source code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Integration | ||
|
||
libmicrovmi aims to be combined with a great diversity of VMI projects. | ||
|
||
In this section you will find detailed tutorials to integrate and exploit your favorite tools on top of libmicrovmi. | ||
|
||
Please refer to the [Integration Status](https://wenzel.github.io/libmicrovmi/reference/integration_status.html) page for an overview of libmicrovmi's compatibility with existing integrations. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.