www.pudn.com > warsrc.rar > IPchkExt.h
// IPchkExt.h
class CIPchkExt;
// List of connections to watch over
class CIPConnList
{
private:
CIPConnList(LPCSTR Name);
public:
~CIPConnList();
static BOOL VerifyConnection(CSock *pSock, CIPConnList **ppConn);
static CIPConnList *Find(LPCSTR Name);
static CIPConnList *Find(CSock *pSock, CString& Name);
static void KillAll(CIPchkExt *pExt);
BOOL IsBanned(USER User, CSock *pSock);
CString m_Name; // IP name as 127.0.0.1
int m_BadPwdCnt; // Bad password count
CWarTimer m_Expiry; // Time to forget this node
DWORD m_ExpiryVal;
CWarTimer m_Suspend; // Suspended until...
DWORD m_SuspendVal;
BOOL m_IsHacker; // Marked as hacker!
};
class CIPchkSock : public CSocketAPI
{
public:
int OnConnect(int Event, WPARAM wParam, LPARAM lParam);
int OnVerifyIPAddress(int Event, WPARAM wParam, LPARAM lParam);
int OnBadPassword(int Event, WPARAM wParam, LPARAM lParam);
int OnHasLoggedOn(int Event, WPARAM wParam, LPARAM lParam);
int OnVerifyLogin(int Event, WPARAM wParam, LPARAM lParam);
int m_SessionBadPwdCnt; // Bad password count this session
};
class CIPchkExt : public CDaemonAPI
{
public:
CIPchkExt();
~CIPchkExt();
void LogMsg(int flag, LPCSTR Format, ...);
virtual void InitializeCOptions(); // Required function
int OnVerifyIPAddress(int Event = 0, WPARAM wParam = 0, LPARAM lParam = 0);
// COptions variables
int m_ConnectionDelay; // Delay in minutes before a user can connect again
int m_MaxPasswdRetries; // Max passord retries before kick
int m_PasswdRetryDelay; // Delay in minutes before new connection after n bad passwords
int m_MaxPasswdHacks; // Max bad passwords before we consider thsi a hacking attempt
int m_HackDely; // Delay (in hours) before a IP is opened after a hack attempt
CLinkedList m_History; // CIPConnList
};
BOOL IPVerifyRule(LPCSTR Rule,int **IPmask);
BOOL IPGenericIsIpInList(LPCSTR IPaddess,CString &cList);
void TranslateList(CString &Val);