Bitcoin Forum

Bitcoin => Project Development => Topic started by: Force098 on July 16, 2017, 07:22:06 PM



Title: Vb.Net \ C# - Method to read console windows
Post by: Force098 on July 16, 2017, 07:22:06 PM
Hey Everyone,

I'm trying to create an agent that reports back data from common miners to a web service. My first thought was to capture the text using the RedirectStandardOutput as part of .Net's StartInfo, but it doesn't seem to work with Claymore's Ethereum miner. Everything works like a charm if I use a simple batch script to ping a website like google.com. I've read that some applications use unorthodox methods of sending output text. I tried capturing the error output but didn't have any luck on that front.

Code for the form: https://pastebin.com/GkBgN0G6
Class I'm using to launch the processes: https://pastebin.com/xWgBM1Ya

My next thought was to pull up Spy++ and see if I could capture the messages that way. It turns out that command consoles are protected by Windows and prevents Spy++ from accessing the console messages.

My hope is that there's a simple tweak to get what I have working. Has anyone been successful doing this?

Thanks!


Title: Re: Vb.Net \ C# - Method to read console windows
Post by: hexafraction on July 17, 2017, 03:04:14 AM
Why don't you modify the miner program and recompile it, so that it reports data using a saner interface than trying to parse a user-oriented CLI?


Title: Re: Vb.Net \ C# - Method to read console windows
Post by: Force098 on July 18, 2017, 02:30:27 AM
I believe miners like Claymore are private code, nothing to recompile. If we had the source code, he'd be out a lot of money.


Title: Re: Vb.Net \ C# - Method to read console windows
Post by: cloverme on July 19, 2017, 08:17:16 PM
Try ProcessStartInfo.RedirectStandardOutput in c#

https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput(v=vs.110).aspx



Title: Re: Vb.Net \ C# - Method to read console windows
Post by: Force098 on July 21, 2017, 04:59:34 AM
Yeah, that's what I originally tried but the output isn't captured from Claymore. Have you had different luck using it?


Title: Re: Vb.Net \ C# - Method to read console windows
Post by: Force098 on July 26, 2017, 04:17:59 PM
bump


Title: Re: Vb.Net \ C# - Method to read console windows
Post by: btc4peace on July 26, 2017, 11:11:52 PM
I use AutoIT with WinAPI for such things.