Closed andyleap closed 7 years ago
Confirmed, this is definitely an issue. This shows my CPU usage:
Thanks for pointing this out. I'm currently looking into the WaitOne solution. Feel free to make additional suggestions or pull requests.
To be perfectly honest, I'm actually in the process of writing my own version of powercat, cause I'm not really a big fan of powershell, and you can do pretty much everything in C# with a small powershell shim to kick over to the C#, and still get full PSv2 compatibility and stay diskless.
That actually sounds really interesting. I'm excited to see it!
Well, the initial stages are just about done (stdin/stdout, pipe executable, tcp tunnel), and it's pretty modular to add additional stuff, main thing now is that powershell parameter stuff SUCKS. I've got a wonderful NDesk.Options based thing right now, that lets me do "powercat -l -p 5000 -c 127.0.0.1 -p 5001" to do a relay from a listener on port 5000 to a client on localhost port 5001, but powershell doesn't like that kind of thing, as far as I can tell
I've got the start of "powercatnew" for lack of a better name, up at https://github.com/andyleap/PowerCatNew
I finished my re-write of PowerCat and eliminated the CPU spike in the process. https://github.com/secabstraction/PowerCat
If you open 2 copies of powercat pointing at each other, they sit there chewing through tons and tons of CPU, just bouncing around checking to see if there is anything to read. On my laptop, each copy pulls 10% of the CPU, and causes the fan to spin up. Not exactly "stealthy". It'd be a bit of rewrite, but it looks like everything is already using AsyncResult stuff, if it built a list of all the AsyncResults, it could do a WaitOne on that list, and then recheck everything and loop. Wouldn't be as clean as a callback based method, but it would be much much cleaner then currently.