private void OnPreAuthEvent(ref PreauthEvent ev) { if (WasLastCheckIdle) { Log.Info("Server process resuming.."); } WasLastCheckIdle = false; LastActive = DateTime.UtcNow; }
public void OnPreAuth(ref PreauthEvent ev) { if (GlobalWhitelist.GlobalWhitelistCheck(ev.UserId)) { if (Plugin.verboseMode) { Log.Info($"UserID {ev.UserId} ({ev.Request.RemoteEndPoint.Address}) is whitelisted from VPN and account age checks. Skipping checks."); } return; } if (ev.UserId.Contains("@northwood", StringComparison.InvariantCultureIgnoreCase)) { if (Plugin.verboseMode) { Log.Info($"UserID {ev.UserId} ({ev.Request.RemoteEndPoint.Address}) is a Northwood Studios member. Skipping checks."); } return; } #if Pre10 reader.SetSource(ev.Request.Data.RawData, 15); //13 bytes of handshake + 2 bytes of data if (reader.TryGetString(out var s) && reader.TryGetULong(out var e) && reader.TryGetByte(out var flags)) //We don't care about UserID and preauth expiration date #else reader.SetSource(ev.Request.Data.RawData, 20); //13 bytes of handshake and 3 bytes and 1 int offset if (reader.TryGetBytesWithLength(out var b) && reader.TryGetString(out var s) && reader.TryGetULong(out var e) && reader.TryGetByte(out var flags)) //We don't care about preauth challenge stuff, UserID and preauth expiration date #endif { if ((flags & BypassFlags) > 0) { if (Plugin.verboseMode) { Log.Info( $"UserID {ev.UserId} ({ev.Request.RemoteEndPoint.Address}) have bypass flags (flags: {(int)flags}). Skipping checks."); } return; } if (Plugin.verboseMode) { Log.Info( $"UserID {ev.UserId} ({ev.Request.RemoteEndPoint.Address}) doesn't have bypass flags (flags: {(int)flags})."); } }