GoSecure / pyrdp

RDP monster-in-the-middle (mitm) and library for Python with the ability to watch connections live or after the fact
https://www.gosecure.net/blog/2020/10/20/announcing-pyrdp-1/
GNU General Public License v3.0
1.47k stars 244 forks source link

pyrdp-player remote live monitoring: Port already used #473

Closed Bajiio closed 4 months ago

Bajiio commented 4 months ago

Hello, For my project I'm trying to run pyrdp-mitm on a headless server and then retrieve the live stream on my machine. Before doing that, I'm doing multiples tests, to simulate SSH port tunneling. Here is my problem: I'm running pyrdp-mitm in a docker container and try to bind the live stream port to a localhost port on my host. Then I just run pyrdp-player on my host, giving him the port as parameter. This result in a error: "Port already in use". Does anyone know why it happens ? And why, when I'm running the same command in the docker container, it works like a charm even if the same port is already in use by pyrdp-mitm ? Here is my dockerfile (maybe I'm binding port from container to host wrong, I already tried using 0.0.0.0 instead of 127.0.0.1 in the -i param): Screenshot from 2024-02-20 16-28-48 And here is the error I get when running pyrdp-player: image

Thanks in advance for your help

Bajiio commented 4 months ago

After investigating it seems like the mitm tool doesn't open any port, so only the player does it, the problem is how am I supposed to bind docker port from mitm if it doesn't open any port. Since docker bind by default this port if I open it, even if there is nothing behind I can't think of a solution.

Bajiio commented 4 months ago

After doing some research, I just misunderstood how the player and mitm modules were interacting with each others. I manage to do it by tunneling the listening port of my player to the the mitm "-d" port (MITM = SSH server / player = SSH client).

obilodeau commented 4 months ago

I'm glad you fixed it. Thanks for the update!