RemCom
RemCom copied to clipboard
remcom doesn't use buffered output
on windows, because python always assumes that you are using a bufferd command window, it will not start in interactive mode and rely on the cmd window to flush the output to the user.. when you are running from a windowless application that spawns a process with the CREATE_NO_WINDOW, there is no cmd window to flush the output for you. In python you can start the interpreter in interactive mode by using the -i parameter. example.... impacket-0.9.10\examples>C:\Python27\python.exe psexec.py myhost/Administrator:mypassword@myhost C:\Windows\System32\cmd.exe /c python -i will flush it's output the way it is suppose to. <<RemComSvc.cpp >> if ( CreateProcess( NULL, szCommand, NULL, NULL, TRUE, pMsg->dwPriority | CREATE_NO_WINDOW, NULL, pMsg->szWorkingDir[0] != _T('\0') ? pMsg->szWorkingDir : NULL, &si, &pi ) ) I wonder if there is a fix that we can implement in remcom that would tell the pipes to continuously flush themselves at regular intervals like a normal command window will do. consider the following...
psi->hStdInput = CreateNamedPipe( szStdInPipe, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 0, 0, (DWORD)-1, &SecAttrib); http://msdn.microsoft.com/en-us/library/windows/desktop/aa365150%28v=vs.85%29.aspx What if remcom used _PIPE_READMODE_BYTE or _PIPE_READMODE_MESSAGE? Can some one ratify and confirm the issue for me?
python is just one example of a program that will not attempt to flush data to stdout in this manner. I'm sure that other programs will exist that will have problems when not being accessed from a cmd window.