Skip to content

Commit 1a9c1d9

Browse files
Added x86 Integrity Check
1 parent de228e1 commit 1a9c1d9

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

x86/example.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
<ClInclude Include="lib\curl\urlapi.h" />
170170
<ClInclude Include="lib\hmac_sha256.h" />
171171
<ClInclude Include="lib\includes.hpp" />
172+
<ClInclude Include="lib\integrity.h" />
172173
<ClInclude Include="lib\nlohmann\adl_serializer.hpp" />
173174
<ClInclude Include="lib\nlohmann\byte_container_with_subtype.hpp" />
174175
<ClInclude Include="lib\nlohmann\detail\conversions\from_json.hpp" />

x86/example.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@
200200
<ClInclude Include="lib\xorstr.hpp">
201201
<Filter>Header Files</Filter>
202202
</ClInclude>
203+
<ClInclude Include="lib\integrity.h">
204+
<Filter>Header Files</Filter>
205+
</ClInclude>
203206
</ItemGroup>
204207
<ItemGroup>
205208
<Library Include="lib\curl\libcurl.lib" />

x86/lib/auth.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include <algorithm>
5656

5757
#include "Security.hpp"
58+
#include "integrity.h"
5859

5960
#define SHA256_HASH_SIZE 32
6061

@@ -71,9 +72,7 @@ bool initalized;
7172

7273
void KeyAuth::api::init()
7374
{
74-
#if defined(__x86_64__) || defined(_M_X64)
75-
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)modify, 0, 0, 0);
76-
#endif
75+
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)modify, 0, 0, 0);
7776

7877
if (ownerid.length() != 10 || secret.length() != 64)
7978
{
@@ -1454,7 +1453,11 @@ void error(std::string message) {
14541453
return patched;
14551454
}
14561455
#elif defined(__i386) || defined(_M_IX86)
1457-
1456+
// code submitted in pull request from https://github.com/autumnlikescode authored by https://github.com/Vasie1337/integrity-check
1457+
auto check_section_integrity() {
1458+
_integrity_check check;
1459+
return check.check_integrity();
1460+
}
14581461
#endif
14591462

14601463
std::string checksum()
@@ -1691,5 +1694,12 @@ DWORD64 FindPattern(BYTE* bMask, const char* szMask)
16911694
}
16921695
}
16931696
#elif defined(__i386) || defined(_M_IX86)
1694-
1697+
// code submitted in pull request from https://github.com/autumnlikescode authored by https://github.com/Vasie1337/integrity-check
1698+
void modify() {
1699+
while (true) {
1700+
if (check_section_integrity()) {
1701+
error(XorStr("check_section_integrity() failed, don't tamper with the program."));
1702+
}
1703+
}
1704+
}
16951705
#endif

0 commit comments

Comments
 (0)