Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker setup for pyrdp #66

Merged
merged 13 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ log/
*.log
test.bin
saved_files/
pyrdp_log/
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# This file is part of the PyRDP project.
# Copyright (C) 2019 GoSecure Inc.
# Licensed under the GPLv3 or later.
#

FROM ubuntu:18.04

RUN apt-get update

# Install Dependencies
RUN apt-get install python3 python3-pip -y
RUN apt-get install notify-osd dbus-x11 python3-pyqt4 -y
RUN pip3 install --upgrade setuptools cryptography
obilodeau marked this conversation as resolved.
Show resolved Hide resolved

COPY . /pyrdp

obilodeau marked this conversation as resolved.
Show resolved Hide resolved
RUN cd /pyrdp \
&& python3 setup.py install

# Create user
RUN useradd --create-home --home-dir /home/pyrdp pyrdp
USER pyrdp

WORKDIR /home/pyrdp
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ target machine.
## Table of Contents
- [Supported Systems](#supported-systems)
- [Installing](#installing)
* [Installing with Docker](#installing-with-docker)
* [Installing on Windows](#installing-on-windows)
- [Using the PyRDP MITM](#using-the-pyrdp-mitm)
* [Specifying the private key and certificate](#specifying-the-private-key-and-certificate)
Expand Down Expand Up @@ -65,6 +66,25 @@ sudo python3 setup.py install

This should install all the dependencies required to run PyRDP.

### Installing with Docker
PyRDP can be installed in a container. First of all, create the image by executing this command at the root of pyRDP (where Dockerfile is located):
```
docker build -t pyrdp .
```
Afterwards, you can execute the following command to run the container.
```
docker run <image id or name> <command i.e: pyrdp-mitm.py>
xshill marked this conversation as resolved.
Show resolved Hide resolved
```
To store the log files, be sure that your destination directory is owned by a user with a UID of 1000, otherwise you will get a permission denied error. If you're the only user on the system, you should not worry about this. Add the following option to the previous command:
```
-v <destination of the log files on the host side>:/home/pyrdp/log
```
Using the player will require you to export the DISPLAY environment variable from the host to the docker (this redirects the GUI of the player to the host screen), expose the host's network and stop Qt from using the MITM-SHM X11 Shared Memory Extension. To do so, add those options to the run command :
```
-e DISPLAY=$DISPLAY -e QT_X11_NO_MITSHM=1 --net=host
```
Keep in mind that exposing the host's network to the docker can compromise the isolation between your container and the host. If you plan on using the player, X11 forwarding using an SSH connection would be a more secure way.

obilodeau marked this conversation as resolved.
Show resolved Hide resolved
### Installing on Windows
If you want to install PyRDP on Windows, note that `setup.py` will try to compile `ext/rle.c`, so you will need to have
a C compiler installed. You will also need to generate a private key and certificate to run the MITM.
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# This file is part of the PyRDP project.
# Copyright (C) 2019 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
# This is an example of how you could use pyRDP with docker-compose.

version: "3"
services:
pyrdp:
build: .
# Uncomment this section only if you want to run the player.
# This allows the GUI of the player to be displayed on the host screen and
# stops Qt from using the MITM-SHM X11 Shared Memory Extension.
#environment:
# - DISPLAY
obilodeau marked this conversation as resolved.
Show resolved Hide resolved
# - QT_X11_NO_MITSHM=1
# This exposes the host's network to the docker. Keep in mind this could be dangerous if you deploy
# the tool for a honeypot on the internet.
#network_mode: "host"
volumes:
# The path before the ':' is the destination of the log on the host side.
- ./pyrdp_log:/home/pyrdp/log
# Place the command you want to execute here:
# ex: pyrdp-player.py
command: ["pyrdp-player.py"]