lots of work

This commit is contained in:
Anonymous275
2020-05-26 19:13:02 +03:00
parent 6a3ecfc307
commit 4a3235f445
7 changed files with 32 additions and 28 deletions

View File

@@ -11,7 +11,7 @@
extern int DEFAULT_PORT;
std::string HTTP_REQUEST(const std::string&url,int port);
void SyncResources(const std::string& IP, int port);
void ProxyThread(const std::string& IP, int port);
void Exit(const std::string& Msg);
extern std::string UlStatus;
extern std::string MStatus;
@@ -21,8 +21,8 @@ extern bool TCPTerminate;
extern bool MPDEV;
void StartSync(const std::string &Data){
//std::thread t1(SyncResources,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
std::thread t1(SyncResources,"127.0.0.1",30814);
std::thread t1(ProxyThread,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
//std::thread t1(ProxyThread,"127.0.0.1",30814);
t1.detach();
}

View File

@@ -46,7 +46,7 @@ void ServerSend(const std::string&Data, bool Rel){
if (C == 'O' || C == 'T')Rel = true;
if(Rel){
if(Data.length() > 1000)TCPSendLarge(Data);
if(Data.length() > 1000 || Data.substr(0,2) == "Od")TCPSendLarge(Data);
else TCPSend(Data);
}
else UDPSend(Data);

View File

@@ -59,6 +59,7 @@ void TCPRcv(){
}
void SyncResources(SOCKET TCPSock);
void TCPClientMain(const std::string& IP,int Port){
WSADATA wsaData;
SOCKADDR_IN ServerAddr;
@@ -87,6 +88,7 @@ void TCPClientMain(const std::string& IP,int Port){
}
getsockname(TCPSock, (SOCKADDR *)&ServerAddr, (int *)sizeof(ServerAddr));
SyncResources(TCPSock);
while(!Terminate){
TCPRcv();
}

View File

@@ -44,9 +44,9 @@ std::string STCPRecv(SOCKET socket){
return std::string(buf);
}
void ProxyThread(const std::string& IP, int port);
void SyncResources(const std::string&IP,int Port){
if(MPDEV)std::cout << "Called" << std::endl;
extern bool Terminate;
void SyncResources(SOCKET TCPSock){
if(MPDEV)std::cout << "SyncResources Called" << std::endl;
std::string FileList;
struct stat info{};
if(stat( "Resources", &info) != 0){
@@ -156,6 +156,4 @@ void SyncResources(const std::string&IP,int Port){
if(WSACleanup() != 0)
if(MPDEV)printf("Client: WSACleanup() failed!...\n");
*/
ProxyThread(IP,Port);
}

View File

@@ -57,7 +57,7 @@ std::string QueryKey(HKEY hKey,int ID)
hKey, // key handle
achClass, // buffer for class name
&cchClassName, // size of class string
NULL, // reserved
nullptr, // reserved
&cSubKeys, // number of subkeys
&cbMaxSubKey, // longest subkey size
&cchMaxClass, // longest class string
@@ -79,9 +79,9 @@ std::string QueryKey(HKEY hKey,int ID)
retCode = RegEnumKeyEx(hKey, i,
achKey,
&cbName,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
&ftLastWriteTime);
if (retCode == ERROR_SUCCESS)
{
@@ -100,22 +100,22 @@ std::string QueryKey(HKEY hKey,int ID)
retCode = RegEnumValue(hKey, i,
achValue,
&cchValue,
NULL,
NULL,
NULL,
NULL);
nullptr,
nullptr,
nullptr,
nullptr);
if (retCode == ERROR_SUCCESS )
{
DWORD lpData = cbMaxValueData;
buffer[0] = '\0';
LONG dwRes = RegQueryValueEx(hKey, achValue, 0, NULL, buffer, &lpData);
LONG dwRes = RegQueryValueEx(hKey, achValue, nullptr, nullptr, buffer, &lpData);
std::string data = reinterpret_cast<const char *const>(buffer);
std::string key = achValue;
switch (ID){
case 1: if(data.find(HTA("737465616d")) != std::string::npos)return data; break;
case 1: if(key == HTA("537465616d50617468") && 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);
case 4: if(key == HTA("75736572706174685f6f76657272696465"))return data;
default: break;
}
@@ -149,11 +149,11 @@ void ExitError(){
}
void Check(){
/*HKEY_CLASSES_ROOT\\beamng\\DefaultIcon
HKEY_USERS\.DEFAULT\Software\Classes\steam\Shell\Open\Command
HKEY_CURRENT_USER\\Software\Valve\Steam\Apps\284160*/
/*.HKEY_CURRENT_USER\Software\Valve\Steam
HKEY_CURRENT_USER\\Software\Valve\Steam\Apps\284160
HKEY_CLASSES_ROOT\\beamng\\DefaultIcon */
//Sandbox Scramble technique
std::string K1 = HTA("2e44454641554c545c536f6674776172655c436c61737365735c737465616d5c5368656c6c5c4f70656e5c436f6d6d616e64");
std::string K1 = HTA("536f6674776172655c56616c76655c537465616d");
std::string K2 = HTA("536f6674776172655c56616c76655c537465616d5c417070735c323834313630");
std::string K3 = HTA("6265616d6e675c44656661756c7449636f6e");
std::string MSG1 = HTA("4572726f722120796f7520646f206e6f74206f776e204265616d4e4721"); //Error! you do not own BeamNG!
@@ -163,12 +163,12 @@ void Check(){
//not used : Warning! you own the game but a cracked game was found on your machine!
HKEY hKey;
LONG dwRegOPenKey = OpenKey(HKEY_USERS, K1.c_str(), &hKey);
LONG dwRegOPenKey = OpenKey(HKEY_CURRENT_USER, K1.c_str(), &hKey);
if(dwRegOPenKey == ERROR_SUCCESS) {
Result = QueryKey(hKey, 1);
if(Result.empty()){Exit(MSG1 + " Code 1");}
SData.push_back(Result);
Result = Result.substr(1,Result.find_last_of('\\')) + HTA("7573657264617461");
Result += HTA("2f7573657264617461");
struct stat buffer{};
if(stat (Result.c_str(), &buffer) == 0){
auto *F = new std::thread(Find,HTA("3238343136302e6a736f6e"),Result);
@@ -198,7 +198,7 @@ void Check(){
}
SData.push_back(Result);
TraceBack++;
}
}else{Exit(MSG2+ ". Code : 5");}
//Memory Cleaning
K3.clear();
//MSG.clear();

View File

@@ -9,12 +9,16 @@ std::string HTTP_REQUEST(const std::string&url,int port);
std::string HTA(const std::string& hex);
void SystemExec(const std::string& cmd);
void WinExec(const std::string& cmd);
void Exit(const std::string& Msg);
void CheckForUpdates(const std::string& CV){
system ("cls");
std::string link = "https://beamng-mp.com/builds/launcher?version=true";
std::string HTTP = HTTP_REQUEST(link,443);
link = "https://beamng-mp.com/builds/launcher?download=true";
if(HTTP.find_first_of("0123456789") == std::string::npos){
Exit("Primary Servers Offline! sorry for the inconvenience!");
}
struct stat buffer{};
if(stat ("BeamMP-Launcher.back", &buffer) == 0)remove("BeamMP-Launcher.back");
if(HTTP > CV){

View File

@@ -87,7 +87,7 @@ int main(int argc, char* argv[]){
const unsigned long long NPos = std::string::npos;
struct stat info{};
std::string ver = "1.1", link, Path = CheckDir(argv[0],ver),HTTP_Result;
std::string ver = "1.22", link, Path = CheckDir(argv[0],ver),HTTP_Result;
std::thread CFU(CheckForUpdates,ver);
CFU.join();
if(argc > 1){