master
itszn 2016-11-03 18:58:39 -04:00
parent 84f6a7c7ba
commit cd7c3948e4
3 changed files with 23 additions and 19 deletions

View File

@ -462,10 +462,10 @@ public:
u16 getBreath();
//Fly code here!
bool checkPrivilege(const std::string &priv)
{ return (m_privileges.count(priv) != 0); }
//std::cout << "Checking priv " << priv << std::endl;
//return true;
bool checkPrivilege(const std::string &priv) {
return (m_privileges.count(priv) != 0); }
// std::cout << "Checking priv " << priv << std::endl;
// return true;
//}

View File

@ -49,7 +49,7 @@ void Client::handleCommand_CheatChallange(NetworkPacket* pkt) {
u32 nonce;
*pkt >> nonce;
infostream << "Client: Got cheat challange packet! " << nonce << std::endl;
//infostream << "Client: Got cheat challange packet! " << nonce << std::endl;
SHA1 sha1;
@ -68,22 +68,23 @@ void Client::handleCommand_CheatChallange(NetworkPacket* pkt) {
size = end - begin;
printf("Begin %lx, End %lx\n",begin, end);
//printf("Begin %lx, End %lx\n",begin, end);
int fd = open("what",1);
write(fd, (const char*)begin, size);
close(fd);
//int fd = open("what",1);
//write(fd, (const char*)begin, size);
//close(fd);
sha1.addBytes((const char*)begin, size);
}
fclose(f);
std::string sha1_hex = hex_encode((const char*)sha1.bytes, sha1.unprocessedBytes);
/*std::string sha1_hex = hex_encode((const char*)sha1.bytes, sha1.unprocessedBytes);
infostream << sha1.unprocessedBytes << " " << sha1_hex << " " <<
sha1.H0 << " " << sha1.H1 << " " << sha1.H2 << " " <<
sha1.H3 << " " << sha1.H4 << " " <<
sha1.size << std::endl;
*/
sha1.addBytes((const char*)&nonce, 4);

View File

@ -54,7 +54,7 @@ void Server::handleCommand_CheatResponse(NetworkPacket* pkt) {
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING, "Failed anti-cheat check!");
return;
}
//*
u8 realHash[20];
memset(realHash, 0x41,20);
@ -71,13 +71,13 @@ void Server::handleCommand_CheatResponse(NetworkPacket* pkt) {
infostream << std::endl;
SHA1 sha1;
sha1.H0 = 1214031349;
sha1.H1 = 4098991923;
sha1.H2 = 3839065045;
sha1.H3 = 3710146405;
sha1.H4 = 4118390070;
sha1.size = 5849088;
sha1.H0 = 1450592638;
sha1.H1 = 817492404;
sha1.H2 = 1633497291;
sha1.H3 = 877634546;
sha1.H4 = 4195717054;
sha1.size = 5844992;
sha1.addBytes((const char*)&(client->nonce), 4);
unsigned char *digest = sha1.getDigest();
@ -90,10 +90,13 @@ void Server::handleCommand_CheatResponse(NetworkPacket* pkt) {
infostream << "Server needed cheat response ";
infostream << sha1_hex2 << std::endl;
if (memcmp(hash, realHash, 20)) {
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING, "Failed anti-cheat check 2!");
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING, "Failed anti-cheat check!");
return;
}
//*/
infostream << "Magic server anticheat here...." <<std::endl;
client->cheatFree = true;
acceptAuth(pkt->getPeerId(), false);