public static bool Initialize()
        {
            // Setting up ENet-Client ->
            if (g_Client == null)
            {
                AllocConsole();
                Console.WriteLine("[ACCOUNT-CHECKER] Account Checker Bot/Client (C) 2020 playingo (aka DEERUX), github.com/playingoDEERUX/growbrewproxy\n" +
                                  "DO NOT CLOSE THIS WINDOW, OTHERWISE THE ENTIRE PROXY WILL CLOSE (except do it when you wanna exit from it)! \n" +
                                  "Although, you can still click on stop checking accounts to gain performance for proxy-only again.");

                if (accountsToCheck == null)
                {
                    Console.WriteLine("[ACCOUNT-CHECKER] ERROR: Could not start Account Checking, accountsToCheck list was null.");
                    return(false);
                }

                if (accountsToCheck.Count() <= 0)
                {
                    Console.WriteLine("[ACCOUNT-CHECKER] ERROR: Could not start Account Checking, there were no accounts loaded.");
                    return(false);
                }

                leftToCheckIndex    = accountsToCheck.Count() - 1;
                g_Client            = new ENetHost(1, 2);
                g_Client.OnConnect += Client_OnConnect;
                g_Client.ChecksumWithCRC32();
                g_Client.CompressWithRangeCoder();
                g_Client.StartServiceThread();
                Console.WriteLine("[ACCOUNT-CHECKER] Initialized Global Client Host and started service thread!\n" +
                                  "\nClick 'Connect and check all accounts' to start checking!");
            }
            return(true);
        }
Example #2
0
        void LaunchProxy()
        {
            if (!srvRunning)
            {
                srvRunning    = true;
                clientRunning = true;

                // Setting up ENet-Server ->
                m_Host            = new ENetHost(new IPEndPoint(IPAddress.Any, 2), 16, 2); // allow only 1 peer to be connected at the same time
                m_Host.OnConnect += Host_OnConnect;
                m_Host.ChecksumWithCRC32();
                m_Host.CompressWithRangeCoder();
                m_Host.StartServiceThread();

                // Setting up ENet-Client ->
                client            = new ENetHost(16, 2);
                client.OnConnect += Client_OnConnect;
                client.ChecksumWithCRC32();
                client.CompressWithRangeCoder();
                client.StartServiceThread();


                // Setting up controls
                runproxy.Enabled             = false; // too lazy to make it so u can disable it via button
                labelsrvrunning.Text         = "Server is running!";
                labelsrvrunning.ForeColor    = Color.Green;
                labelclientrunning.Text      = "Client is running!";
                labelclientrunning.ForeColor = Color.Green;
            }
        }
Example #3
0
        public static void LaunchProxy()
        {
            if (!globalUserData.srvRunning)
            {
                globalUserData.srvRunning    = true;
                globalUserData.clientRunning = true;

                // Setting up ENet-Server ->

                m_Host = new ENetHost(new IPEndPoint(IPAddress.Any, 2), 32, 10, 0, 0);
                m_Host.ChecksumWithCRC32();
                m_Host.CompressWithRangeCoder();
                m_Host.EnableNewProtocol(2);

                // Setting up ENet-Client ->
                client = new ENetHost(null, 64, 10); // for multibotting, coming soon.
                client.ChecksumWithCRC32();
                client.CompressWithRangeCoder();
                client.EnableNewProtocol(1);

                // realPeer = client.Connect(new IPEndPoint(IPAddress.Parse(globalUserData.Growtopia_Master_IP), globalUserData.Growtopia_Master_Port), 2, 0);
                //realPeer = client.Connect(new IPEndPoint(IPAddress.Parse(globalUserData.Growtopia_Master_IP), globalUserData.Growtopia_Master_Port), 2, 0);
                doProxy();

                // Setting up controls
                Console.WriteLine("RUnning!");
            }
        }
