Python development - libyal/libluksde GitHub Wiki
libluksde comes with Python-bindings named pyluksde.
Below are examples how use pyluksde. They assume you have a working version of pyluksde on your system. To build pyluksde see Building.
Import
To be able to use pyluksde in your Python scripts add the following import:
import pyluksde
Get version
The get_version() module function can be used to retrieve the version of the pyluksde.
pyluksde.get_version()
This will return a textual string (Unicode) that contains the libluksde version. Since pyluksde is a wrapper around libluksde it does not have a separate version.
Open volume
Open a volume by path
luksde_volume = pyluksde.volume()
luksde_volume.set_password("password")
luksde_volume.open("image.raw")
...
luksde_volume.close()
The explicit call to luksde_volume.close() is not required. Close only must be called once all operations on the volume have been completed.
Open a volume using a file-like object
file_object = open("image.raw", "rb")
luksde_volume = pyluksde.volume()
luksde_volume.set_password("password")
luksde_volume.open_file_object(file_object)
...
luksde_volume.close()
The explicit call to luksde_volume.close() is not required. Close only must be called once all operations on the volume have been completed and will not close the file-like object itself.
Also see
import pyluksde
help(pyluksde)
help(pyluksde.volume)