Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
134
Server/NFAuthTool/NFAuthClient/AuthClient.cpp
Normal file
134
Server/NFAuthTool/NFAuthClient/AuthClient.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "AuthClient.h"
|
||||
#include <conio.h>
|
||||
|
||||
#include "Nave/NFFilePtr.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "MD5/global.h"
|
||||
#include "MD5/md5.h"
|
||||
}
|
||||
|
||||
void GetMD5(char* file, char* outMD5)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// MD5<44><35> <20><><EFBFBD>ϴ<EFBFBD> <20>Լ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5>Ѵ<EFBFBD>.
|
||||
char* fileDat = NULL;
|
||||
long len;
|
||||
|
||||
if(1)
|
||||
{
|
||||
Nave::NFFilePtr fp(file, "rb");
|
||||
|
||||
len = fp.Length();
|
||||
fileDat = new char[len];
|
||||
|
||||
fread(fileDat, len, 1, fp);
|
||||
}
|
||||
|
||||
MD5_CTX context;
|
||||
unsigned char digest[16] ;
|
||||
memset( digest, 0, sizeof( char ) * 16 ) ;
|
||||
|
||||
MD5Init(&context);
|
||||
MD5Update(&context, reinterpret_cast<unsigned char *>( fileDat ), len );
|
||||
MD5Final(digest, &context);
|
||||
|
||||
char strMD5[40];
|
||||
ZeroMemory(strMD5, sizeof(strMD5));
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
sprintf(strMD5 + i * 2, "%02x", digest[i]);
|
||||
}
|
||||
|
||||
if(fileDat)
|
||||
delete fileDat;
|
||||
|
||||
strcpy(outMD5, strMD5);
|
||||
}
|
||||
|
||||
CNetAuth g_NetAuth;
|
||||
NFIPSec g_IPSec;
|
||||
|
||||
CPacketEvent::CPacketEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CPacketEvent::~CPacketEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CPacketEvent::EventIRC(CHAR* strCmd, CHAR* strMsg)
|
||||
{
|
||||
// printf("%s : %s\n", strCmd, strMsg);
|
||||
}
|
||||
|
||||
void CPacketEvent::EventCMD(DWORD dwCmd, DWORD dwValue)
|
||||
{
|
||||
// <20><><EFBFBD>⼭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD> <20><>Ÿ <20>ٸ<EFBFBD> <20>ൿ<EFBFBD><E0B5BF> <20>ϴ<EFBFBD><CFB4><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
// printf("Command : %d (%d)\n", dwCmd, dwValue);
|
||||
|
||||
switch(dwCmd)
|
||||
{
|
||||
case SC_SHUTDOWN: // <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
exit(0); // <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>̼<EFBFBD><CCBC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CPacketEvent::EventIPLIST(CHAR Type, CHAR Page, SHORT Count, char* lpIPList_Out)
|
||||
{
|
||||
LPIPINFO ipInfo = (LPIPINFO)lpIPList_Out;
|
||||
|
||||
if(Page == 1)
|
||||
{
|
||||
if(Type == 0)
|
||||
{
|
||||
g_IPSec.ClearAllowIP();
|
||||
// printf("============= Allow IP ==============\n");
|
||||
}
|
||||
else if(Type == 1)
|
||||
{
|
||||
g_IPSec.ClearBlockIP();
|
||||
// printf("============= Block IP ==============\n");
|
||||
}
|
||||
}
|
||||
|
||||
g_IPSec.SerializeIn(Type, Count, lpIPList_Out);
|
||||
|
||||
/*
|
||||
int aC = g_IPSec.GetAllowIPCount();
|
||||
|
||||
char ip1[32];
|
||||
char ip2[32];
|
||||
sockaddr_in sip1, sip2;
|
||||
for(int i = 0; i < Count; ++i)
|
||||
{
|
||||
sip1.sin_addr.s_addr = htonl(ipInfo->start);
|
||||
sip2.sin_addr.s_addr = htonl(ipInfo->end);
|
||||
strcpy(ip1,inet_ntoa(sip1.sin_addr));
|
||||
strcpy(ip2,inet_ntoa(sip2.sin_addr));
|
||||
|
||||
printf("%s - %s\n", ip1, ip2 );
|
||||
ipInfo++;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CPacketEvent::EventConnect(BOOL bConnect)
|
||||
{
|
||||
/*
|
||||
if(bConnect)
|
||||
printf("Connect\n");
|
||||
else
|
||||
printf("Connect Faild\n");
|
||||
*/
|
||||
}
|
||||
|
||||
void CPacketEvent::EventSocketClose()
|
||||
{
|
||||
// printf("Disconnect\n");
|
||||
}
|
||||
Reference in New Issue
Block a user