C#:
// Reference: EasyAntiCheat.Server
using ConVar;
using Facepunch;
using Network;
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Timers;
using System.Reflection;
using Oxide.Core;
using Oxide.Core.Plugins;
using Network;
using EasyAntiCheat.Server.Legacy;
namespace Oxide.Plugins
{
[Info(" NoSteam", "Semen", "2.2.8", ResourceId = 1)]
class NoSteam : RustPlugin
{
private EasyAntiCheatServer eac;
public bool EacAuth => true;
public class STEAM_OWNERSHIPTICKET
{
public ulong SteamID;
public uint AppID;
}
public class STEAM_TICKET
{
public uint Length;
public ulong ID;
public ulong SteamID;
public uint ConnectionTime;
public STEAM_OWNERSHIPTICKET Token;
}
public class SteamTicket
{
public ulong SteamID;
public string Username;
public STEAM_TICKET Ticket;
public byte[] Token;
public SteamTicket(Network.Connection connection = null)
{
this.SteamID = 0;
this.Username = string.Empty;
this.Ticket = new STEAM_TICKET();
this.Token = new byte[0];
if (connection != null)
{
this.SteamID = connection.userid;
this.Username = connection.username;
this.Token = connection.token;
}
}
public bool IsSteam
{
get
{
return (this.SteamID != 0 && this.Ticket.SteamID == this.SteamID && this.Ticket.Token.SteamID == this.SteamID);
}
}
public bool IsValid
{
get
{
return (this.IsSteam && this.Ticket.Token.AppID == 252490);
}
}
}
private void Init()
{
this.eac = new EasyAntiCheatServer(ConVar.Server.hostname);
}
private object OnUserApprove(Connection connection)
{
SteamTicket ticket = new SteamTicket(connection);
if (!ticket.IsSteam)
{
if (connection.token.Length == 234 || connection.token.Length == 240)
{
this.eac.RegisterUser(connection.token, connection.userid.ToString());
connection.authStatus = "ok";
ServerMgr.Instance.JoinGame(connection);
UnityEngine.Debug.Log($"[AUTH] [{connection.token.Length}] {connection.username} / {connection.userid}");
return true;
}
UnityEngine.Debug.Log($"[AUTH] [ERROR] {connection.username} Ошибка # {connection.token.Length}");
return false;
}
UnityEngine.Debug.Log($"[AUTH] [ERROR] {connection.username} Ошибка # 1");
return false;
}
private void OnPlayerDisconnected(BasePlayer player, string reason)
{
this.eac.UnregisterUser(player.net.connection.token);
}
}
}