diff --git a/Security.cpp b/Security.cpp index 9cd61e6..f055f22 100644 --- a/Security.cpp +++ b/Security.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #define MAX_KEY_LENGTH 255 #define MAX_VALUE_NAME 16383 @@ -109,14 +110,11 @@ std::string QueryKey(HKEY hKey,int ID) std::string data = reinterpret_cast(buffer); std::string key = achValue; switch (ID){ - case 1: if(key == HTA("496e7374616c6c4c6f636174696f6e") && (data.find(HTA("4265616d4e47")) != std::string::npos)) {return data;} break; + case 1: if(data.find(HTA("737465616d")) != std::string::npos) {return data;} break; case 2: if(key == HTA("4e616d65") && data == HTA("4265616d4e472e6472697665")) {return data;} break; - case 3: return data.substr(0,data.length()-2); break; + case 3: return data.substr(0,data.length()-2); default: break; } - /*if(data.find(':') != std::string::npos){ - return data.substr(0,data.length()-2); - }*/ } } } @@ -126,42 +124,56 @@ std::string QueryKey(HKEY hKey,int ID) std::vector Check(){ /*HKEY_CLASSES_ROOT\\beamng\\DefaultIcon - HKEY_LOCAL_MACHINE\\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 284160 + HKEY_USERS\.DEFAULT\Software\Classes\steam\Shell\Open\Command HKEY_CURRENT_USER\\Software\Valve\Steam\Apps\284160*/ //Sandbox Scramble technique - std::string K1 = HTA("534f4654574152455c4d6963726f736f66745c57696e646f77735c43757272656e7456657273696f6e5c556e696e7374616c6c5c"); + std::string K1 = HTA("2e44454641554c545c536f6674776172655c436c61737365735c737465616d5c5368656c6c5c4f70656e5c436f6d6d616e64"); std::string K2 = HTA("536f6674776172655c56616c76655c537465616d5c417070735c323834313630"); std::string K3 = HTA("6265616d6e675c44656661756c7449636f6e"); std::string MSG1 = HTA("4572726f722120796f7520646f206e6f74206f776e204265616d4e4721"); //Error! you do not own BeamNG! std::string MSG2 = HTA("4572726f722120506c6561736520436f6e7461637420537570706f7274"); //Error! Please Contact Support std::string MSG3 = HTA("596f7520646f206e6f74206f776e207468652067616d65206f6e2074686973206d616368696e6521"); //You do not own the game on this machine! - std::string MSG = HTA("5761726e696e672120796f75206f776e207468652067616d6520627574206120637261636b65642067616d652077617320666f756e64206f6e20796f7572206d616368696e6521"); - //Warning! you own the game but a cracked game was found on your machine! + //std::string MSG = HTA("5761726e696e672120796f75206f776e207468652067616d6520627574206120637261636b65642067616d652077617320666f756e64206f6e20796f7572206d616368696e6521"); + //not used : Warning! you own the game but a cracked game was found on your machine! HKEY hKey; - LONG dwRegOPenKey = OpenKey(HKEY_LOCAL_MACHINE, K1.c_str(), &hKey); - if(dwRegOPenKey == ERROR_SUCCESS) { - Result = QueryKey(hKey, 0); - if(Result.empty()){Exit(MSG1);} - Data.push_back(Result); - K1 += Result; - TraceBack++; - }else{Exit(MSG2);} - - RegCloseKey(hKey); - dwRegOPenKey = OpenKey(HKEY_LOCAL_MACHINE, K1.c_str(), &hKey); + LONG dwRegOPenKey = OpenKey(HKEY_USERS, K1.c_str(), &hKey); if(dwRegOPenKey == ERROR_SUCCESS) { Result = QueryKey(hKey, 1); - if(Result.empty()){Exit(MSG1);} + if(Result.empty()){Exit(MSG1 + " Code 1");} Data.push_back(Result); + Result = Result.substr(1,Result.find_last_of('\\')) + HTA("7573657264617461"); + struct stat buffer{}; + if(stat (Result.c_str(), &buffer) == 0){ + std::string cmd = HTA("6469722022") + Result + HTA("5c3238343136302e6a736f6e22202f73202f70"); + std::array Buffer{}; + std::string result; + std::unique_ptr pipe(_popen(cmd.c_str(), "r"), _pclose); + cmd.clear(); + if (!pipe) { + Exit(MSG2+ ". Code: 0"); + } + while (fgets(Buffer.data(), Buffer.size(), pipe.get()) != nullptr) { + result += Buffer.data(); + } + if(result.size() > 100 && result.find_last_of("Byte") != std::string::npos){ + int pos = result.find_last_of("Byte"); + while(result.substr(pos,4) != "File"){pos--;} + while(!isdigit(result.at(pos))){pos--;} + if((result.substr(pos,1).at(0) - 48) == 0) Exit(MSG1 + " Code 2"); + }else Exit(MSG1 + " Code 3"); + result.clear(); + }else Exit(MSG2 + ". Code: 2"); + Result.clear(); TraceBack++; - }else{Exit(MSG3);} + }else{Exit(MSG2 + ". Code: 3");} + K1.clear(); RegCloseKey(hKey); dwRegOPenKey = OpenKey(HKEY_CURRENT_USER, K2.c_str(), &hKey); if(dwRegOPenKey == ERROR_SUCCESS) { Result = QueryKey(hKey, 2); - if(Result.empty()){Exit(MSG1);} + if(Result.empty()){Exit(MSG1+ " Code 4");} Data.push_back(Result); TraceBack++; }else{Exit(MSG3);} @@ -171,15 +183,14 @@ std::vector Check(){ if(dwRegOPenKey == ERROR_SUCCESS) { Result = QueryKey(hKey, 3); if(Result.empty()){ - Exit(MSG2); - }else if(Result.find(Data.at(1)) != 0){ - Exit(MSG); + Exit(MSG2 + ". Code: 4"); } + Data.push_back(Result); TraceBack++; } //Memory Cleaning K3.clear(); - MSG.clear(); + //MSG.clear(); MSG1.clear(); MSG2.clear(); MSG3.clear(); diff --git a/http.cpp b/http.cpp index f8e4bd9..fda2a44 100644 --- a/http.cpp +++ b/http.cpp @@ -2,10 +2,11 @@ /// Created by Anonymous275 on 3/17/2020 /// -#include #include +#include #include #include +#include std::string HTTP_REQUEST(){ @@ -59,5 +60,5 @@ std::string HTTP_REQUEST(){ closesocket(Socket); WSACleanup(); - return website_HTML; + return website_HTML.substr(website_HTML.find("[{"),website_HTML.size()); } \ No newline at end of file diff --git a/main.cpp b/main.cpp index 5df09c1..abe381f 100644 --- a/main.cpp +++ b/main.cpp @@ -21,10 +21,12 @@ int main() //Security std::vector Data = Check(); std::cout << "You own BeamNG on this machine!" << std::endl; - std::cout << Data.at(1) << "\\BeamNG.drive.exe"; - std::cout << "\nHTTP TEST :\n\n"; - std::cout << HTTP_REQUEST(); + + //std::cout << Data.at(1) << "\\BeamNG.drive.exe"; + //std::cout << "\nHTTP TEST :\n\n"; + + //std::cout << HTTP_REQUEST(); /// Update, Mods ect...