mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-02-16 10:40:46 +00:00
Launcher update to 1.63.5
- async tcp buffer - two way encryption on connect - map security fix - DNS Lookup on connect - fixed bug in beamng security
This commit is contained in:
40
include/Buffer.h
Normal file
40
include/Buffer.h
Normal file
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 8/25/2020
|
||||
///
|
||||
#pragma once
|
||||
void ServerParser(const std::string& Data);
|
||||
class Buffer{
|
||||
public:
|
||||
void Handle(const std::string& Data){
|
||||
Buf += Data;
|
||||
Manage();
|
||||
}
|
||||
void clear(){
|
||||
Buf.clear();
|
||||
}
|
||||
private:
|
||||
std::string Buf;
|
||||
void Manage(){
|
||||
if(!Buf.empty()){
|
||||
std::string::size_type p;
|
||||
if (Buf.at(0) == '\n'){
|
||||
p = Buf.find('\n',1);
|
||||
if(p != -1){
|
||||
std::string R = Buf.substr(1,p-1);
|
||||
std::string_view B(R.c_str(),R.find(char(0)));
|
||||
ServerParser(B.data());
|
||||
Buf = Buf.substr(p+1);
|
||||
Manage();
|
||||
}
|
||||
}else{
|
||||
p = Buf.find('\n');
|
||||
if(p == -1)Buf.clear();
|
||||
else{
|
||||
Buf = Buf.substr(p);
|
||||
Manage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
///
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Buffer.h"
|
||||
void NetReset();
|
||||
extern long long ping;
|
||||
extern bool Dev;
|
||||
void ClearAll();
|
||||
extern int ClientID;
|
||||
extern Buffer Handler;
|
||||
extern bool ModLoaded;
|
||||
extern bool Terminate;
|
||||
extern int DEFAULT_PORT;
|
||||
@@ -17,9 +19,12 @@ extern std::string UlStatus;
|
||||
extern std::string ListOfMods;
|
||||
void UDPSend(std::string Data);
|
||||
[[noreturn]] void CoreNetwork();
|
||||
void SendLarge(std::string Data);
|
||||
void TCPSend(const std::string&Data);
|
||||
void GameSend(const std::string&Data);
|
||||
void SendLarge(const std::string&Data);
|
||||
std::string GetAddr(const std::string&IP);
|
||||
void ServerParser(const std::string& Data);
|
||||
void TCPClientMain(const std::string& IP,int Port);
|
||||
void UDPClientMain(const std::string& IP,int Port);
|
||||
void TCPGameServer(const std::string& IP, int Port);
|
||||
|
||||
|
||||
@@ -4,9 +4,13 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Xor.h"
|
||||
struct RSA{
|
||||
int n = 0;
|
||||
int e = 0;
|
||||
int d = 0;
|
||||
};
|
||||
std::string RSA_D(const std::string& Data,int d, int n);
|
||||
std::string RSA_E(const std::string& Data,int e, int n);
|
||||
std::string LocalEnc(const std::string& Data);
|
||||
std::string LocalDec(const std::string& Data);
|
||||
std::string Encrypt(std::string msg);
|
||||
std::string Decrypt(std::string msg);
|
||||
RSA* GenKey();
|
||||
Reference in New Issue
Block a user