-
Notifications
You must be signed in to change notification settings - Fork 174
/
test_bloat.cpp
52 lines (40 loc) · 1.21 KB
/
test_bloat.cpp
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
/* ------------------------------- ABOUT ---------------------------------------
Obfuscate naive login example (bloat test)
This example login program demonstrates how much bloat is added to the final
executable if AY_OBFUSCATE is used to obfuscate security sensitive strings at
compile-time.
Run test_bloat.py to output a table comparing release and debug configs.
----------------------------------------------------------------------------- */
#include <iostream>
#include <string>
#ifdef USE_AY_OBFUSCATE
#include "obfuscate.h"
#else
#define AY_OBFUSCATE(text) text
#endif
int main()
{
const std::string username(AY_OBFUSCATE("root"));
const std::string password(AY_OBFUSCATE("password"));
std::cout << "Obfuscate naive login example (bloat test)" << std::endl;
std::string input_username;
std::string input_password;
while (true)
{
std::cout << "Username: ";
std::cin >> input_username;
std::cout << "Password: ";
std::cin >> input_password;
if (input_username == username && input_password == password)
{
std::cout << "Login success!" << std::endl;
break;
}
else
{
std::cout << "Login failure: unrecognised username and password"
"combination." << std::endl;
}
}
return 0;
}