-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathmain.cpp
2610 lines (2240 loc) · 138 KB
/
main.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include "api/Swifty.hpp"
#include "pch.h"
#include "resource.h"
#include <filesystem>
#include "mem.h"
#include <fstream>
#include <Windows.h>
#include <tlhelp32.h>
#include <thread>
#include <filesystem>
#include "Discord.h"
#include <urlmon.h>
#include"Memx.h"
#include "gui.h"
#include"Settings.h"
#include <thread>
#include "main.h"
#include <Windows.h>"
#include "imgui\imgui.h"
#include "mem.h"
#include <Windows.h>
#include "auth.hpp"
#include <string>
#include "skStr.h"
std::string tm_to_readable_time(tm ctx);
static std::time_t string_to_timet(std::string timestamp);
static std::tm timet_to_tm(time_t timestamp);
using namespace KeyAuth;
std::string name = "Mustafa Bypass"; // application name. right above the blurred text aka the secret on the licenses tab among other tabs
std::string ownerid = "6fT4gDrJi8"; // ownerid, found in account settings. click your profile picture on top right of dashboard and then account settings.
std::string secret = "ba0803ca95f691bf2fbf3374281e8c00727ee2a03e083fbcc32cb6d48acba6b0"; // app secret, the blurred text on licenses tab and other tabs
std::string version = "1.0"; // leave alone unless you've changed version on website
std::string url = "https://keyauth.win/api/1.1/"; // change if you're self-hosting
std::string sslPin = "ssl pin key (optional)"; // don't change unless you intend to pin public certificate key. you can get here in the "Pin SHA256" field https://www.ssllabs.com/ssltest/analyze.html?d=keyauth.win&latest. If you do this you need to be aware of when SSL key expires so you can update it
api KeyAuthApp(name, ownerid, secret, version, url, sslPin);
#pragma comment(lib, "urlmon.lib")
Discord* g_Discord;
using namespace std;
int progress_func(void* ptr, double TotalToDownload, double NowDownloaded,
double TotalToUpload, double NowUploaded)
{
// ensure that the file to be downloaded is not empty
// because that would cause a division by zero error later on
if (TotalToDownload <= 0.0) {
return 0;
}
// how wide you want the progress meter to be
int totaldotz = 40;
double fractiondownloaded = NowDownloaded / TotalToDownload;
// part of the progressmeter that's already "full"
int dotz = (int)round(fractiondownloaded * totaldotz);
// create the "meter"
int ii = 0;
//printf("%3.0f%% [", fractiondownloaded * 100);
// part that's full already
for (; ii < dotz; ii++) {
//printf("-");
}
for (; ii < totaldotz; ii++) {
//printf(" ");
}
fflush(stdout);
return 0;
}
class DownloadProgress : public IBindStatusCallback {
public:
HRESULT __stdcall QueryInterface(const IID&, void**) {
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE AddRef(void) {
return 1;
}
ULONG STDMETHODCALLTYPE Release(void) {
return 1;
}
HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, IBinding* pib) {
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG* pnPriority) {
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved) {
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError) {
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD* grfBINDF, BINDINFO* pbindinfo) {
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed) {
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, IUnknown* punk) {
return E_NOTIMPL;
}
virtual HRESULT __stdcall OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
progress_func(0, ulProgressMax, ulProgress, 0, 0);
wcout << endl;
return S_OK;
}
};
std::string tm_to_readable_time(tm ctx) {
char buffer[25];
strftime(buffer, sizeof(buffer), "%m/%d/%y", &ctx);
return std::string(buffer);
}
string readFile(string location)
{
string myText;
ifstream MyReadFile(location);
while (getline(MyReadFile, myText)) {
cout << myText;
}
MyReadFile.close();
return myText;
}
void writeToFile(string filepath, string credentials)
{
ofstream MyFile(filepath);
MyFile << credentials;
MyFile.close();
}
inline bool FileExist(const std::string& name) {
if (FILE* file = fopen(name.c_str(), "r")) {
fclose(file);
return true;
}
else {
return false;
}
}
typedef struct _MEMORY_REGION {
DWORD_PTR dwBaseAddr;
DWORD_PTR dwMemorySize;
}MEMORY_REGION;
HANDLE ProcessHandle;
DWORD pid;
typedef LONG(NTAPI* NtSuspendProcess)(IN HANDLE ProcessHandle);
typedef LONG(WINAPI* RtlAdjustPrivilege)(DWORD, BOOL, INT, PBOOL);
typedef LONG(NTAPI* NtResumeProcess)(IN HANDLE ProcessHandle);
void resume(DWORD processId)
{
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
NtResumeProcess pfnNtResumeProcess = (NtResumeProcess)GetProcAddress(
GetModuleHandleA("ntdll"), "NtResumeProcess");
pfnNtResumeProcess(processHandle);
CloseHandle(processHandle);
}
DWORD dGet(DWORD base) {
DWORD val;
ReadProcessMemory(ProcessHandle, (void*)(base), &val, sizeof(val), NULL);
return val;
}
float fGet(DWORD base) {
float val;
ReadProcessMemory(ProcessHandle, (void*)(base), &val, sizeof(val), NULL);
return val;
}
int iGet(DWORD base) {
int val;
ReadProcessMemory(ProcessHandle, (void*)(base), &val, sizeof(val), NULL);
return val;
}
int iwrit(long int addr, float value) {
int val;
WriteProcessMemory(ProcessHandle, (void*)(addr), &value, sizeof(value), NULL);
//pwrite64(handle, &value, 4, addr);
return val;
}
bool WriteMemory(long addr, SIZE_T siz, DWORD write) {
WriteProcessMemory(ProcessHandle, (void*)addr, &write, siz, NULL);
return true;
}
bool replaced(long addr, BYTE write) {
WriteProcessMemory(ProcessHandle, (void*)addr, &write, 1, NULL);
return true;
}
bool patcher(long addr, BYTE write[], SIZE_T sizee) {
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
unsigned long OldProtect;
unsigned long OldProtect2;
VirtualProtectEx(phandle, (void*)addr, sizee, PAGE_EXECUTE_READWRITE, &OldProtect);
WriteProcessMemory(phandle, (void*)addr, write, sizee, NULL);
VirtualProtectEx(phandle, (void*)addr, sizee, OldProtect, NULL);
return true;
}
void suspend(DWORD processId)
{
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
NtSuspendProcess pfnNtSuspendProcess = (NtSuspendProcess)GetProcAddress(
GetModuleHandleA("ntdll"), "NtSuspendProcess");
pfnNtSuspendProcess(processHandle);
CloseHandle(processHandle);
}
HANDLE processHandle;
template <typename T>
T ReadMemoryEx(DWORD BaseAddress, HANDLE phandle)
{
T Buffer;
ReadProcessMemory(phandle, (LPCVOID)BaseAddress, &Buffer, sizeof(Buffer), nullptr);
return Buffer;
}
void WriteUE4Float(DWORD offset, float replace, DWORD pidd, DWORD ue4Header, HANDLE phandle)
{
DWORD oldprotect;
VirtualProtectEx(phandle, (LPVOID)(ue4Header + offset), sizeof(float), PAGE_EXECUTE_READWRITE, &oldprotect);
WriteProcessMemory(phandle, (LPVOID)(ue4Header + offset), &replace, sizeof(float), NULL);
VirtualProtectEx(phandle, (LPVOID)(ue4Header + offset), sizeof(float), PAGE_READONLY, &oldprotect);
}
//DWORD UE4 = ReadMemoryEx<int>(0xE0C3260);
//DWORD TERSAFE = ReadMemoryEx<int>(0xE0C1220);
template<typename T>
T read(uintptr_t ptrAddress)
{
T val = T();
ReadProcessMemory(ProcessHandle, (void*)ptrAddress, &val, sizeof(T), NULL);
return val;
}
template<typename T>
T read(uintptr_t ptrAddress, T val)
{
ReadProcessMemory(ProcessHandle, (void*)ptrAddress, &val, sizeof(val), NULL);
return val;
}
template<typename T>
bool write(uintptr_t ptrAddress, LPVOID value)
{
return WriteProcessMemory(ProcessHandle, (LPVOID)ptrAddress, &value, sizeof(T), NULL);
}
std::string exec(const char* cmd)
{
char buffer[128]; std::string result = "";
FILE* pipe = _popen(cmd, "r");
if (!pipe)
throw std::runtime_error("popen() failed!");
try {
while (fgets(buffer, sizeof buffer, pipe) != NULL)
{
result += buffer;
}
}
catch (...)
{
_pclose(pipe);
throw;
}
_pclose(pipe);
return result;
}
std::string removeSpaces(std::string str)
{
str.erase(remove(str.begin(), str.end(), ' '), str.end());
return str;
}
int MemFind(BYTE* buffer, int dwBufferSize, BYTE* bstr, DWORD dwStrLen)
{
if (dwBufferSize < 0)
{
return -1;
}
DWORD i, j;
for (i = 0; i < dwBufferSize; i++)
{
for (j = 0; j < dwStrLen; j++)
{
if (buffer[i + j] != bstr[j] && bstr[j] != '?')
break;
}
if (j == dwStrLen)
return i;
}
return -1;
}
int SundaySearch(BYTE* bStartAddr, int dwSize, BYTE* bSearchData, DWORD dwSearchSize)
{
if (dwSize < 0)
{
return -1;
}
int iIndex[256] = { 0 };
int i, j;
DWORD k;
for (i = 0; i < 256; i++)
{
iIndex[i] = -1;
}
j = 0;
for (i = dwSearchSize - 1; i >= 0; i--)
{
if (iIndex[bSearchData[i]] == -1)
{
iIndex[bSearchData[i]] = dwSearchSize - i;
if (++j == 256)
break;
}
}
i = 0;
BOOL bFind = FALSE;
//j=dwSize-dwSearchSize+1;
j = dwSize - dwSearchSize + 1;
while (i < j)
{
for (k = 0; k < dwSearchSize; k++)
{
if (bStartAddr[i + k] != bSearchData[k])
break;
}
if (k == dwSearchSize)
{
//ret=bStartAddr+i;
bFind = TRUE;
break;
}
if (i + dwSearchSize >= dwSize)
{
return -1;
}
k = iIndex[bStartAddr[i + dwSearchSize]];
if (k == -1)
i = i + dwSearchSize + 1;
else
i = i + k;
}
if (bFind)
{
return i;
}
else
return -1;
}
BOOL MemSearch(BYTE* bSearchData, int nSearchSize, DWORD_PTR dwStartAddr, DWORD_PTR dwEndAddr, BOOL bIsCurrProcess, int iSearchMode, std::vector<DWORD_PTR>& vRet)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
BYTE* pCurrMemoryData = NULL;
MEMORY_BASIC_INFORMATION mbi;
std::vector<MEMORY_REGION> m_vMemoryRegion;
mbi.RegionSize = 0x1000;
DWORD dwAddress = dwStartAddr;
while (VirtualQueryEx(phandle, (LPCVOID)dwAddress, &mbi, sizeof(mbi)) && (dwAddress < dwEndAddr) && ((dwAddress + mbi.RegionSize) > dwAddress))
{
if ((mbi.State == MEM_COMMIT) && ((mbi.Protect & PAGE_GUARD) == 0) && (mbi.Protect != PAGE_NOACCESS) && ((mbi.AllocationProtect & PAGE_NOCACHE) != PAGE_NOCACHE))
{
MEMORY_REGION mData = { 0 };
mData.dwBaseAddr = (DWORD_PTR)mbi.BaseAddress;
mData.dwMemorySize = mbi.RegionSize;
m_vMemoryRegion.push_back(mData);
}
dwAddress = (DWORD)mbi.BaseAddress + mbi.RegionSize;
}
std::vector<MEMORY_REGION>::iterator it;
for (it = m_vMemoryRegion.begin(); it != m_vMemoryRegion.end(); it++)
{
MEMORY_REGION mData = *it;
DWORD_PTR dwNumberOfBytesRead = 0;
if (bIsCurrProcess)
{
pCurrMemoryData = (BYTE*)mData.dwBaseAddr;
dwNumberOfBytesRead = mData.dwMemorySize;
}
else
{
pCurrMemoryData = new BYTE[mData.dwMemorySize];
ZeroMemory(pCurrMemoryData, mData.dwMemorySize);
ReadProcessMemory(phandle, (LPCVOID)mData.dwBaseAddr, pCurrMemoryData, mData.dwMemorySize, &dwNumberOfBytesRead);
if ((int)dwNumberOfBytesRead <= 0)
{
delete[] pCurrMemoryData;
continue;
}
}
if (iSearchMode == 0)
{
DWORD_PTR dwOffset = 0;
int iOffset = MemFind(pCurrMemoryData, dwNumberOfBytesRead, bSearchData, nSearchSize);
while (iOffset != -1)
{
dwOffset += iOffset;
vRet.push_back(dwOffset + mData.dwBaseAddr);
dwOffset += nSearchSize;
iOffset = MemFind(pCurrMemoryData + dwOffset, dwNumberOfBytesRead - dwOffset - nSearchSize, bSearchData, nSearchSize);
}
}
else if (iSearchMode == 1)
{
DWORD_PTR dwOffset = 0;
int iOffset = SundaySearch(pCurrMemoryData, dwNumberOfBytesRead, bSearchData, nSearchSize);
while (iOffset != -1)
{
dwOffset += iOffset;
vRet.push_back(dwOffset + mData.dwBaseAddr);
dwOffset += nSearchSize;
iOffset = MemFind(pCurrMemoryData + dwOffset, dwNumberOfBytesRead - dwOffset - nSearchSize, bSearchData, nSearchSize);
}
}
if (!bIsCurrProcess && (pCurrMemoryData != NULL))
{
delete[] pCurrMemoryData;
pCurrMemoryData = NULL;
}
}
return TRUE;
}
int SINGLEAOBSCAN6969(BYTE BypaRep[], SIZE_T size)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
MemSearch(BypaRep, size, 0x00000000, 0x7fffffff, false, 0, Bypassdo);
if (Bypassdo.size() == 1)
{
//MessageBoxA(0, "wtf", 0, 0);
}
if (Bypassdo.size() == 2)
{
//MessageBoxA(0, "ok here we go", 0, 0);
}
if (Bypassdo.size() != 0) {
return Bypassdo[1];
}
}
//int SINGLEAOBSCAN69691(BYTE BypaRep[], SIZE_T size)
//{
// DWORD pid = getAowProcId22();
// HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
// std::vector<DWORD_PTR> Bypassdo;
// MemSearch(BypaRep, size, 0x00000000, 0x7fffffff, false, 0, Bypassdo);
// if (Bypassdo.size() == 1)
// {
// //MessageBoxA(0, "wtf", 0, 0);
// }
// if (Bypassdo.size() == 2)
// {
// //MessageBoxA(0, "ok here we go", 0, 0);
// }
// if (Bypassdo.size() != 0) {
// return Bypassdo[1];
// }
//}
int SINGLEAOBSCAN(BYTE BypaRep[], SIZE_T size)
{
if (Settings::Smartgaga)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
//MemSearch(BypaRep, size, 0x70000000, 0x90000000, false, 0, Bypassdo);
MemSearch(BypaRep, size, 0x26000000, 0xB0000000, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
return Bypassdo[0];
}
}
else if (Settings::Gameloop)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
//MemSearch(BypaRep, size, 0x40000000, 0x60000000, false, 0, Bypassdo);
MemSearch(BypaRep, size, 0x26000000, 0xB0000000, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
return Bypassdo[0];
}
}
}
int SINGLEAOBSCAN2(BYTE BypaRep[], SIZE_T size)//this is for tersafe
{
if (Settings::Smartgaga)//For smartgaga
{
int pid = getGagaProcId();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
MemSearch(BypaRep, size, 0x04000000, 0x05000000, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
return Bypassdo[0];
}
}
else if (Settings::Gameloop)//change
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
MemSearch(BypaRep, size, 0x40000000, 0x41000000, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
return Bypassdo[0];
}
}
}
int Keraftonaddr()
{
int libtersafeheader = 0;
BYTE tersafehead[] = { 0x4B, 0x00, 0x52, 0x00, 0x41, 0x00, 0x46, 0x00, 0x54, 0x00, 0x4F, 0x00, 0x4E };
libtersafeheader = SINGLEAOBSCAN6969(tersafehead, sizeof(tersafehead));
return libtersafeheader;
}
int gettersafeheader()
{
int libtersafeheader = 0;
//old //BYTE tersafehead[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x08,0xBD,0x3C };
BYTE tersafehead[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xC0,0xDA,0x3D,0x00,0x00,0x02,0x00,0x05,0x34,0x00,0x20,0x00,0x08,0x00,0x28,0x00,0x1D,0x00,0x1C,0x00,0x06,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00 };
libtersafeheader = SINGLEAOBSCAN2(tersafehead, sizeof(tersafehead));
return libtersafeheader;
}
int getGCloud()
{
int libtprtheader = 0;
BYTE GCloud[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xE4,0xA0,0x37,0x00,0x00,0x00,0x00,0x05,0x34,0x00,0x20,0x00,0x08,0x00,0x28,0x00,0x18,0x00,0x17,0x00,0x06,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x34,0x01,0x00,0x00,0x34,0x01,0x00,0x00,0x34,0x01,0x00,0x00,0x13,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
libtprtheader = SINGLEAOBSCAN2(GCloud, sizeof(GCloud));
return libtprtheader;
}
int getue4header()
{
unsigned long libue4header = 0;
//BYTE ue4head[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x24,0x66,0x67 };
BYTE ue4head[] = { 0x7F, 0x45, 0x4C, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x24, 0x26, 0x8A, 0x07, 0x00, 0x02, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x0A, 0x00, 0x28, 0x00, 0x1A, 0x00, 0x19, 0x00, 0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
libue4header = SINGLEAOBSCAN(ue4head, sizeof(ue4head));
return libue4header;
}
int getue4headerVn()
{
unsigned long libue4header = 0;
//BYTE ue4head[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x24,0x66,0x67 };
BYTE ue4head[] = { 0x7F, 0x45, 0x4C, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x24, 0x56, 0x8A, 0x07, 0x00, 0x02, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x0A, 0x00, 0x28, 0x00, 0x1A, 0x00, 0x19, 0x00, 0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
libue4header = SINGLEAOBSCAN(ue4head, sizeof(ue4head));
return libue4header;
}
//int gettrptheader()
//{
// int libtprtheader = 0;
// BYTE tprt[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xA0,0x50,0x07,0x00,0x00,0x02,0x00,0x05,0x34,0x00,0x20,0x00,0x08,0x00,0x28,0x00,0x1B,0x00,0x1A,0x00,0x06,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70 };
// libtprtheader = SINGLEAOBSCAN2(tprt, sizeof(tprt));
// return libtprtheader;
//}
int gettrptheader()
{
int libtprtheader = 0;
BYTE tprt[] = { 0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xA0,0x50,0x07,0x00,0x00,0x02,0x00,0x05,0x34,0x00,0x20,0x00,0x08,0x00,0x28,0x00,0x1B,0x00,0x1A,0x00,0x06,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x07,0x07,0x00,0x70,0x07,0x07,0x00,0x05,0x00,0x00,0x00 };
libtprtheader = SINGLEAOBSCAN2(tprt, sizeof(tprt));
return libtprtheader;
}
int getlibTDataMaster()
{
int libTDataMaste = 0;
BYTE masterhead[] = { 0x7F, 0x45, 0x4C, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x40, 0xF0, 0x25, 0x00, 0x00, 0x02, 0x00, 0x05, 0x34, 0x00, 0x20, 0x00, 0x08, 0x00, 0x28, 0x00, 0x1C, 0x00, 0x1B, 0x00, 0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00 };
libTDataMaste = SINGLEAOBSCAN2(masterhead, sizeof(masterhead));
return libTDataMaste;
}
int getUEend()
{
unsigned long libue4end = 0;
BYTE ue4end[] = { 0xB0, 0xAF, 0x00, 0x80, 0xFF, 0x00, 0xE3, 0x80, 0x00, 0x03, 0x5B, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0xA8, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00 };
libue4end = SINGLEAOBSCAN(ue4end, sizeof(ue4end));
return libue4end;
}
int getTERSend()
{
int libuTERSend = 0;
BYTE TERSend[] = { 0xFF, 0x00, 0xBC, 0x00, 0x03, 0x34, 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x01, 0x5C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
libuTERSend = SINGLEAOBSCAN2(TERSend, sizeof(TERSend));
return libuTERSend;
}
void offsetsearch2(int offset, BYTE write[], SIZE_T size, int header)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
int addr = header + offset;
unsigned long OldProtect;
unsigned long OldProtect2;
VirtualProtectEx(phandle, (BYTE*)addr, size, PAGE_EXECUTE_READWRITE, &OldProtect);
WriteProcessMemory(phandle, (BYTE*)addr, write, size, NULL);
VirtualProtectEx(phandle, (BYTE*)addr, size, OldProtect, NULL);
}
void AOBREP(BYTE BypaRep[], BYTE write[], SIZE_T size, SIZE_T sizee, int numbers)
{
DWORD pid = getProcId2();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
MemSearch(BypaRep, size, 0x00000000, 0x7fffffff, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
for (int i = 0; i < Bypassdo.size() && i < numbers; i++)
{
int results = Bypassdo[i];
patcher(results, write, sizee);
}
}
else
{
}
}
DWORD MyGetProcessId(LPCTSTR ProcessName) // non-conflicting function name
{
PROCESSENTRY32 pt;
HANDLE hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pt.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hsnap, &pt)) { // must call this first
do {
if (!lstrcmpi(pt.szExeFile, ProcessName)) {
CloseHandle(hsnap);
return pt.th32ProcessID;
}
} while (Process32Next(hsnap, &pt));
}
CloseHandle(hsnap); // close handle on failure
return 0;
}
void AOBREP2(BYTE BypaRep[], BYTE write[], SIZE_T size, SIZE_T sizee, int numbers)
{
DWORD pid = MyGetProcessId("AndroidEmulatorEx.exe");
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
std::vector<DWORD_PTR> Bypassdo;
MemSearch(BypaRep, size, 0x00000000, 0x7fffffff, false, 0, Bypassdo);
if (Bypassdo.size() != 0) {
for (int i = 0; i < Bypassdo.size() && i < numbers; i++)
{
int results = Bypassdo[i];
patcher(results, write, sizee);
}
}
else
{
}
}
void findAndReplaceAll(std::string& data, std::string toSearch, std::string replaceStr)
{
size_t pos = data.find(toSearch);
while (pos != std::string::npos)
{
data.replace(pos, toSearch.size(), replaceStr);
pos = data.find(toSearch, pos + replaceStr.size());
}
}
void cmdd(string text)
{
string prim = "/c " + text;
const char* primm = prim.c_str();
ShellExecute(0, "open", "cmd.exe", (LPCSTR)primm, 0, SW_HIDE);
}
void startEmulator(int choices)
{
if (choices == 1)
{
HKEY key;
LONG succeeded;
std::string keyname = "SOFTWARE\\WOW6432Node\\Tencent\\MobileGamePC\\";
std::string processor_name;
vector<string> processor_list;
succeeded = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname.c_str(), NULL, KEY_READ, &key);
if (succeeded == ERROR_SUCCESS)
{
const char* value = "";
DWORD value_size = 0;
char buf[255];
HKEY key1;
string name = keyname + "UI";
succeeded = RegOpenKey(HKEY_LOCAL_MACHINE, name.c_str(), &key1);
if (succeeded == ERROR_SUCCESS)
{
value_size = sizeof(buf);
memset(buf, 0, sizeof(buf));
succeeded = RegQueryValueEx(key1, "InstallPath", 0, 0, (unsigned char*)buf, &value_size);
if (succeeded == ERROR_SUCCESS)
{
string emudir = buf;
string aedir = emudir + "\\AndroidEmulatorEx.exe";
//findAndReplaceAll(aedir, "C:", "\"C:");
aedir.insert(0, 1, '"');
findAndReplaceAll(aedir, ".exe", ".exe\"");
string aedirx = aedir + " -vm 100";
//std::cout << aedirx << std::endl;
cmdd(aedirx.c_str());
}
RegCloseKey(key1);
}
}
else
{
cout << "Your Choice Of Emulator Isn't Installed" << endl;
}
RegCloseKey(key);
}
if (choices == 2)
{
HKEY key;
LONG succeeded;
std::string keyname = "SOFTWARE\\WOW6432Node\\Tencent\\MobileGamePC\\";
std::string processor_name;
vector<string> processor_list;
succeeded = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname.c_str(), NULL, KEY_READ, &key);
if (succeeded == ERROR_SUCCESS)
{
const char* value = "";
DWORD value_size = 0;
char buf[255];
HKEY key1;
string name = keyname + "UI";
succeeded = RegOpenKey(HKEY_LOCAL_MACHINE, name.c_str(), &key1);
if (succeeded == ERROR_SUCCESS)
{
value_size = sizeof(buf);
memset(buf, 0, sizeof(buf));
succeeded = RegQueryValueEx(key1, "InstallPath", 0, 0, (unsigned char*)buf, &value_size);
if (succeeded == ERROR_SUCCESS)
{
string emudir = buf;
string aedir = emudir + "\\AndroidEmulatorEn.exe";//AndroidEmulatorEn
aedir.insert(0, 1, '"');
string aedirx = aedir + " x";
findAndReplaceAll(aedir, ".exe", ".exe\"");
//std::cout << aedir << std::endl;
cmdd(aedir.c_str());
}
RegCloseKey(key1);
}
}
else
{
cout << "Your Choice Of Emulator Isn't Installed" << endl;
}
RegCloseKey(key);
}
if (choices == 3)
{
HKEY key;
LONG succeeded;
std::string keyname = "SOFTWARE\\WOW6432Node\\SmartGaGa\\ProjectTitan\\";
std::string processor_name;
vector<string> processor_list;
succeeded = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname.c_str(), NULL, KEY_READ, &key);
if (succeeded == ERROR_SUCCESS)
{
const char* value = "";
DWORD value_size = 0;
char buf[255];
HKEY key1;
string name = keyname;
succeeded = RegOpenKey(HKEY_LOCAL_MACHINE, name.c_str(), &key1);
if (succeeded == ERROR_SUCCESS)
{
value_size = sizeof(buf);
memset(buf, 0, sizeof(buf));
succeeded = RegQueryValueEx(key1, "InstallDir", 0, 0, (unsigned char*)buf, &value_size);
if (succeeded == ERROR_SUCCESS)
{
string emudir = buf;
string aedir = emudir + "\\Engine\\ProjectTitan.exe";
aedir.insert(0, 1, '"');
findAndReplaceAll(aedir, ".exe", ".exe\"");
//std::cout << aedir << std::endl;
cmdd(aedir.c_str());
}
RegCloseKey(key1);
}
}
else
{
cout << "Your Choice Of Emulator Isn't Installed" << endl;
}
RegCloseKey(key);
}
}
string gen_random(int len) {
string s;
static const char alphanum[] =
"0123456789";
for (int i = 0; i < len; ++i) {
s += alphanum[rand() % (sizeof(alphanum) - 1)];
}
return s;
}
string gen_random2(int len) {
string s;
static const char alphanum[] =
"0123456789"
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < len; ++i) {
s += alphanum[rand() % (sizeof(alphanum) - 1)];
}
return s;
}
std::string random_string(size_t length)
{
auto randchar = []() -> char
{
const char charset[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
const size_t max_index = (sizeof(charset) - 1);
return charset[rand() % max_index];
};
std::string str(length, 0);
std::generate_n(str.begin(), length, randchar);
return str;
}
void fixemuid()
{
std::ofstream outfile("C:\\device_id.txt");
outfile << " <?xml version='1.0' encoding='utf-8' standalone='yes' ?> \n<map>\n <string name=\"install\">dc33f8d6-a036-45d3-ae00-d13eb6cb46b9</string>\n <string name=\"uuid\">" + gen_random2(32) + "</string>\n <string name = \"random\"></string>\n</map>" << std::endl;
outfile.close();
string did = "adb shell settings put secure android_id " + gen_random(31);
}
int Bypass(std::string command)
{
command.insert(0, "/C ");
SHELLEXECUTEINFOA ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "cmd.exe";
ShExecInfo.lpParameters = command.c_str();
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
if (ShellExecuteExA(&ShExecInfo) == FALSE)
return -1;
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
DWORD rv;
GetExitCodeProcess(ShExecInfo.hProcess, &rv);
CloseHandle(ShExecInfo.hProcess);
return rv;
}
void writememx()
{
DWORD pid = getProcId2();
Memory memory;
if (!memory.AttachProcess(pid))
{
MessageBoxA(0, "error attache proccess.", "Error", MB_ICONERROR);
return;
}
entrypoint:
std::string dri = "sc create BUSHIDO binPath= \"C:\\hookdrv.sys\" start=demand type=filesys > nul 2> nul";
Bypass(dri.c_str());
Bypass("sc start BUSHIDO > nul 2> nul");
//DWORD pid = getGagaProcId();
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
int UE4Base, ANOGSBase;
int PTRBase;
int TDMBase;