Example #4
0
        public static async Task Main()
        {
            try
            {
                Console.WriteLine("Gt server testing");
                ManagedENet.Startup();
                await UpdateItemsDat();

                IPEndPoint address = new IPEndPoint(IPAddress.Any, 17091);
                Server = new ENetHost(address, 1024, 10);
                Server.ChecksumWithCRC32();
                Server.CompressWithRangeCoder();

                await SetItemsDataDB();
                await SetItemsDB();

                await DbContext.OpenConnection();

                Console.WriteLine("Success at opening MySql connection!");
                Server.OnConnect += Server_OnConnect;
                Server.StartServiceThread();
                Thread.Sleep(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("Critical error occured ! Message : " + e.Message);
            }
        }
Example #5
0
 private void animaButton2_Click(object sender, EventArgs e)
 {
     eNet            = new ENetHost(1, 2);
     eNet.OnConnect += Client_OnConnect;
     eNet.CompressWithRangeCoder();
     eNet.ChecksumWithCRC32();
     eNet.StartServiceThread();
     eNetP = eNet.Connect(new System.Net.IPEndPoint(IPAddress.Parse(Growtopia_Master_IP), Growtopia_Master_Port), 2, 0);
 }
Example #6
0
        public static void Build()
        {
            ManagedENet.Startup();
            Port    = 17091;
            Address = new IPEndPoint(IPAddress.Any, Port);
            Host    = new ENetHost(Address, 1024, 1);
            Host.ChecksumWithCRC32();
            Host.CompressWithRangeCoder();

            Console.WriteLine("Server core has been built.\n" +
                              $"    [-] Port : {Port}\n");
        }
Example #7
0
        private static void Main(string[] args)
        {
            ManagedENet.Startup();

            Console.WriteLine("Setting up Local Server");
            LocalServer = new ENetHost(new IPEndPoint(IPAddress.Any, 17091), 1024, 10, 0, 0);
            LocalServer.ChecksumWithCRC32();
            LocalServer.CompressWithRangeCoder();

            LocalServer.OnConnect += (sender, eventArgs) =>
            {
                LogClient("Connected!");

                RemotePeer = RemoteServer.Connect(RemoteEndpoint, 1, 0);

                RemotePeer.OnReceive += (o, packet) =>
                {
                    SendToClient(packet);
                };

                eventArgs.Peer.OnReceive += (o, packet) =>
                {
                    SendToRemote(packet);
                };

                eventArgs.Peer.OnDisconnect += (o, u) =>
                {
                    RemotePeer.DisconnectNow(0);
                    LogClient("Disconnected!");
                };
            };

            LocalServer.StartServiceThread();

            Console.WriteLine("Setting up Remote Server");

            RemoteServer = new ENetHost(1, 10);
            RemoteServer.ChecksumWithCRC32();
            RemoteServer.CompressWithRangeCoder();

            RemoteServer.OnConnect += (sender, eventArgs) => LogServer("Connected!");

            RemoteServer.StartServiceThread();

            while (true)
            {
                Thread.Sleep(5);
            }
        }
Example #8
0
 private void animaButton5_Click(object sender, EventArgs e)
 {
     animaTextBox4.Enabled = false;
     animaTextBox3.Enabled = false;
     animaButton6.Enabled  = false;
     animaButton5.Enabled  = false;
     ManagedENet.Startup();
     eNet            = new ENetHost(1, 2);
     eNet.OnConnect += Client_OnConnect;
     eNet.CompressWithRangeCoder();
     eNet.ChecksumWithCRC32();
     eNet.StartServiceThread();
     eNetP = eNet.Connect(new System.Net.IPEndPoint(IPAddress.Parse(Growtopia_Master_IP), Growtopia_Master_Port), 2, 0);
     updatestatus("Connected!", 2);
 }
Example #9
0
        public ENetServer(string hostname, ushort port = 17091)
        {
            ManagedENet.Startup();

            var address = new IPEndPoint(IPAddress.Any, port);

            if (hostname != "0.0.0.0")
            {
                var addresses = Dns.GetHostAddresses(hostname);
                if (addresses.Length == 0)
                {
                    throw new ArgumentException("Unable to retrieve address from specified host name.", nameof(hostname));
                }

                address = new IPEndPoint(addresses[0], port);
            }

            _host = new ENetHost(address, 1024, 10);
            _host.ChecksumWithCRC32();
            _host.CompressWithRangeCoder();

            InstanceId = Guid.NewGuid();

            OnConnect += (sender, args) =>
            {
                Console.WriteLine("A new Peer tries to connect!");
                lock (Peers)
                    Peers.Add(args.Peer);

                var player = new Player(args.Peer);
                player.OnConnect();

                args.Peer.OnDisconnect += (o, u) =>
                {
                    lock (Peers)
                        Peers.Remove(o as ENetPeer);

                    player.OnDisconnect();
                };
            };

            _host.OnConnect += OnConnect;
        }
Example #10
0
        public static async Task Main()
        {
            try
            {
                SendDateTime();
                Console.WriteLine("GT SERVER IN C#");
                ManagedENet.Startup();
                await UpdateItemsDat();

                // To check the log. recommend not to lol
                //UseLog = true;

                IPEndPoint address = new IPEndPoint(IPAddress.Any, 17091);
                Server = new ENetHost(address, 1024, 10);
                Server.ChecksumWithCRC32();
                Server.CompressWithRangeCoder();

                await SetItemsDataDB();
                await SetItemsDB();

                await DbContext.OpenConnection();

                SendDateTime();
                Console.WriteLine("Success at opening MySql connection!");
                SendDateTime();
                Console.WriteLine("Server created.");
                Server.OnConnect += Server_OnConnect;
                Server.StartServiceThread();
                Thread.Sleep(-1);
            }
            catch (Exception e)
            {
                SendDateTime();
                Console.WriteLine("Critical error occured ! Message : " + e.Message);
            }
        }