Hi Guys,
I have some trouble with exe payloads. When I try to execute them on Windows, A console (cmd) is opened and it don't disappear until I close the session.
Is there a way in C language to hide the output of an exe ?
I have already used the WinMain() method but it doesn't work.
It's very annoying to have this console. If the target close it (he/she will probably do it), I lose my meterpreter session.
Thank you
11 Responses
How are you creating the exe?
I make the C program then I compile it with GCC with the cmdline
Oh ok. Do you need to do it that way? I personally have no experience with that but I can say what I do. I use Windows Iexpress to create a generic exe then use Shellter to inject the payload. Might be of some help.
Use -mwindows flag (WinMain entry point is optional for GCC). I'm pretty sure you can find this information easily on Google.
A possible solution is to create a daemon process from the initial process.
The daemon process isn't bind to any shell so it doesn't open any console.
Int 3H the -mwindows flag hide the console but the shellcode doesn't work know...
Does the shellcode rely on having a console? If so, then there is another method to hide the window but it will be visible for a very brief moment when it is executed.
Simply place this line at the beginning of main and compile without -mwindows: ShowWindow(FindWindowA("ConsoleWindowClass",NULL) ,0);
No it's okay -mwindows works perfectly.
Thank you man
No it's OK !! -mwindows worked !
Thank you everybody
simply run it as a process
that way the command prompt won't appear
Share Your Thoughts