This commit is contained in:
Anonymous275
2020-07-04 23:58:47 +03:00
parent 83c095ba17
commit c83bc7864a
2 changed files with 14 additions and 4 deletions

View File

@@ -10,6 +10,7 @@
#include "../Settings.hpp"
#include <thread>
std::string HTTP_REQUEST(const std::string& IP,int port);
std::string HTA(const std::string& hex);
struct Sequence{
SOCKET TCPSock;
bool Done = false;
@@ -64,6 +65,15 @@ int Max(){
}
return M;
}
bool IsHex(const std::string&a){
if(a.empty())return false;
for(const char&c : a){
if(c < 48 || tolower(c) > 102){
return false;
}
}
return true;
}
void Identification(SOCKET TCPSock){
auto* S = new Sequence;
S->TCPSock = TCPSock;
@@ -71,8 +81,8 @@ void Identification(SOCKET TCPSock){
Timeout.detach();
std::string Name,DID,Role,Res = TCPRcv(TCPSock),Ver = TCPRcv(TCPSock);
S->Done = true;
if(Ver.size() > 3 && Ver.substr(0,2) == "VC"){
Ver = Ver.substr(2);
if(IsHex(Ver) && Ver.size() > 3 && HTA(Ver).substr(0,2) == "VC"){
Ver = HTA(Ver).substr(2);
if(Ver.length() > 4 || Ver != ClientVersion){
closesocket(TCPSock);
return;