mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-10 01:36:16 +00:00
Base for new system
This commit is contained in:
@@ -1,82 +0,0 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 7/16/2020
|
||||
///
|
||||
#include "Discord/discord_info.h"
|
||||
#include "Security/Enc.h"
|
||||
#include <windows.h>
|
||||
#include "Startup.h"
|
||||
#include <tlhelp32.h>
|
||||
#include "Logger.h"
|
||||
#include <fstream>
|
||||
#include <Psapi.h>
|
||||
void DAS(){
|
||||
#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 > 0x4C4B40){
|
||||
i++;
|
||||
DAboard();
|
||||
}
|
||||
if(i)DAboard();
|
||||
f.close();
|
||||
#endif
|
||||
}
|
||||
DWORD getParentPID(DWORD pid){
|
||||
HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
PROCESSENTRY32 pe = {0};
|
||||
DWORD ppid = 0;
|
||||
pe.dwSize = sizeof(PROCESSENTRY32);
|
||||
if(Process32First(h, &pe)){
|
||||
do{
|
||||
if(pe.th32ProcessID == pid){
|
||||
ppid = pe.th32ParentProcessID;
|
||||
break;
|
||||
}
|
||||
}while(Process32Next(h, &pe));
|
||||
}
|
||||
CloseHandle(h);
|
||||
return ppid;
|
||||
}
|
||||
|
||||
HANDLE getProcess(DWORD pid, LPSTR fname, DWORD sz) {
|
||||
HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
|
||||
if (h) {
|
||||
GetModuleFileNameEx(h, nullptr, fname, sz);
|
||||
return h;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void UnderSimulation(char* argv[]){
|
||||
DWORD ppid;
|
||||
std::string Parent(MAX_PATH,0);
|
||||
ppid = getParentPID(GetCurrentProcessId());
|
||||
HANDLE Process = getProcess(ppid, &Parent[0], MAX_PATH);
|
||||
std::string Code = Sec("Code ");
|
||||
if(Process == nullptr){
|
||||
error(Code+std::to_string(2));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
auto P = Parent.find(Sec(".exe"));
|
||||
if(P != std::string::npos)Parent.resize(P + 4);
|
||||
else return;
|
||||
std::string S1 = Sec("\\Windows\\explorer.exe");
|
||||
std::string S2 = Sec("JetBrains\\CLion");
|
||||
std::string S3 = Sec("\\Windows\\System32\\cmd.exe");
|
||||
std::string S4 = Sec("steam.exe");
|
||||
if(Parent == std::string(argv[0]))return;
|
||||
if(Parent.find(S1) == 2)return;
|
||||
if(Parent.find(S2) != std::string::npos)return;
|
||||
if(Parent.find(S3) == 2)return;
|
||||
if(Parent.find(S3) != -1)return;
|
||||
//TerminateProcess(Process, 1);
|
||||
//error(Code + std::to_string(4));
|
||||
//exit(1); //TODO look into that later
|
||||
}
|
||||
void SecurityCheck(char* argv[]){
|
||||
//UnderSimulation(argv);
|
||||
DAS();
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 11/13/2020
|
||||
///
|
||||
#include "Network/network.h"
|
||||
#include "Security/Enc.h"
|
||||
#include <windows.h>
|
||||
#include "Logger.h"
|
||||
#include <psapi.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
|
||||
DWORD getParentPID(DWORD pid);
|
||||
HANDLE getProcess(DWORD pid, LPSTR fname, DWORD sz);
|
||||
|
||||
void Kill(){
|
||||
static bool Run = false;
|
||||
if(!Run)Run = true;
|
||||
else return;
|
||||
while(Run){
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
NetReset();
|
||||
#ifdef DEBUG
|
||||
debug(Sec("Attention! NetReset Check!"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FindDLL(char* args[]){
|
||||
static auto argv = args;
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
std::string Parent(MAX_PATH,0);
|
||||
DWORD ppid = getParentPID(GetCurrentProcessId());
|
||||
HANDLE Process = getProcess(ppid, &Parent[0], MAX_PATH);
|
||||
if(Process == nullptr){
|
||||
HMODULE hMods[1024];
|
||||
DWORD cbNeeded;
|
||||
unsigned int i;
|
||||
if(K32EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)){
|
||||
for ( i = 1; i < (cbNeeded / sizeof(HMODULE)); i++ ){
|
||||
TCHAR szModName[MAX_PATH];
|
||||
if (K32GetModuleFileNameExA(hProcess, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR))){
|
||||
std::string Name(szModName),PName(argv[0]);
|
||||
Name = Name.substr(0,Name.rfind(Sec("\\")));
|
||||
PName = PName.substr(0,PName.rfind(Sec("\\")));
|
||||
if(Name == PName){
|
||||
std::thread t1(Kill);
|
||||
t1.detach();
|
||||
}
|
||||
}
|
||||
ZeroMemory(szModName,MAX_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
26
src/Security/Login.cpp
Normal file
26
src/Security/Login.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 11/26/2020
|
||||
///
|
||||
|
||||
#include "Curl/http.h"
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
//check file if not present flag for login to the core network
|
||||
//to then get user and pass
|
||||
//if present use to contact the backend to refresh and get a public key for servers
|
||||
//public keys are one time use for a random server
|
||||
|
||||
/// "username":"password"
|
||||
/// "Guest":"Name"
|
||||
/// "pk":"private_key"
|
||||
|
||||
|
||||
///TODO: test with no internet connection
|
||||
void CheckLocalKey(){
|
||||
for(int C = 1; C <= 10; C++) {
|
||||
std::cout << PostHTTP("https://auth.beammp.com/userlogin", R"({"username":"Anonymous275", "password":"SimonAS1482001"})") << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
system("pause");
|
||||
}
|
||||
Reference in New Issue
Block a user