Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.29 KB | None | 0 0
  1. // ImGui - standalone example application for DirectX 9
  2. // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
  3.  
  4. #include <imgui.h>
  5. #include "imgui_impl_dx9.h"
  6. #include <d3d9.h>
  7. #define DIRECTINPUT_VERSION 0x0800
  8. #include <dinput.h>
  9. #include <tchar.h>
  10.  
  11. #include <comdef.h>
  12. #include <string>
  13.  
  14. #include <stdio.h>
  15. #include <cstdio>
  16.  
  17.  
  18. #define CURL_STATICLIB
  19. #include "curl/curl.h"
  20.  
  21.  
  22.  
  23. #include <iostream>
  24. #include <string.h>
  25.  
  26. #include <direct.h>
  27. #include <windows.h>
  28. #include <tlhelp32.h>
  29.  
  30.  
  31. #include <stdio.h>
  32. #include <Windows.h>
  33. #include <Psapi.h>
  34. #include <TlHelp32.h>
  35.  
  36.  
  37. static char userVal[15];
  38. static char passwordVal[25];
  39. static bool showMainPage = true;
  40.  
  41. typedef HMODULE(WINAPI *pLoadLibraryA)(LPCSTR);
  42. typedef FARPROC(WINAPI *pGetProcAddress)(HMODULE, LPCSTR);
  43.  
  44. typedef BOOL(WINAPI *PDLL_MAIN)(HMODULE, DWORD, PVOID);
  45.  
  46. typedef struct _MANUAL_INJECT
  47. {
  48. PVOID ImageBase;
  49. PIMAGE_NT_HEADERS NtHeaders;
  50. PIMAGE_BASE_RELOCATION BaseRelocation;
  51. PIMAGE_IMPORT_DESCRIPTOR ImportDirectory;
  52. pLoadLibraryA fnLoadLibraryA;
  53. pGetProcAddress fnGetProcAddress;
  54. }MANUAL_INJECT, *PMANUAL_INJECT;
  55.  
  56.  
  57. int FindCSGO() {
  58. PROCESSENTRY32 entry;
  59. entry.dwSize = sizeof(PROCESSENTRY32);
  60.  
  61. HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  62.  
  63. if (Process32First(snapshot, &entry) == TRUE)
  64. {
  65. while (Process32Next(snapshot, &entry) == TRUE)
  66. {
  67. if (strstr(entry.szExeFile, "csgo.exe") || strstr(entry.szExeFile, "CSGO.EXE"))
  68. {
  69. return entry.th32ProcessID;
  70. }
  71. }
  72. }
  73.  
  74. CloseHandle(snapshot);
  75.  
  76.  
  77. return NULL;
  78. }
  79.  
  80. DWORD WINAPI LoadDll(PVOID p)
  81. {
  82. PMANUAL_INJECT ManualInject;
  83.  
  84. HMODULE hModule;
  85. DWORD i, Function, count, delta;
  86.  
  87. PDWORD ptr;
  88. PWORD list;
  89.  
  90. PIMAGE_BASE_RELOCATION pIBR;
  91. PIMAGE_IMPORT_DESCRIPTOR pIID;
  92. PIMAGE_IMPORT_BY_NAME pIBN;
  93. PIMAGE_THUNK_DATA FirstThunk, OrigFirstThunk;
  94.  
  95. PDLL_MAIN EntryPoint;
  96.  
  97. ManualInject = (PMANUAL_INJECT)p;
  98.  
  99. pIBR = ManualInject->BaseRelocation;
  100. delta = (DWORD)((LPBYTE)ManualInject->ImageBase - ManualInject->NtHeaders->OptionalHeader.ImageBase); // Calculate the delta
  101.  
  102. // Relocate the image
  103.  
  104. while (pIBR->VirtualAddress)
  105. {
  106. if (pIBR->SizeOfBlock >= sizeof(IMAGE_BASE_RELOCATION))
  107. {
  108. count = (pIBR->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
  109. list = (PWORD)(pIBR + 1);
  110.  
  111. for (i = 0; i<count; i++)
  112. {
  113. if (list[i])
  114. {
  115. ptr = (PDWORD)((LPBYTE)ManualInject->ImageBase + (pIBR->VirtualAddress + (list[i] & 0xFFF)));
  116. *ptr += delta;
  117. }
  118. }
  119. }
  120.  
  121. pIBR = (PIMAGE_BASE_RELOCATION)((LPBYTE)pIBR + pIBR->SizeOfBlock);
  122. }
  123.  
  124. pIID = ManualInject->ImportDirectory;
  125.  
  126. // Resolve DLL imports
  127.  
  128. while (pIID->Characteristics)
  129. {
  130. OrigFirstThunk = (PIMAGE_THUNK_DATA)((LPBYTE)ManualInject->ImageBase + pIID->OriginalFirstThunk);
  131. FirstThunk = (PIMAGE_THUNK_DATA)((LPBYTE)ManualInject->ImageBase + pIID->FirstThunk);
  132.  
  133. hModule = ManualInject->fnLoadLibraryA((LPCSTR)ManualInject->ImageBase + pIID->Name);
  134.  
  135. if (!hModule)
  136. {
  137. return FALSE;
  138. }
  139.  
  140. while (OrigFirstThunk->u1.AddressOfData)
  141. {
  142. if (OrigFirstThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG)
  143. {
  144. // Import by ordinal
  145.  
  146. Function = (DWORD)ManualInject->fnGetProcAddress(hModule, (LPCSTR)(OrigFirstThunk->u1.Ordinal & 0xFFFF));
  147.  
  148. if (!Function)
  149. {
  150. return FALSE;
  151. }
  152.  
  153. FirstThunk->u1.Function = Function;
  154. }
  155.  
  156. else
  157. {
  158. // Import by name
  159.  
  160. pIBN = (PIMAGE_IMPORT_BY_NAME)((LPBYTE)ManualInject->ImageBase + OrigFirstThunk->u1.AddressOfData);
  161. Function = (DWORD)ManualInject->fnGetProcAddress(hModule, (LPCSTR)pIBN->Name);
  162.  
  163. if (!Function)
  164. {
  165. return FALSE;
  166. }
  167.  
  168. FirstThunk->u1.Function = Function;
  169. }
  170.  
  171. OrigFirstThunk++;
  172. FirstThunk++;
  173. }
  174.  
  175. pIID++;
  176. }
  177.  
  178. if (ManualInject->NtHeaders->OptionalHeader.AddressOfEntryPoint)
  179. {
  180. EntryPoint = (PDLL_MAIN)((LPBYTE)ManualInject->ImageBase + ManualInject->NtHeaders->OptionalHeader.AddressOfEntryPoint);
  181. return EntryPoint((HMODULE)ManualInject->ImageBase, DLL_PROCESS_ATTACH, NULL); // Call the entry point
  182. }
  183.  
  184. return TRUE;
  185. }
  186.  
  187. DWORD WINAPI LoadDllEnd()
  188. {
  189. return 0;
  190. }
  191.  
  192. int Inject(char* bytes, size_t len)
  193. {
  194. PIMAGE_DOS_HEADER pIDH;
  195. PIMAGE_NT_HEADERS pINH;
  196. PIMAGE_SECTION_HEADER pISH;
  197.  
  198. HANDLE hProcess, hThread, hFile, hToken;
  199. PVOID buffer, image, mem;
  200. DWORD i, FileSize, ProcessId, ExitCode, read;
  201.  
  202. TOKEN_PRIVILEGES tp;
  203. MANUAL_INJECT ManualInject;
  204.  
  205. if (OpenProcessToken((HANDLE)-1, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
  206. {
  207. tp.PrivilegeCount = 1;
  208. tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  209.  
  210. tp.Privileges[0].Luid.LowPart = 20;
  211. tp.Privileges[0].Luid.HighPart = 0;
  212.  
  213. AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
  214. CloseHandle(hToken);
  215. }
  216.  
  217.  
  218.  
  219. buffer = VirtualAlloc(NULL, len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
  220.  
  221. if (!buffer)
  222. {
  223. MessageBoxA(NULL, "Allocation failed!", "obscurecheatz", MB_OK);
  224. printf("\nError: Unable to allocate memory for DLL data (%d)\n", GetLastError());
  225. return -1;
  226. }
  227.  
  228. // Read the DLL
  229.  
  230. memcpy(buffer, bytes, len);
  231.  
  232.  
  233. pIDH = (PIMAGE_DOS_HEADER)buffer;
  234.  
  235. if (pIDH->e_magic != IMAGE_DOS_SIGNATURE)
  236. {
  237. printf("\nError: Invalid executable image.\n");
  238. MessageBoxA(NULL, "Invaild image!", "obscurecheatz", MB_OK);
  239. VirtualFree(buffer, 0, MEM_RELEASE);
  240. return -1;
  241. }
  242.  
  243. pINH = (PIMAGE_NT_HEADERS)((LPBYTE)buffer + pIDH->e_lfanew);
  244.  
  245. if (pINH->Signature != IMAGE_NT_SIGNATURE)
  246. {
  247. printf("\nError: Invalid PE header.\n");
  248. MessageBoxA(NULL, "Invaild PE!", "obscurecheatz", MB_OK);
  249. VirtualFree(buffer, 0, MEM_RELEASE);
  250. return -1;
  251. }
  252.  
  253. if (!(pINH->FileHeader.Characteristics & IMAGE_FILE_DLL))
  254. {
  255. printf("\nError: The image is not DLL.\n");
  256. MessageBoxA(NULL, "Not DLL!", "obscurecheatz", MB_OK);
  257. VirtualFree(buffer, 0, MEM_RELEASE);
  258. return -1;
  259. }
  260.  
  261. ProcessId = FindCSGO();
  262. if (!ProcessId) {
  263. printf("no csgo present");
  264. MessageBoxA(NULL, "Open CSGO first!", "obscurecheatz", MB_OK);
  265. return -1;
  266. }
  267.  
  268. printf("\nOpening target process.\n");
  269. hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessId);
  270.  
  271. if (!hProcess)
  272. {
  273. printf("\nError: Unable to open target process (%d)\n", GetLastError());
  274. MessageBoxA(NULL, "OpenProcess failed!", "obscurecheatz", MB_OK);
  275. VirtualFree(buffer, 0, MEM_RELEASE);
  276. CloseHandle(hProcess);
  277.  
  278. return -1;
  279. }
  280.  
  281. printf("\nAllocating memory for the DLL.\n");
  282. image = VirtualAllocEx(hProcess, NULL, pINH->OptionalHeader.SizeOfImage, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); // Allocate memory for the DLL
  283.  
  284. if (!image)
  285. {
  286. printf("\nError: Unable to allocate memory for the DLL (%d)\n", GetLastError());
  287. MessageBoxA(NULL, "Allocation failed! (2)", "obscurecheatz", MB_OK);
  288. VirtualFree(buffer, 0, MEM_RELEASE);
  289. CloseHandle(hProcess);
  290.  
  291. return -1;
  292. }
  293.  
  294. // Copy the header to target process
  295.  
  296. printf("\nCopying headers into target process.\n");
  297.  
  298. if (!WriteProcessMemory(hProcess, image, buffer, pINH->OptionalHeader.SizeOfHeaders, NULL))
  299. {
  300. printf("\nError: Unable to copy headers to target process (%d)\n", GetLastError());
  301. MessageBoxA(NULL, "Copying headers failed!", "obscurecheatz", MB_OK);
  302. VirtualFreeEx(hProcess, image, 0, MEM_RELEASE);
  303. CloseHandle(hProcess);
  304.  
  305. VirtualFree(buffer, 0, MEM_RELEASE);
  306. return -1;
  307. }
  308.  
  309. pISH = (PIMAGE_SECTION_HEADER)(pINH + 1);
  310.  
  311. // Copy the DLL to target process
  312.  
  313. printf("\nCopying sections to target process.\n");
  314.  
  315. for (i = 0; i<pINH->FileHeader.NumberOfSections; i++)
  316. {
  317. WriteProcessMemory(hProcess, (PVOID)((LPBYTE)image + pISH[i].VirtualAddress), (PVOID)((LPBYTE)buffer + pISH[i].PointerToRawData), pISH[i].SizeOfRawData, NULL);
  318. }
  319.  
  320. printf("\nAllocating memory for the loader code.\n");
  321. mem = VirtualAllocEx(hProcess, NULL, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); // Allocate memory for the loader code
  322.  
  323. if (!mem)
  324. {
  325. printf("\nError: Unable to allocate memory for the loader code (%d)\n", GetLastError());
  326. MessageBoxA(NULL, "Allocation failed! (3)", "obscurecheatz", MB_OK);
  327. VirtualFreeEx(hProcess, image, 0, MEM_RELEASE);
  328. CloseHandle(hProcess);
  329.  
  330. VirtualFree(buffer, 0, MEM_RELEASE);
  331. return -1;
  332. }
  333.  
  334. printf("\nLoader code allocated at %#x\n", mem);
  335. memset(&ManualInject, 0, sizeof(MANUAL_INJECT));
  336.  
  337. ManualInject.ImageBase = image;
  338. ManualInject.NtHeaders = (PIMAGE_NT_HEADERS)((LPBYTE)image + pIDH->e_lfanew);
  339. ManualInject.BaseRelocation = (PIMAGE_BASE_RELOCATION)((LPBYTE)image + pINH->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
  340. ManualInject.ImportDirectory = (PIMAGE_IMPORT_DESCRIPTOR)((LPBYTE)image + pINH->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
  341. ManualInject.fnLoadLibraryA = LoadLibraryA;
  342. ManualInject.fnGetProcAddress = GetProcAddress;
  343.  
  344. printf("\nWriting loader code to target process.\n");
  345.  
  346. WriteProcessMemory(hProcess, mem, &ManualInject, sizeof(MANUAL_INJECT), NULL); // Write the loader information to target process
  347. WriteProcessMemory(hProcess, (PVOID)((PMANUAL_INJECT)mem + 1), LoadDll, (DWORD)LoadDllEnd - (DWORD)LoadDll, NULL); // Write the loader code to target process
  348.  
  349. printf("\nExecuting loader code.\n");
  350. hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)((PMANUAL_INJECT)mem + 1), mem, 0, NULL); // Create a remote thread to execute the loader code
  351.  
  352. if (!hThread)
  353. {
  354. printf("\nError: Unable to execute loader code (%d)\n", GetLastError());
  355. MessageBoxA(NULL, std::string("Unable to execute loader code! (" + std::to_string(GetLastError()) + ")").c_str(), "obscurecheatz", MB_OK);
  356. VirtualFreeEx(hProcess, mem, 0, MEM_RELEASE);
  357. VirtualFreeEx(hProcess, image, 0, MEM_RELEASE);
  358.  
  359. CloseHandle(hProcess);
  360.  
  361. VirtualFree(buffer, 0, MEM_RELEASE);
  362. return -1;
  363. }
  364.  
  365. WaitForSingleObject(hThread, INFINITE);
  366. GetExitCodeThread(hThread, &ExitCode);
  367.  
  368. if (!ExitCode)
  369. {
  370. VirtualFreeEx(hProcess, mem, 0, MEM_RELEASE);
  371. VirtualFreeEx(hProcess, image, 0, MEM_RELEASE);
  372.  
  373. CloseHandle(hThread);
  374. CloseHandle(hProcess);
  375.  
  376. VirtualFree(buffer, 0, MEM_RELEASE);
  377. MessageBoxA(NULL, "Thread didnt exit!", "obscurecheatz", MB_OK);
  378. return -1;
  379. }
  380.  
  381. CloseHandle(hThread);
  382. VirtualFreeEx(hProcess, mem, 0, MEM_RELEASE);
  383.  
  384. CloseHandle(hProcess);
  385.  
  386. printf("\nDLL injected at %#x\n", image);
  387.  
  388. if (pINH->OptionalHeader.AddressOfEntryPoint)
  389. {
  390. printf("\nDLL entry point: %#x\n", (PVOID)((LPBYTE)image + pINH->OptionalHeader.AddressOfEntryPoint));
  391. }
  392.  
  393. VirtualFree(buffer, 0, MEM_RELEASE);
  394. return 0;
  395. exit(0);
  396. }
  397.  
  398.  
  399. struct string {
  400. char *ptr;
  401. size_t len;
  402. };
  403.  
  404. void init_string(struct string *s) {
  405. s->len = 0;
  406. s->ptr = (char*)malloc(s->len + 1);
  407. if (s->ptr == NULL) {
  408. fprintf(stderr, "malloc() failed\n");
  409. exit(EXIT_FAILURE);
  410. }
  411. s->ptr[0] = '\0';
  412. }
  413.  
  414. size_t writefunc(void *ptr, size_t size, size_t nmemb, struct string *s)
  415. {
  416. size_t new_len = s->len + size*nmemb;
  417. s->ptr = (char*)realloc(s->ptr, new_len + 1);
  418. if (s->ptr == NULL) {
  419. fprintf(stderr, "realloc() failed\n");
  420. exit(EXIT_FAILURE);
  421. }
  422. memcpy(s->ptr + s->len, ptr, size*nmemb);
  423. s->ptr[new_len] = '\0';
  424. s->len = new_len;
  425.  
  426. return size*nmemb;
  427. }
  428.  
  429. std::string GetHardWareID()
  430. {
  431. HW_PROFILE_INFOA hwProfileInfoA;
  432. if (GetCurrentHwProfileA(&hwProfileInfoA) != NULL)
  433. return std::string(hwProfileInfoA.szHwProfileGuid);
  434.  
  435. }
  436.  
  437. void injectionVoid()
  438. {
  439. CURL* c;
  440. c = curl_easy_init();
  441.  
  442. if (!c)
  443. exit(1);
  444.  
  445. struct string s;
  446. init_string(&s);
  447.  
  448. curl_easy_setopt(c, CURLOPT_URL, "https://mestermc.hu/index.php");
  449. curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, writefunc);
  450. curl_easy_setopt(c, CURLOPT_WRITEDATA, &s);
  451.  
  452. curl_easy_perform(c);
  453. curl_easy_cleanup(c);
  454.  
  455. Inject(s.ptr, s.len);
  456. }
  457.  
  458. bool loginValue()
  459. {
  460. CURL* c;
  461. c = curl_easy_init();
  462.  
  463. if (!c)
  464. exit(1);
  465.  
  466. struct string s;
  467. init_string(&s);
  468.  
  469.  
  470. std::string variable = "http://obscure-files.000webhostapp.com/connection.php?username=" + std::string(userVal) + "&password=" + std::string(passwordVal) + "&hwid=" + GetHardWareID();
  471.  
  472. printf("%s", variable.c_str());
  473.  
  474. curl_easy_setopt(c, CURLOPT_URL, variable.c_str());
  475. curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, writefunc);
  476. curl_easy_setopt(c, CURLOPT_WRITEDATA, &s);
  477.  
  478. curl_easy_perform(c);
  479. curl_easy_cleanup(c);
  480.  
  481. if (!strcmp(s.ptr, "success"))
  482. return true;
  483. else
  484. return false;
  485.  
  486. }
  487.  
  488. /* ============================================================================================================================== */
  489.  
  490. // Data
  491. static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
  492. static D3DPRESENT_PARAMETERS g_d3dpp;
  493.  
  494. extern LRESULT ImGui_ImplDX9_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  495. LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
  496. {
  497. if (ImGui_ImplDX9_WndProcHandler(hWnd, msg, wParam, lParam))
  498. return true;
  499.  
  500. switch (msg)
  501. {
  502. case WM_SIZE:
  503. if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
  504. {
  505. ImGui_ImplDX9_InvalidateDeviceObjects();
  506. g_d3dpp.BackBufferWidth = LOWORD(lParam);
  507. g_d3dpp.BackBufferHeight = HIWORD(lParam);
  508. HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp);
  509. if (hr == D3DERR_INVALIDCALL)
  510. IM_ASSERT(0);
  511. ImGui_ImplDX9_CreateDeviceObjects();
  512. }
  513. return 0;
  514. case WM_SYSCOMMAND:
  515. if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
  516. return 0;
  517. break;
  518. case WM_DESTROY:
  519. PostQuitMessage(0);
  520. return 0;
  521. }
  522. return DefWindowProc(hWnd, msg, wParam, lParam);
  523. }
  524.  
  525.  
  526. int main()
  527. {
  528.  
  529. ImGuiIO& io = ImGui::GetIO();
  530. io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\Tahoma.ttf", 16.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
  531.  
  532. ImGuiStyle * style = &ImGui::GetStyle();
  533.  
  534. style->WindowPadding = ImVec2(15, 15);
  535. style->WindowRounding = 5.0f;
  536. style->FramePadding = ImVec2(5, 5);
  537. style->FrameRounding = 4.0f;
  538. style->ItemSpacing = ImVec2(12, 8);
  539. style->ItemInnerSpacing = ImVec2(8, 6);
  540. style->IndentSpacing = 25.0f;
  541. style->ScrollbarSize = 15.0f;
  542. style->ScrollbarRounding = 9.0f;
  543. style->GrabMinSize = 5.0f;
  544. style->GrabRounding = 3.0f;
  545.  
  546. style->Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
  547. style->Colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  548. style->Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  549. style->Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  550. style->Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  551. style->Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
  552. style->Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
  553. style->Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  554. style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  555. style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  556. style->Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  557. style->Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 0.98f, 0.95f, 0.75f);
  558. style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  559. style->Colors[ImGuiCol_MenuBarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  560. style->Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  561. style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  562. style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  563. style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  564. style->Colors[ImGuiCol_ComboBg] = ImVec4(0.19f, 0.18f, 0.21f, 1.00f);
  565. style->Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  566. style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  567. style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  568. style->Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  569. style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  570. style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  571. style->Colors[ImGuiCol_Header] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  572. style->Colors[ImGuiCol_HeaderHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  573. style->Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  574. style->Colors[ImGuiCol_Column] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  575. style->Colors[ImGuiCol_ColumnHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  576. style->Colors[ImGuiCol_ColumnActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  577. style->Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
  578. style->Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  579. style->Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  580. style->Colors[ImGuiCol_CloseButton] = ImVec4(0.40f, 0.39f, 0.38f, 0.16f);
  581. style->Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.40f, 0.39f, 0.38f, 0.39f);
  582. style->Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.40f, 0.39f, 0.38f, 1.00f);
  583. style->Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
  584. style->Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
  585. style->Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
  586. style->Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
  587. style->Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
  588. style->Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
  589.  
  590. // Create application window
  591. WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, _T("loader"), NULL };
  592. RegisterClassEx(&wc);
  593. HWND hwnd = CreateWindow(_T("loader"), _T("loader"), WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 100, 100, 500, 500, NULL, NULL, wc.hInstance, NULL);
  594.  
  595. // Initialize Direct3D
  596. LPDIRECT3D9 pD3D;
  597. if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
  598. {
  599. UnregisterClass(_T("loader"), wc.hInstance);
  600. return 0;
  601. }
  602. ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
  603. g_d3dpp.Windowed = TRUE;
  604. g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  605. g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  606. g_d3dpp.EnableAutoDepthStencil = TRUE;
  607. g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
  608. g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
  609. //g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
  610.  
  611. // Create the D3DDevice
  612. if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
  613. {
  614. pD3D->Release();
  615. UnregisterClass(_T("loader"), wc.hInstance);
  616. return 0;
  617. }
  618.  
  619. // Setup ImGui binding
  620. ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
  621.  
  622. // Load Fonts
  623. // (there is a default font, this is only if you want to change it. see extra_fonts/README.txt for more details)
  624. //ImGuiIO& io = ImGui::GetIO();
  625. //io.Fonts->AddFontDefault();
  626. //io.Fonts->AddFontFromFileTTF("../../extra_fonts/Cousine-Regular.ttf", 15.0f);
  627. //io.Fonts->AddFontFromFileTTF("../../extra_fonts/DroidSans.ttf", 16.0f);
  628. //io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyClean.ttf", 13.0f);
  629. //io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyTiny.ttf", 10.0f);
  630. //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
  631.  
  632. ImVec4 clear_col = ImColor(114, 144, 154);
  633.  
  634. // Main loop
  635. MSG msg;
  636. ZeroMemory(&msg, sizeof(msg));
  637. ShowWindow(hwnd, SW_SHOWDEFAULT);
  638. UpdateWindow(hwnd);
  639. while (msg.message != WM_QUIT)
  640. {
  641. if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
  642. {
  643. TranslateMessage(&msg);
  644. DispatchMessage(&msg);
  645. continue;
  646. }
  647. ImGui_ImplDX9_NewFrame();
  648.  
  649. /*ImGuiStyle * style = &ImGui::GetStyle();
  650.  
  651. style->WindowPadding = ImVec2(15, 15);
  652. style->WindowRounding = 5.0f;
  653. style->FramePadding = ImVec2(5, 5);
  654. style->FrameRounding = 4.0f;
  655. style->ItemSpacing = ImVec2(12, 8);
  656. style->ItemInnerSpacing = ImVec2(8, 6);
  657. style->IndentSpacing = 25.0f;
  658. style->ScrollbarSize = 15.0f;
  659. style->ScrollbarRounding = 9.0f;
  660. style->GrabMinSize = 5.0f;
  661. style->GrabRounding = 3.0f;
  662.  
  663. style->Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
  664. style->Colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  665. style->Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  666. style->Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  667. style->Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  668. style->Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
  669. style->Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
  670. style->Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  671. style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  672. style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  673. style->Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  674. style->Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 0.98f, 0.95f, 0.75f);
  675. style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
  676. style->Colors[ImGuiCol_MenuBarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  677. style->Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  678. style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  679. style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  680. style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  681. style->Colors[ImGuiCol_ComboBg] = ImVec4(0.19f, 0.18f, 0.21f, 1.00f);
  682. style->Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  683. style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
  684. style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  685. style->Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  686. style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  687. style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  688. style->Colors[ImGuiCol_Header] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
  689. style->Colors[ImGuiCol_HeaderHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  690. style->Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  691. style->Colors[ImGuiCol_Column] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  692. style->Colors[ImGuiCol_ColumnHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
  693. style->Colors[ImGuiCol_ColumnActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  694. style->Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
  695. style->Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
  696. style->Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
  697. style->Colors[ImGuiCol_CloseButton] = ImVec4(0.40f, 0.39f, 0.38f, 0.16f);
  698. style->Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.40f, 0.39f, 0.38f, 0.39f);
  699. style->Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.40f, 0.39f, 0.38f, 1.00f);
  700. style->Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
  701. style->Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
  702. style->Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
  703. style->Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
  704. style->Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
  705. style->Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
  706.  
  707. style->WindowTitleAlign = ImVec2(0.5f, 0.5f);
  708.  
  709. bool showMainPage = true;
  710.  
  711. static char userVal[20];
  712. static char passVal[30];
  713. static bool pressed = false;
  714. const char* detectString = "UNDETECTED";
  715.  
  716. ImGui::SetWindowPos(ImVec2(0.5f, 0.5f));
  717. ImGui::SetNextWindowSize(ImVec2(350, 500), ImGuiSetCond_FirstUseEver);
  718. if (ImGui::Begin("Loginpanel", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_NoMove))
  719. {
  720. if (showMainPage) {
  721. ImGui::Text("\t\t Welcome to obscurecheatz loader");
  722. if (detectString == "DETECTED")
  723. ImGui::Text("\t\t\t Status: " + _bstr_t(detectString));
  724. else if (detectString == "UNDETECTED")
  725. ImGui::Text("\t\t\t Status: " + _bstr_t(detectString));
  726. ImGui::Text("\t");
  727.  
  728. {
  729. ImGui::Text("\t\t\t\ Your hardware-id:");
  730. ImGui::Text("\t" + _bstr_t(GetHardWareID().c_str()));
  731. ImGui::Text("\t");
  732. }
  733. {
  734. ImGui::Text("\t\t Login with your credentials");
  735. ImGui::Text("\t");
  736. }
  737. {
  738. ImGui::Text("\t\t\t\t Username");
  739. ImGui::PushItemWidth(-0.5);
  740. ImGui::InputText("##USERNAME", userVal, 20);
  741. }
  742. {
  743. ImGui::Text("\t\t\t\t Password");
  744. ImGui::PushItemWidth(-0.5);
  745. ImGui::InputText("##PASSWORD", passVal, 30, ImGuiInputTextFlags_Password);
  746. ImGui::Text("\t");
  747. }
  748. {
  749. ImGui::Text("\t ");
  750. ImGui::SameLine();
  751. if (ImGui::Button("Login", ImVec2(225, 0)))
  752. pressed = true;
  753. }
  754. }
  755. else
  756. {
  757.  
  758. }
  759.  
  760.  
  761. {
  762. if (pressed) {
  763. if ((std::string)(userVal) == "" && (std::string)(passVal) == "" && pressed)
  764. {
  765. ImGui::Text("\t\t\t\ write smthn");
  766. }
  767. else {
  768. if ((std::string)(userVal) == "teszt" && (std::string)(passVal) == "teszt")
  769. {
  770. if (GetHardWareID() != "asd") {
  771. ImGui::Text("\t\t Successfully logged in!");
  772. showMainPage = false;
  773. downloadDLL();
  774. abort();
  775.  
  776. }
  777. else {
  778. ImGui::Text("\t\t\t\t Invalid HWID!");
  779. abort();
  780. }
  781. }
  782. else {
  783. ImGui::Text("\t\tInvalid username or password!");
  784. abort();
  785. }
  786. }
  787. }
  788. else {
  789. ImGui::Text("\n");
  790. }
  791. }
  792. }
  793. ImGui::End();*/
  794.  
  795.  
  796.  
  797. ImGui::SetWindowPos(ImVec2(500 / 2, 500 / 2), 0);
  798. if (ImGui::Begin("obscurecheatz - loader", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize))
  799. {
  800. ImGui::Text("Your hardware ID:");
  801. ImGui::Text(_bstr_t(GetHardWareID().c_str()));
  802. ImGui::Text("Login to obscurecheatz with your credentials (nice hek)");
  803. if (showMainPage == true)
  804. {
  805. ImGui::InputText("##USERNAME", userVal, sizeof(userVal));
  806. ImGui::SameLine();
  807. ImGui::Text("Username");
  808. ImGui::InputText("##PASSWORD", passwordVal, sizeof(passwordVal), ImGuiInputTextFlags_Password);
  809. ImGui::SameLine();
  810. ImGui::Text("Password");
  811.  
  812. if (ImGui::Button("Log-In"))
  813. {
  814. if (loginValue() == true)
  815. {
  816. injectionVoid();
  817.  
  818. }
  819. else
  820. {
  821. MessageBoxA(NULL, "Invalid login information!", "obscurecheatz", MB_OK);
  822. }
  823.  
  824. exit(0);
  825. }
  826. }
  827. else {
  828. ImGui::Text("Please wait!");
  829. }
  830.  
  831. }
  832. ImGui::End();
  833.  
  834. // Rendering
  835. g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, false);
  836. g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
  837. g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, false);
  838. D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_col.x*255.0f), (int)(clear_col.y*255.0f), (int)(clear_col.z*255.0f), (int)(clear_col.w*255.0f));
  839. g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0);
  840. if (g_pd3dDevice->BeginScene() >= 0)
  841. {
  842. ImGui::Render();
  843. g_pd3dDevice->EndScene();
  844. }
  845. g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
  846. }
  847.  
  848. ImGui_ImplDX9_Shutdown();
  849. if (g_pd3dDevice) g_pd3dDevice->Release();
  850. if (pD3D) pD3D->Release();
  851. UnregisterClass(_T("loader"), wc.hInstance);
  852.  
  853. return 0;
  854. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement