1
0

ProtoProxy: Parsing some initial packets early in the conversation

git-svn-id: http://mc-server.googlecode.com/svn/trunk@834 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-09-04 20:21:23 +00:00
parent 5e5b87a187
commit d50f30c3c4
4 changed files with 452 additions and 54 deletions

View File

@@ -31,7 +31,9 @@ int cServer::Init(short a_ListenPort, short a_ConnectPort)
}
printf("Generating protocol encryption keypair...\n");
AutoSeededRandomPool rng;
time_t CurTime = time(NULL);
RandomPool rng;
rng.Put((const byte *)&CurTime, sizeof(CurTime));
m_PrivateKey.GenerateRandomWithKeySize(rng, 1024);
RSA::PublicKey pk(m_PrivateKey);
m_PublicKey = pk;
@@ -40,7 +42,7 @@ int cServer::Init(short a_ListenPort, short a_ConnectPort)
sockaddr_in local;
memset(&local, 0, sizeof(local));
local.sin_family = AF_INET;
local.sin_addr.s_addr = htonl(0x7f000001); // localhost
local.sin_addr.s_addr = 0; // All interfaces
local.sin_port = htons(a_ListenPort);
bind(m_ListenSocket, (sockaddr *)&local, sizeof(local));
listen(m_ListenSocket, 1);