![]() |
|
[C] CMD session on client controlled by server using pipes.. - 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] CMD session on client controlled by server using pipes.. (/showthread.php?tid=5829311) |
CMD session on client controlled by server using pipes.. - stdio - Apr 25, 2018 Hello HF, In early stages of building a RAT, so far I have (1) Server and client connecting through sockets (2) server selects a function (snapshot/get process list etc) to perform on client (functions pre coded on client) Now I would like to initiate a cmd session on client PC so I can possibly do anything on client PC, instead of just some pre-coded functions. I can initiate a cmd session on client PC but need guidance on how to send/rcv commands and cmd output back to server. I read about pipes but still need help. This is the part where client rcvs command to initiate cmd session Code while (true)In short I need to know how to get the output of cmd to client and then send it over to server. Just need pointers, rest I can search (hopefully). RE: CMD session on client controlled by server using pipes.. - HFDone - Apr 25, 2018 https://github.com/nmap/nmap/blob/master/ncat/ncat_exec_win.c RE: CMD session on client controlled by server using pipes.. - stdio - Apr 25, 2018 (Apr 25, 2018 04:05 AM)HFDone Wrote: https://github.com/nmap/nmap/blob/master/ncat/ncat_exec_win.c Thanks, I need a little briefing though regarding the whole concept. Program creates a child process (cmd session) using createprocess, now how do I communicate with this child process? what are various options.. RE: CMD session on client controlled by server using pipes.. - HFDone - Apr 25, 2018 subprocess_thread_func https://github.com/nmap/nmap/blob/master/ncat/ncat_exec_win.c#L461 but you better check msdn example https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx RE: CMD session on client controlled by server using pipes.. - stdio - Apr 26, 2018 (Apr 25, 2018 07:16 AM)HFDone Wrote: subprocess_thread_func https://github.com/nmap/nmap/blob/master/ncat/ncat_exec_win.c#L461 I am using the msdn code you provided, edited it so that it gets gets command from program instead of reading from a file. My functions for read/write to pipes are Code void WriteToPipe()read from pipe does not work, when executed cmd gives following message "The system cannot find message text for message 0x2350 in message file for application". "Not enough storage is available to process this command" RE: CMD session on client controlled by server using pipes.. - SlowMehMo - Apr 28, 2018 (Apr 26, 2018 08:12 AM)Homi Wrote: I am using the msdn code you provided, edited it so that it gets gets command from program instead of reading from a file. Try moving the applications to another environment, thats a weird issue. The only time i had that storage issue, i had a custom control for exiting, and it didnt do garbage collection correctly, so i had multiple instances open without realizing. something about the atom table. |