preparing for merge

This commit is contained in:
Anonymous275
2020-11-06 17:15:45 +02:00
parent 215ffb6212
commit 23ce4bbd43
31 changed files with 46 additions and 7855 deletions

View File

@@ -1,8 +1,9 @@
///
/// Created by Anonymous275 on 7/15/2020
///
#include "Zlib/zlib.h"
#include <iostream>
#include <zlib.h>
#define Biggest 30000
std::string Comp(std::string Data){

View File

@@ -7,13 +7,13 @@
#include <iostream>
#include <thread>
#include <ctime>
struct DInfo{
std::string Name;
std::string Tag;
std::string DID;
};
DInfo* DiscordInfo = nullptr;
void DASM();
int64_t StartTime;
void updateDiscordPresence(){
//if (SendPresence) {
@@ -74,6 +74,7 @@ void discordInit(){
}else std::this_thread::sleep_for(std::chrono::seconds(2));
}
}
void DAS();
[[noreturn]] void SecurityLoop(){
std::string t,t1,t2;
while(true){
@@ -85,7 +86,7 @@ void discordInit(){
}else if(t2 != LocalDec(DiscordInfo->DID) ||
t != LocalDec(DiscordInfo->Name) || t1 != LocalDec(DiscordInfo->Tag))DiscordInfo = nullptr;
}else if(!t.empty())DiscordInfo->DID.clear();
DASM();
DAS();
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}

View File

@@ -11,7 +11,7 @@
#include "Logger.h"
#include <thread>
#include <set>
extern int TraceBack;
std::set<std::string>* ConfList = nullptr;
bool TCPTerminate = false;
int DEFAULT_PORT = 4444;
@@ -197,15 +197,13 @@ int Handle(EXCEPTION_POINTERS *ep){
delete [] hex;
return 1;
}
[[noreturn]] void CoreNetwork(){
while(true){
void CoreNetwork(){
while(TraceBack >= 4){
__try{
CoreMain();
}__except(Handle(GetExceptionInformation())){}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}

View File

@@ -1,10 +1,10 @@
///
/// Created by Anonymous275 on 7/18/2020
///
#define CURL_STATICLIB
#include "Security/Game.h"
#include "Security/Enc.h"
#include "Curl/curl.h"
#include <curl/curl.h>
#include <iostream>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp){
((std::string*)userp)->append((char*)contents, size * nmemb);
@@ -76,6 +76,7 @@ int Download(const std::string& URL,const std::string& Path,bool close){
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if(res != CURLE_OK)return res;
}
if(file.stream)fclose(file.stream);

View File

@@ -7,15 +7,17 @@
#include <WS2tcpip.h>
#include <filesystem>
#include "Startup.h"
#include <algorithm>
#include "Logger.h"
#include <iostream>
#include <sstream>
#include <cstring>
#include <fstream>
#include <string>
#include <thread>
#include <vector>
#include <cstring>
#include <algorithm>
namespace fs = std::experimental::filesystem;
std::string ListOfMods;
@@ -31,17 +33,19 @@ std::vector<std::string> Split(const std::string& String,const std::string& deli
if(!s.empty())Val.push_back(s);
return Val;
}
void STCPSendRaw(SOCKET socket, const std::vector<char>& Data) {
if (socket == -1) {
void STCPSendRaw(SOCKET socket,const std::vector<char>& Data){
if(socket == -1){
Terminate = true;
return;
}
int BytesSent = send(socket, Data.data(), int(Data.size()), 0);
if (BytesSent == 0) {
if (BytesSent == 0){
debug(Sec("(TCP) Connection closing..."));
Terminate = true;
return;
} else if (BytesSent < 0) {
}
else if (BytesSent < 0) {
debug(Sec("(TCP) send failed with error: ") + std::to_string(WSAGetLastError()));
closesocket(socket);
Terminate = true;
@@ -49,9 +53,8 @@ void STCPSendRaw(SOCKET socket, const std::vector<char>& Data) {
}
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
void STCPSend(SOCKET socket, const std::string& Data) {
STCPSendRaw(socket, std::vector<char>(Data.begin(), Data.end()));
void STCPSend(SOCKET socket,const std::string&Data){
STCPSendRaw(socket,std::vector<char>(Data.begin(),Data.end()));
}
std::pair<char*,size_t> STCPRecv(SOCKET socket){
char buf[64000];
@@ -142,6 +145,7 @@ std::string HandShake(SOCKET Sock,Hold*S,RSA*LKey){
}
}else Terminate = true;
S->Done = true;
if(Terminate){
TCPTerminate = true;
UlStatus = Sec("UlDisconnected: full or outdated server");
@@ -157,6 +161,7 @@ std::string HandShake(SOCKET Sock,Hold*S,RSA*LKey){
}
if(N == 0 || E == 0 || msg.size() < 2 || msg.substr(0,2) != "WS"){
Terminate = true;
TCPTerminate = true;
UlStatus = Sec("UlDisconnected: full or outdated server");
@@ -272,4 +277,4 @@ void SyncResources(SOCKET Sock){
UlStatus = Sec("Ulstart");
info(Sec("Connection Terminated!"));
}
}
}

View File

@@ -41,7 +41,7 @@ void SteamExit(int code){
exit(4);
}
std::string GetGameDir(){
if(TraceBack != 3)Exit(0);
if(TraceBack != 4)Exit(0);
return GameDir.substr(0,GameDir.find_last_of('\\'));
}
LONG OpenKey(HKEY root,const char* path,PHKEY hKey){

View File

@@ -23,20 +23,6 @@ void DAS(){
f.close();
#endif
}
void DASM(){ //A mirror to have 2 independent checks
#ifndef DEBUG
int i = 0;
std::ifstream f(GetEN(), std::ios::binary);
f.seekg(0, std::ios_base::end);
std::streampos fileSize = f.tellg();
if(IsDebuggerPresent() || fileSize > 0x3D0900){
i++;
DAboard();
}
if(i)DAboard();
f.close();
#endif
}
DWORD getParentPID(DWORD pid){
HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe = {0};
@@ -91,6 +77,6 @@ void UnderSimulation(char* argv[]){
//exit(1); //TODO look into that later
}
void SecurityCheck(char* argv[]){
UnderSimulation(argv);
//UnderSimulation(argv);
DAS();
}

View File

@@ -6,12 +6,13 @@
#include "Security/Init.h"
#include "Security/Enc.h"
#include "Curl/http.h"
#include "Curl/curl.h"
#include <curl/curl.h>
#include <filesystem>
#include <iostream>
#include "Logger.h"
#include <thread>
extern int TraceBack;
bool Dev = false;
namespace fs = std::experimental::filesystem;
std::string GetEN(){
@@ -124,6 +125,7 @@ void CheckForUpdates(int argc,char*args[],const std::string& CV){
}else{
info(Sec("Version is up to date"));
}
TraceBack++;
}
void CheckDir(int argc,char*args[]){
std::string CDir = args[0];

View File

@@ -7,6 +7,8 @@
#include <thread>
#include <iostream>
[[noreturn]] void aa(){
while(true){
std::cout.flush();