查看: 710|回复: 0

水淼·电商评论采集器破解方法

[复制链接]
发表于 2015-4-13 15:55 | 显示全部楼层 |阅读模式
冒烟的左轮 2015-4-13 15:55 710 0 显示全部楼层
在0x0041D64F这个地方修改为int3,即程序运行到这里会断下,然后自己写一个简单的调试器加载在这个程序上,当程序断下后,自己写的程序就可以得到信息。然后根据这些信息就可以得到注册码了。如果断下后不进行删除断点,可以获得所有的注册码了。下面上源码。


[C++]


  1. #include <windows.h>

  2. #define SE_DEBUG_PRIVILEGE 20
  3. typedef  DWORD(WINAPI *PRtlAdjustPrivilege)   //未文档化函数声明
  4. (
  5. ULONG    Privilege,
  6. BOOLEAN Enable,
  7. BOOLEAN CurrentThread,
  8. PBOOLEAN Enabled
  9. );
  10. void WINAPI AdjustPrivilege()         //ntdll中的提权函数
  11. {
  12.     BOOLEAN Enabled;
  13.     PRtlAdjustPrivilege RtlAdjustPrivilege = (PRtlAdjustPrivilege)GetProcAddress(LoadLibrary(L"ntdll.dll"), "RtlAdjustPrivilege");
  14.     RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &Enabled);
  15. }
  16. void GetAppPath(char *path)       //吃饭睡觉打豆豆大神的获取当前路径
  17. {
  18.     GetModuleFileNameA(0, path, MAX_PATH);
  19.     for (SIZE_T i = strlen(path) - 1; i >= 0; i--)
  20.     {
  21.         if (path[i] == '\\')
  22.         {
  23.             path[i + 1] = '\0';
  24.             break;
  25.         }
  26.     }
  27.     strcat(path, "水淼·电商评论采集器.exe");
  28. }


  29. int WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd)
  30. {
  31.     char pass[30];
  32.     BYTE code[2] = {0xcc,0x00};
  33.     BOOL status = TRUE;
  34.     AdjustPrivilege();      //提升进程权限
  35.     STARTUPINFOA si = { sizeof(si) };
  36.     PROCESS_INFORMATION pi;
  37.     char path[MAX_PATH];
  38.     GetAppPath(path);
  39.     //创建进程并调试
  40.     if (!CreateProcessA(NULL, path, NULL, NULL, FALSE, DEBUG_ONLY_THIS_PROCESS | DEBUG_PROCESS, NULL, NULL, &si, &pi))
  41.     {
  42.         MessageBoxA(NULL, "无法启动进程", "提示", MB_OK);
  43.         return 0;
  44.     }
  45.     //读取原来的指令
  46.     if (!ReadProcessMemory(pi.hProcess, (LPVOID)0x0041D64F, &code[1], 1, NULL))
  47.     {
  48.         MessageBoxA(NULL, "读取内存出错", "提示", MB_OK);
  49.         return 0;
  50.     }
  51.     //写入int 3
  52.     if (!WriteProcessMemory(pi.hProcess, (LPVOID)0x0041D64F, code, 1, NULL))
  53.     {
  54.         MessageBoxA(NULL, "写入内存出错", "提示", MB_OK);
  55.         return 0;
  56.     }
  57.     DEBUG_EVENT dbg;
  58.     while (status)
  59.     {
  60.         //接受调试信息
  61.         if (WaitForDebugEvent(&dbg, 50) == 0)
  62.         {
  63.             Sleep(10);
  64.             continue;
  65.         }
  66.         if (dbg.dwDebugEventCode == EXCEPTION_DEBUG_EVENT && dbg.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT)
  67.         {
  68.             //如果是int3断点并且位置是0x0041D64F
  69.             if ((DWORD)dbg.u.Exception.ExceptionRecord.ExceptionAddress == 0x0041D64F)
  70.             {
  71.                 HANDLE h = OpenThread(THREAD_ALL_ACCESS, FALSE, dbg.dwThreadId);
  72.                 CONTEXT ct;
  73.                 ct.ContextFlags = CONTEXT_ALL;
  74.                 if (h > 0)
  75.                 {
  76.                     SuspendThread(h);
  77.                     GetThreadContext(h, &ct);
  78.                     if (!WriteProcessMemory(pi.hProcess, (LPVOID)0x0041D64F, &code[1], 1, NULL))
  79.                     {
  80.                         MessageBoxA(NULL, "写入内存出错", "提示", MB_OK);
  81.                         return 0;
  82.                     }
  83.                     if (!ReadProcessMemory(pi.hProcess, (LPVOID)ct.Eax, pass, 30, NULL))
  84.                     {
  85.                         MessageBoxA(NULL, "读取内存出错", "提示", MB_OK);
  86.                         return 0;
  87.                     }
  88.                     MessageBoxA(NULL, pass, "注册码", MB_OK);
  89.                     status = FALSE;
  90.                     ct.Eip -= 1;
  91.                     SetThreadContext(h, &ct);
  92.                     ResumeThread(h);
  93.                     CloseHandle(h);
  94.                 }
  95.             }
  96.         }
  97.         ContinueDebugEvent(dbg.dwProcessId, dbg.dwThreadId, DBG_CONTINUE);
  98.     }
  99.     //退出调试
  100.     DebugActiveProcessStop(pi.dwProcessId);
  101.     return 0;

  102. }
复制代码
以上代码在win7 X64+VS2013中编译通过。
如果本文有什么错误的地方,还请大家指正。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 返回列表 发新帖

快速回复 返回顶部 返回列表