// Baştan sona örnek: gerçek bir üründe olması gereken her şey tek dosyada. // 1. Ayarlar ve sürüm 5. Bakım anahtarı ve uzaktan ayarlar (Features) // 2. Kayıtlı anahtar 6. Koruma (Protect) // 3. Giriş + cihaz taşıma 7. Kaynaklar: offset ve DLL // 4. Güncelleme / bakım 8. Ana döngü, günlük ve temiz çıkış // Derleme: C++17, OsSdk.h ile aynı klasör ya da include yolunda; lib klasörü bağlayıcı yolunda. #include "OsSdk.h" #include #include #include #include #include #include #include #include #pragma comment(lib, "shell32.lib") #pragma comment(lib, "ole32.lib") namespace app { const char* kProduct = "t12_ornek"; // panel > Oyunlarım > Internal Name const char* kVersion = "1.0.0"; const char* kGame = "rust"; // kaynak oyun (Kaynaklarım sayfasında görünen ad) std::atomic running{ true }; std::mutex stopMx; std::string stopCode; std::wstring Wide(const std::string& s) { int n = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), (int)s.size(), nullptr, 0); std::wstring w(n, L'\0'); MultiByteToWideChar(CP_UTF8, 0, s.c_str(), (int)s.size(), w.data(), n); return w; } void Message(const std::string& text, UINT icon = MB_ICONINFORMATION) { MessageBoxW(nullptr, Wide(text).c_str(), L"Ürün", icon); } // ---- 2. kayıtlı anahtar ------------------------------------------------------------------- std::wstring KeyFile() { PWSTR p = nullptr; std::wstring dir; if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) dir = p; CoTaskMemFree(p); dir += L"\\UrunAdi"; CreateDirectoryW(dir.c_str(), nullptr); return dir + L"\\lisans.txt"; } std::string LoadKey() { std::ifstream f(KeyFile()); std::string k; std::getline(f, k); return k; } void SaveKey(const std::string& k) { std::ofstream(KeyFile(), std::ios::trunc) << k; } void ForgetKey() { DeleteFileW(KeyFile().c_str()); } std::string AskKey() { char buf[256] = {}; printf("Lisans anahtarı: "); return scanf_s("%255s", buf, (unsigned)sizeof(buf)) == 1 ? buf : ""; } // ---- 3 + 4. giriş ------------------------------------------------------------------------- bool Login() { std::string key = LoadKey(); if (key.empty()) key = AskKey(); while (!key.empty()) { if (os::Login(kProduct, key)) { SaveKey(key); return true; } const std::string code = os::Error(); os::LicenseInfo info = os::License(); if (code == "hwid_mismatch") { if (MessageBoxW(nullptr, L"Lisans başka bir bilgisayara bağlı. Bu bilgisayara taşınsın mı?", L"Cihaz", MB_YESNO | MB_ICONQUESTION) != IDYES) return false; if (os::ResetHwid(kProduct, key)) continue; // taşındı, döngü yeniden giriş yapar if (os::Error() == "cooldown") Message("Cihazını yakın zamanda değiştirdin. " + std::to_string(os::ResetHwidWaitMinutes()) + " dakika sonra tekrar dene."); else Message(os::ErrorText(), MB_ICONWARNING); return false; } if (code == "update_required") { if (!info.updateUrl.empty() && MessageBoxW(nullptr, L"Yeni sürüm var. İndirme sayfası açılsın mı?", L"Güncelleme", MB_YESNO) == IDYES) ShellExecuteW(nullptr, L"open", Wide(info.updateUrl).c_str(), nullptr, nullptr, SW_SHOWNORMAL); return false; } if (code == "product_disabled") { Message(info.serverMessage.empty() ? "Ürün şu an bakımda." : info.serverMessage); return false; } if (code == "invalid_license" || code == "license_expired" || code == "license_banned") { Message(os::ErrorText(), MB_ICONWARNING); ForgetKey(); key = AskKey(); continue; } Message(os::ErrorText(), MB_ICONERROR); // ağ hatası, kara liste, çevrimiçi sınırı ... return false; } return false; } // ---- 7. kaynaklar --------------------------------------------------------------------------- bool PrepareResources() { bool hasGame = false; for (const auto& g : os::Resources()) if (g.game == kGame) hasGame = true; if (!hasGame) return true; // bu ürün kaynak kullanmıyorsa geç uint64_t base = os::Offset(kGame, "GameWorld"); // örnek ad; gerçek adlar panelde Offsets sayfasında if (base == 0) { if (os::Error() == "game_updated") Message("Oyun güncellendi; yeni offset'ler hazır olunca tekrar dene."); else Message("Offset alınamadı: " + os::ErrorText(), MB_ICONWARNING); return false; } auto dlls = os::Dlls(kGame); if (!dlls.empty()) { os::DllInfo info; if (!os::SyncDll(kGame, dlls[0].name, L"C:\\ProgramData\\UrunAdi\\" + Wide(dlls[0].name), &info)) { Message("DLL indirilemedi: " + os::ErrorText(), MB_ICONWARNING); return false; } } return true; } } int main() { SetConsoleOutputCP(CP_UTF8); // ---- 1. ayarlar ----------------------------------------------------------------------------- os::Settings settings; settings.version = app::kVersion; os::Configure(settings); // Oturum kapanınca (ban, süre doldu, başka cihazdan giriş, koruma ihlali, bağlantı koptu): os::OnStop([](const std::string& code) { std::lock_guard g(app::stopMx); app::stopCode = code; app::running = false; }); if (!app::Login()) return 1; os::LicenseInfo lic = os::License(); printf("Giriş tamam. Seviye %d, %s\n", lic.level, lic.lifetime ? "süresiz" : (std::to_string(lic.secondsLeft / 86400) + " gün kaldı").c_str()); // ---- 5. bakım anahtarı ------------------------------------------------------------------------ if (os::Feature("bakim")) { app::Message(os::FeatureText("bakim_mesaj", "Kısa bir bakım yapılıyor.")); os::Logout(); return 0; } // ---- 6. koruma (planında yoksa program yine çalışır) ---------------------------------------- if (os::StartProtection()) os::Log("Koruma açık: " + std::to_string(os::ActiveDetectors().size()) + " dedektör"); // ---- 7. kaynaklar ------------------------------------------------------------------------------ if (!app::PrepareResources()) { os::Logout(); return 1; } os::Log(std::string("Program başladı, sürüm ") + app::kVersion); // ---- 8. ana döngü ------------------------------------------------------------------------------ ULONGLONG lastRefresh = GetTickCount64(); while (app::running) { if (os::Feature("esp")) // bellekten okunur, her turda çağırmak ucuz { // ... özelliğin işi ... } int interval = os::FeatureInt("tarama_ms", 250); if (interval < 50) interval = 50; // ... ürünün asıl işi ... ULONGLONG now = GetTickCount64(); if (now - lastRefresh > 5 * 60000) // 5 dakikada bir paneldeki değişiklikleri al { os::RefreshFeatures(); lastRefresh = now; } if (GetAsyncKeyState(VK_END) & 1) break; // kullanıcı çıkmak istedi Sleep((DWORD)interval); } std::string code; { std::lock_guard g(app::stopMx); code = app::stopCode; } if (code.empty()) { os::Logout(); // kullanıcı kendi çıktı: oturumu kapat return 0; } // Oturumu sunucu kapattı. Kullanıcının işini kaydet ve nedenini göster. app::Message("Oturum kapandı: " + os::TextFor(code), MB_ICONWARNING); if (code == "license_expired" || code == "license_banned") app::ForgetKey(); return 0; }