SharpC2 icon indicating copy to clipboard operation
SharpC2 copied to clipboard

Fix PeekNamedPipe Method

Open Fropops opened this issue 2 years ago • 0 comments

The current use of PeekNamedPipe does not work properly. As the result of the API call to PeekNamedPipe only indicates whether the call is successful but does not provide any information about the availability of data. In the Drone program, the thread is then blocked on the "pipe.ReadStream()", preventing the loop to operate.

I changed it to effectively check the number of bytes available. Also, I added a throw when the call is not succeeding which will enable to properly close the communicator using the OnException event (I think it was already working because the pipe.ReadStream throws an exception when the pipe is closed).

Fropops avatar Jul 27 '23 12:07 Fropops