Hack Forums
[C#] Read StdOut/Command Line from External Process? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Read StdOut/Command Line from External Process? (/showthread.php?tid=4993722)



Read StdOut/Command Line from External Process? - Cesar Morales - Sep 19, 2015

Basically I need to read the command line/stdout of a process that wasn't created by my application. My process is .NET and the one I am trying to read is native.

Does anyone know how to do this?


* - BahNahNah - Sep 19, 2015

I dont think you can do it if you diddnt start the process.


* - Cesar Morales - Sep 19, 2015

(Sep 19, 2015 07:14 PM)BahNahNah Wrote:  I dont think you can do it if you diddnt start the process.

Not even being able to hook it and intercept the stdout?


(Sep 19, 2015 07:14 PM)BahNahNah Wrote:  I dont think you can do it if you diddnt start the process.

Also I am using a RunPE to create the process. Does that make it possible to read?


* - Mr. Dr. Prof. Patrick - Sep 19, 2015

AttachConsole allows you to connect to another process window, get the input handle and read from it, or if you gonna hook, you will need to hook ReadConsole/ReadConsoleInput


* - Cesar Morales - Sep 19, 2015

(Sep 19, 2015 07:40 PM)Mr. Dr. Prof. Patrick Wrote:  AttachConsole allows you to connect to another process window, get the input handle and read from it, or if you gonna hook, you will need to hook ReadConsole/ReadConsoleInput

Any places you'd recommend I start for going about attaching to the console?


* - Menalix - Sep 20, 2015

(Sep 19, 2015 10:27 PM)xNova Wrote:  Any places you'd recommend I start for going about attaching to the console?

He just plain said it to you:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681952(v=vs.85).aspx?tduid=(cd5bee644abe22733c57017c12017ea2)(256380)(2459594)(XdSn0e3h3.k-So04MhJhyCMcvJAfkYNgdw)()