Skip to content

Commit eddfec1

Browse files
committed
fake server: switch to headles Xvfb
1 parent 4c31b34 commit eddfec1

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

pyrdp/mitm/FakeServer.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (C) 2022
44
# Licensed under the GPLv3 or later.
55
#
6-
import os, random, shutil, socket, subprocess, threading, time
6+
import multiprocessing, os, random, shutil, socket, subprocess, threading, time
77

88
from tkinter import *
99
from PIL import Image, ImageTk
@@ -173,21 +173,18 @@ def __init__(self, targetHost: str, targetPort: int, log: LoggerAdapter):
173173
self._launch_rdp_server()
174174

175175
def _launch_display(self, width=1920, height=1080):
176-
self.display = Display(
177-
backend="xephyr",
178-
size=(width, height),
179-
extra_args=["-no-host-grab", "-noreset"],
180-
) # noreset for xsetroot required
176+
self.display = Display(backend="xvfb", size=(width, height))
181177
self.display.start()
178+
# activate environment variables
182179
self.display.env()
183180
# set background to windows blue
184-
self.xsetroot_process = subprocess.Popen(
185-
[
186-
shutil.which("xsetroot"),
187-
"-solid",
188-
BACKGROUND_COLOR,
189-
]
190-
)
181+
def background():
182+
tk = Tk()
183+
tk.geometry(f"{width}x{height}")
184+
tk.configure(bg=BACKGROUND_COLOR)
185+
tk.mainloop()
186+
187+
multiprocessing.Process(target=background).start()
191188

192189
def _launch_rdp_server(self):
193190
# TODO check if port is not already taken

0 commit comments

Comments
 (0)