![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cNetAddrTracker.h>
Public Member Functions | |
| cNetAddrTracker (const cNetAddress &addr) | |
| virtual | ~cNetAddrTracker () |
| cString | get_Name () const |
| HASHCODE_t | get_HashCode () const noexcept |
| cStringA | get_DescString () const |
| bool | LookupHostName () |
| HRESULT | DisposeThis () |
| bool | IsNeverDecay () const |
| When to delete this IP tracking record? More... | |
| void | BumpDecayTimeSec (TIMESECD_t iSeconds) |
| bool | IsBlocked () const |
| Is this IP blocked from connecting. More... | |
| bool | SetBlocked (TIMESECD_t iTimeDecaySeconds, const char *pszReason) |
| bool | onTickAddr (int iRefCount) |
| int | get_Pings () const |
| Transient Activity tracking info. More... | |
| bool | IncPingBlock (bool bPreAccept=false) |
| Some event has occurred. More... | |
| bool | IncBadPassword (const char *pszAttackedAccountName) |
| void | put_Account (cRefBase *pAccount) |
| cRefBasePtr | get_Account () const |
Public Member Functions inherited from Gray::cThreadLockableRef | |
| cThreadLockableRef (int iStaticRefCount=0) noexcept | |
| virtual | ~cThreadLockableRef () |
| virtual void | onThreadLockFail (TIMESYSD_t dwWaitMS) |
Public Member Functions inherited from Gray::cRefBase | |
| cRefBase (int iRefCount=0) noexcept | |
| virtual | ~cRefBase () |
| int | get_RefCount () const noexcept |
| HASHCODE_t | get_HashCode () const noexcept |
| STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept | |
| virtual void | onFinalRelease () |
| bool | isValidObj () const noexcept |
| STDMETHOD_ (ULONG, AddRef)(void) override | |
| STDMETHOD_ (ULONG, Release)(void) override | |
| STDMETHOD() | QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override |
| void | IncRefCount () |
| void | DecRefCount () |
| bool | isStaticConstruct () const noexcept |
| void | StaticConstruct () |
| void | StaticDestruct () |
| bool | isDestructing () noexcept |
| void | SetDestructing () |
Public Member Functions inherited from Gray::cThreadLockStub | |
| THREADID_t | get_ThreadLockOwner () const |
Public Attributes | |
| cNetAddress | m_addr |
| The remote address we are tracking. IP4 OR IP6. More... | |
| cStringA | m_sIPHost |
| Look up this IP host name. reverse DNS lookup. (Maybe async lookup) More... | |
| cStringA | m_sDescription |
| Description of why this IP is blocked. or why we track it. More... | |
| bool | m_bTrusted |
| This is a trusted IP. (don't ever block it. e.g. localhost) More... | |
Static Public Attributes | |
| static const TIMESECD_t | k_PING_WINDOW_LEN = (5 * 60) |
| static const int | k_PINGS_PER_WINDOW = 5 * 10 |
| static const TIMESECD_t | k_BLOCK_LEN = (60) |
Protected Attributes | |
| cTimeInt | m_timeCreated |
| When was this record created? More... | |
| cTimeInt | m_timeDecay |
| Time this record should be gone. (may be set to NEVER) More... | |
| cTimeInt | m_timeBlockTil |
| Blocked until this time. More... | |
| cTimeInt | m_timeWindowStart |
| My ping check window started at this time. More... | |
| cTimeInt | m_timeLastEvent |
| Last time we last interacted with this IP. More... | |
| int | m_iPings |
| How many pings have we seen since m_timeWindowStart. More... | |
| int | m_iBadPasswords |
| How many bad passwords since m_timeWindowStart. More... | |
| cRefBasePtr | m_pAccount |
| associate this IP address with an account. (allow auto log in based on IP?) More... | |
Friends | |
| class | cClientAddrObj |
| To Expose this stuff to cXObjDef. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Gray::cLockableBase | |
| cLockableBase () noexcept | |
| ~cLockableBase () | |
| LONG | get_LockCount () const |
| bool | isLocked () const |
| void | IncLockCount () |
| LONG | DecLockCount () |
| void | Lock () |
| LONG | Unlock () |
a Tracked / Blocked address for a server. Shared information about bad actors to any server type. Keep a log of recent IP's/address's/clients a server has talked to (or tried to). Even if not authenticated. Used to prevent DoS attacks, ping floods, password guessing, fuzz, general hacking, etc.
| GrayLib::cNetAddrTracker::cNetAddrTracker | ( | const cNetAddress & | addr | ) |
|
virtual |
| void GrayLib::cNetAddrTracker::BumpDecayTimeSec | ( | TIMESECD_t | iSeconds | ) |
Keep this around longer.
| HRESULT GrayLib::cNetAddrTracker::DisposeThis | ( | void | ) |
|
inline |
CAccount attached to this address?
| cStringA GrayLib::cNetAddrTracker::get_DescString | ( | ) | const |
m_sDescription
|
inlinenoexcept |
|
inline |
|
inline |
Transient Activity tracking info.
| bool GrayLib::cNetAddrTracker::IncBadPassword | ( | const char * | pszAttackedAccountName | ) |
If we get too many bad passwords from an IP in 15 minute window Then block this for a bit from this address.
| bool GrayLib::cNetAddrTracker::IncPingBlock | ( | bool | bPreAccept = false | ) |
Some event has occurred.
A ping has occurred from this ip. Have we had too many pings in a short time ?
| bool GrayLib::cNetAddrTracker::IsBlocked | ( | ) | const |
Is this IP blocked from connecting.
this IP is blocked until some future time ?
| bool GrayLib::cNetAddrTracker::IsNeverDecay | ( | ) | const |
When to delete this IP tracking record?
| bool GrayLib::cNetAddrTracker::LookupHostName | ( | ) |
Populate m_sIPHost via reverse DNS lookup.
| bool GrayLib::cNetAddrTracker::onTickAddr | ( | int | iRefCount | ) |
Periodically decay the list.
|
inline |
Attach an Account when success login for this IP. Clears the amount of bad passwords tried.
| bool GrayLib::cNetAddrTracker::SetBlocked | ( | TIMESECD_t | iTimeDecaySeconds, |
| const char * | pszReason | ||
| ) |
Block this IP.
|
friend |
To Expose this stuff to cXObjDef.
|
static |
|
static |
|
static |
| cNetAddress GrayLib::cNetAddrTracker::m_addr |
The remote address we are tracking. IP4 OR IP6.
| bool GrayLib::cNetAddrTracker::m_bTrusted |
This is a trusted IP. (don't ever block it. e.g. localhost)
|
protected |
How many bad passwords since m_timeWindowStart.
|
protected |
How many pings have we seen since m_timeWindowStart.
|
protected |
associate this IP address with an account. (allow auto log in based on IP?)
based on something like cAuthUser or CAccount
| cStringA GrayLib::cNetAddrTracker::m_sDescription |
Description of why this IP is blocked. or why we track it.
| cStringA GrayLib::cNetAddrTracker::m_sIPHost |
Look up this IP host name. reverse DNS lookup. (Maybe async lookup)
|
protected |
Blocked until this time.
|
protected |
When was this record created?
|
protected |
Time this record should be gone. (may be set to NEVER)
|
protected |
Last time we last interacted with this IP.
|
protected |
My ping check window started at this time.