Python Wrapper
The Exegol project regroups many things (docker images, offline resources, custom configurations, aliases, history commands, multi-architecture support and many others). In order to make all the tech involved easy to use, and provide some unique entrypoint to the whole setup, a Python wrapper was created.
The Python wrapper handles all Docker and Git operations, can manage multiple images and containers at once and give the user the best experience possible, suited for beginners as well as advanced people.
The wrapper knows multiple actions.
Install an image :
exegol install
Create/start/enter a container :
exegol start
Show info on containers and images :
exegol info
Stop a container :
exegol stop
Remove a container :
exegol remove
Uninstall an image :
exegol uninstall
Get help and advanced usage :
exegol --help
Help and examples can be obtained for each action directly from the wrapper with the following command:
exegol <action> -h
(action:install
/start
/stop
/etc.).
All actions are documented in the exegol-wrapper part of this doc (e.g. info, start, version, …)
Below is a, non-exhaustive, list of what the wrapper supports:
Feature |
Description |
---|---|
Sharing of the graphic environment between the container and the host |
|
Persistent and shared workspace with the host |
|
Permission sharing between the container and the host |
|
Opening an isolated VPN tunnel dedicated to the exegol container |
|
Recording of sessions (input and output) in log files with date and time |
|
Sharing the host’s network interfaces |
|
Sharing the host’s timezone configuration |
|
Easy access to a collection of resources and tools |
|
User space dedicated to customization |
|
Support for specific volume addition |
|
Support for port publishing |
|
Support for environment variable configuration |
|
Support for hardware sharing |
|
Support for customizing a specific container hostname |
|
User can add any text comments to the container |
|
Support for adding specific capabilities |
|
Support of the privileged mode |
|
Support for AMD64 and ARM64 architectures |
|
Customized local image building |
|
Pre-built image available for download |
|
Execution of specific command |
|
Support of the command execution in the background |
|
Support for command execution in a dedicated and temporary environment |
Note
Exegol uses Docker images and containers. Understanding the difference is essential to understand Exegol.
image: think of it as an immutable template. They cannot be executed as-is and serve as input for containers. It’s not possible to open a shell in an image.
container: a container rests upon an image. A container is created for a certain image at a certain time. It’s possible to open a shell in a container. Careful though, once a container is created, updating the image it was created upon won’t have any impact on the container. In order to enjoy the new things, a new container must be created upon that updated image.
Features
The Exegol wrapper has many features to automatically and transparently manage different configurations to facilitate the use and creation of docker containers.
Display sharing
By default exegol configures the new container and host to allow the execution to the display of graphical window launched from an exegol container.
For example, if bloodhound is launched in an exegol container, the graphical window (GUI) will be displayed in the user’s graphic environment.
This feature can be disabled manually with the option --disable-X11
of the start action.
Workspace
Exegol always creates within a container a persistent workspace (even after deleting the container) and shared with the host.
By default a folder will be created on the host and shared with the container. This folder will be created in ~/.exegol/workspaces/
with the name of the exegol container.
Tip
The default location of workspace volumes can be changed in the configuration of Exegol.
The user can also create an Exegol container with an existing custom workspace folder (with already existing data) regardless of its location in the file system.
See the options -w WORKSPACE_PATH
and -cwd
of the start action for more details.
Update-fs
The root user is used by default in Exegol containers which poses problems of permissions when accessing the project documents from the host. To remedy this without compromising, a shared permission system exists allowing the host user to have read and write access to files created from the container.
This system is automatically activated when a new default workspace is created.
Warning
When the user uses an existing custom folder as workspace, this system is disabled by default! This feature can be enabled by default by changing the configuration of Exegol.
Its activation is possible manually (see the option --update-fs
of the start action) but it will lead to the modification of the folder and its sub-folders permissions (as g+rws
).
If the user does not have the rights to perform such an operation, a sudo command will be proposed to the user that he will have to execute manually to apply the necessary permissions for the proper functioning of the functionality (as chgrp
+ g+rws
).
Tip
When the default configuration of this feature is changed and the update will be enabled by default, the option --update-fs
can still be used to manually disable the feature in specific cases.
OpenVPN connection
Exegol supports OpenVPN tunnel configuration to automatically establish a VPN tunnel at container startup.
Exegol supports certificate authentication (all files should preferably be included in a single ovpn file) but also user/password authentication through an authentication file (to allow non-interactive and transparent authentication).
Tip
A folder can also be used in the case of a multi-file configuration (with relative paths!) and the configuration file must have the .ovpn
extension (Only one .ovpn file will be loaded by exegol).
See the options --vpn VPN
and --vpn-auth VPN_AUTH
of the start action for more details.
Tip
In case of problem, to troubleshoot a VPN connection, the log of OpenVPN can be retrieved within the container in the /var/log/exegol/vpn.log
file
Shell logging
Within the framework of a mission, it is necessary to log all actions performed during a pentest, red team etc. To meet this need, Exegol has a feature to automatically record everything that is displayed (stdout / stderr) but also all entries (stdin).
See the option --log
of the start action to enable the feature.
Hint
When the option is enabled upon creation of a new container, all shells created for this container will be automatically logged.
If the container was created without this option, the shells can still be logged individually by adding the option in the start command of each shell.
The date and time of each command is displayed thanks to the PS1 of zsh
.
The logs are automatically saved in the /workspace/logs
folder. Each log file is automatically compressed with gzip
at the end of the session to optimize disk space.
The automatic compression of log files can be disabled manually with the start action --log-compress
parameter or change the default behavior in the Exegol configuration file.
Hint
When the default configuration of the log compression is changed from the config file and the feature will be disabled by default, the option --log-compress
can still be used to manually enable the feature in specific cases.
Warning
The logs should NOT be consulted from the exegol container but from the host to avoid loops and duplication of data in the logs.
There are (since exegol images version 3.0.0
) different methods of shell logging.
The shell logging method can be selected manually with the start action --log-method
parameter or by default in the configuration file of Exegol.
The shell logging method asciinema is available from exegol images version 3.0.0
.
This new mode allows to consult sessions in video format taking into account the interactive environment.
It is also possible to manually upload and share recordings, useful for demonstrations for example
Here is a quick demonstration:
Tip
Logs in .gz
format can be replay directly without unpacking them with the command: gunzip -c <filename_shell.asciinema.gz> | asciinema play -
Hint
To display the whole session without the “video” mode, it is possible to use the command: asciinema cat <filename_shell.asciinema>
Warning
Major disadvantage of this method, to view the logs from your host, you must install asciinema
on your host machine to replay or share your records.
Tip
When you share or play an asciinema
video, you can copy and paste any command/text it contains.
script is the “classic” method of session logging, it was also the only option available before version 3.0.0
of exegol images.
This method simply records all incoming (stdin) and outgoing (stdout/stderr) shell actions in a file.
Tip
Logs in .gz
format can be viewed directly without unpacking them with the zcat
, zgrep
, zdiff
or zmore
command!
Warning
Shell logging saves EVERYTHING including keyboard shortcuts, display refreshes, etc.
Complex graphical environments (such as tmux) can make it difficult to read the logs.
Exegol-resources
To save time and have at hand many tools, scripts and other resources, exegol maintains a repository exegol-resources contains many updated tools that are available to the host and exegol containers.
This module is not mandatory and can be downloaded later.
Hint
If an antivirus is present on your host, be careful to exclude the destination folder of the exegol-resources
module before downloading it.
This feature is active and shared by default and can be disabled with the option --disable-exegol-resources
of the start action.
My-resources
The my-resources feature is a space dedicated to the user and shared with all the containers. This space allows to store configurations and to install personal tools.
More details on the functionality of the wrapper here and how to take advantage of the customization system here.
Volume sharing
For specific needs, the exegol wrapper allows to add additional custom volumes (type bind mounts) when creating an exegol container.
See the option --volume VOLUMES
of the action start for more details.
Port sharing
When the host network is not shared, it is still possible to publish specific ports to expose services or port ranges.
Hint
This configuration is compatible even with installations based on Docker Desktop.
This feature allows the user to select:
a specific network interface (for example 127.0.0.1) or by default all interfaces (0.0.0.0).
the port to open on the host interface.
the destination port to be linked in the container.
the protocol to use, docker supports
TCP
,UDP
andSCTP
protocols (default is TCP).
See the option --port PORTS
of the start action for more details.
Env. variables
Exegol can configure custom environment variables defined by the user.
When the environment variables are defined at the first time of the container creation, these variables will be:
accessible in the container by all processes
present during the whole lifetime of the container
The environment variables can be defined when opening a shell in an existing container and will be available only in the user’s shell until it is closed.
See the option --env ENVS
of the start action for more details.
Device sharing
For the needs of some applications running on physical hardware (such as proxmark3), exegol can supply the container with one or more physical devices.
See the option --device DEVICES
of the start action for more details.
Warning
This feature is only available on Linux installations!
Windows and MacOS installations are subject to the constraints and limitations of Docker Desktop.
Custom hostname
In some environments with OPSEC requirements, it may be necessary to change the hostname of your exegol container.
See the option --hostname HOSTNAME
of the start action for more details.
Capabilities
Exegol supports adding Linux capabilities to the Exegol container to perform tasks that require administrative rights without allowing everything.
This feature gives control to the user to configure his container but giving administrator rights remains a dangerous practice and should be used by experienced users only.
For more details on the capabilities supported by docker check here.
Warning
Not all Linux capabilities are allowed by the Exegol wrapper, here is the list of available capabilities:
NET_ADMIN, NET_BROADCAST, SYS_MODULE, SYS_PTRACE, SYS_RAWIO, SYS_ADMIN, LINUX_IMMUTABLE, MAC_ADMIN, SYSLOG
For all other needs, consider the privileged mode.
Privileged
For particular needs, it is sometimes necessary to have privileged rights to perform certain actions. If Exegol does not allow you to have specifically the rights necessary, you can configure your container in privileged mode to get full administrator rights.
Warning
This configuration is particularly dangerous because it gives the container full admin control over the kernel of the host machine.
Use this option only if you know exactly what you are doing!!
If the need is specifically identified, consider adding capabilities instead!
See the option --privileged
of the start action for more details.
Multi-architecture
Exegol supports ARM64
architecture (in addition to the classic AMD64
) since version 4.1.0
of the wrapper and 3.0.0
of the images.
This support allows you to fully use exegol on hardware equipped with an ARM processor (such as Mac M1 / M2 but also some Raspberry Pi).
Warning
Exegol only supports 64-bit ARM architecture! If your ARM processor supports 64-bit, make sure your OS is also installed in 64-bit version to use exegol!
Tip
For experienced users or developers, it is possible to explicitly modify the architecture used by the Exegol wrapper with the general option --arch ARCH
.
But be careful, the modification of this parameter can lead to malfunctions!
Local image building
The wrapper allows users to locally build their images from the exegol-images
sources.
More information in the advanced uses section.
Remote image pulling
To save time, pre-built images are available for download from DockerHub. These images can be downloaded and installed / updated from the exegol wrapper with the install and update actions.
Command execution
The Exegol wrapper does not only allow the opening of interactive shells, it is also possible to execute single commands in several ways.
Tip
To see the execution logs of the command, the user must add the parameter -v
.
The details of this functionality are detailed in the exec action.
Daemon execution
One of the execution modes can be in the background like a daemon service. In this way the wrapper executes the user’s command, for example an application such as bloodhound. The wrapper launches the task in an exegol container and finishes immediately without occupying the user’s terminal, leaving the application open.
See the option --background
of the exec action for more details.
Temporary containers
Another feature of the exec action is the execution in a temporary container.
In this mode, a temporary container will be created and dedicated to the execution of the command specified by the user.
This mode can be useful to run a given command with the most up-to-date image already installed on the host, for any test or for special privacy needs.
See the option --tmp
of the exec action for more details.
Comments
To add more context information about an exegol container, it is possible to add comments to each Exegol container. The comment of an exegol container can be displayed with the command
exegol info <container_name>
See the option
--comment COMMENT
of the start action for more details.