-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrackme.cpp
More file actions
61 lines (47 loc) · 1.64 KB
/
Copy pathcrackme.cpp
File metadata and controls
61 lines (47 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Backend: leave commented for Vulkan (default), uncomment for D3D11.
//#define SHOBF_BACKEND_D3D11
// Embed prebuilt DXBC, no HLSL text in binary.
//#define SHOBF_D3D11_PRECOMPILED
// Strip validation/exceptions; CMake Release build types define this.
//#define SHOBF_NO_DEBUG
#define SHOBF_BUILD_SEED 0xA5F07E11D3C24B96
#include "shader_obfuscate.hpp"
#include <iostream>
#include <string>
namespace {
const auto kBanner = SHOBF_OBFUSCATE(
"\n=== shobf crackme ===\n"
"The vault opens for those who speak the passphrase.\n",
shobf::seedKey());
const auto kPrompt = SHOBF_OBFUSCATE(
"passphrase> ", shobf::seedKey());
const auto kPass = SHOBF_OBFUSCATE(
"vulk4n_1s_n0t_crypt0", shobf::seedKey());
const auto kWin = SHOBF_OBFUSCATE(
"\n[ACCESS GRANTED] The vault hums open.\n"
"FLAG{gpu_kn3w_y0u_w3r3_tro4ble}\n",
shobf::seedKey());
const auto kFail = SHOBF_OBFUSCATE(
"[denied] wrong passphrase.\n", shobf::seedKey());
}
int main()
{
const std::string banner = shobf::decryptAuto(kBanner);
const std::string prompt = shobf::decryptAuto(kPrompt);
const std::string password = shobf::decryptAuto(kPass);
const std::string winMsg = shobf::decryptAuto(kWin);
const std::string failMsg = shobf::decryptAuto(kFail);
unsigned attempts = 0;
std::cout << banner;
for (;;) {
std::cout << "[" << ++attempts << "] " << prompt << std::flush;
std::string guess;
if (!std::getline(std::cin, guess))
return 0;
if (guess == password) {
std::cout << winMsg << std::flush;
return 0;
}
std::cout << failMsg;
}
}