コード例 #1
1
        public string HandlePacketFromServer(ENetPacket packet)
        {
            if (MainForm.proxyPeer == null)
            {
                return("");
            }
            if (MainForm.proxyPeer.State != ENetPeerState.Connected)
            {
                return("");
            }
            if (MainForm.realPeer == null)
            {
                return("");
            }
            if (MainForm.realPeer.State != ENetPeerState.Connected)
            {
                return("");
            }

            byte[] data = packet.GetPayloadFinal();
            if (data.Length > 5)
            {
                if (data[5] == 3)
                {
                    return("_none_");
                }
            }
            //else
            //{
            //return "_none_";
            //}


            NetTypes.NetMessages msgType = GetMessageType(data);
            switch (msgType)
            {
            case NetTypes.NetMessages.SERVER_HELLO:

                MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): Initial logon accepted." + "\n");
                break;

            case NetTypes.NetMessages.GAME_MESSAGE:

                string str = GetProperGenericText(data);
                MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): A game_msg packet was sent: " + str + "\n");
                if (str.Contains("Server requesting that you re-logon..."))
                {
                    MainForm.token  = 0;
                    MainForm.doorid = "";

                    SwitchServers("213.179.209.168", 17234);

                    return("Server forces logon request, switching server automatically so user does not have to cancel to login menu and reconnect.");
                }
                break;

            case NetTypes.NetMessages.GAME_PACKET:

                byte[] tankPacket = VariantList.get_struct_data(data);
                if (tankPacket == null)
                {
                    break;
                }

                NetTypes.PacketTypes packetType = GetPacketType(tankPacket);


                switch (packetType)
                {
                case NetTypes.PacketTypes.CALL_FUNCTION:
                    VariantList.VarList VarListFetched = VariantList.GetCall(VariantList.get_extended_data(tankPacket));
                    VarListFetched.netID = BitConverter.ToInt32(tankPacket, 4);         // add netid
                    VarListFetched.delay = BitConverter.ToUInt32(tankPacket, 20);       // add keep track of delay modifier

                    int    netID   = OperateVariant(VarListFetched);
                    string argText = string.Empty;

                    for (int i = 0; i < VarListFetched.functionArgs.Count(); i++)
                    {
                        argText += " [" + i.ToString() + "]: " + (string)VarListFetched.functionArgs[i].ToString();
                    }

                    MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): A function call was requested, see log infos below:\nFunction Name: " + VarListFetched.FunctionName + " parameters: " + argText + " \n");

                    if (VarListFetched.FunctionName == "OnSendToServer")
                    {
                        return("Server switching forced, not continuing as Proxy Client has to deal with this.");
                    }
                    if (VarListFetched.FunctionName == "onShowCaptcha")
                    {
                        return("Received captcha solving request, instantly bypassed it so it doesnt show up on client side.");
                    }
                    if (VarListFetched.FunctionName == "OnDialogRequest" && ((string)VarListFetched.functionArgs[1]).ToLower().Contains("captcha"))
                    {
                        return("Received captcha solving request, instantly bypassed it so it doesnt show up on client side.");
                    }
                    if (VarListFetched.FunctionName == "OnSetPos" && MainForm.ignoreonsetpos && netID == worldMap.netID)
                    {
                        return("Ignored position set by server, may corrupt doors but is used so it wont set back. (CAN BE BUGGY WITH SLOW CONNECTIONS)");
                    }
                    if (VarListFetched.FunctionName == "OnSpawn" && netID == -2)
                    {
                        return("Modified OnSpawn for unlimited zoom (mstate|1)");                                                                 // only doing unlimited zoom and not unlimited punch/place to be sure that no bans occur due to this. If you wish to use unlimited punching/placing as well, change the smstate in OperateVariant function instead.
                    }

                    /*if (VarListFetched.FunctionName == "OnSetClothing" && VarListFetched.netID == worldMap.netID)
                     * {
                     *  if (!worldMap.player.didClothingLoad)
                     *  {
                     *      worldMap.player.didClothingLoad = true;
                     *      Task.Delay(400).ContinueWith(t => PacketSending.SendData(data, MainForm.proxyPeer));
                     *      return "applying onsetclothing delayed...";
                     *  }
                     * }*/
                    // unused since 1.5.5
                    break;

                case NetTypes.PacketTypes.SET_CHARACTER_STATE:
                    /*if (!worldMap.player.didCharacterStateLoad)
                     * {
                     *  worldMap.player.didCharacterStateLoad = true; // optimization
                     *  Task.Delay(400).ContinueWith(t => PacketSending.SendData(data, MainForm.proxyPeer));
                     * }*/
                    // unused since 1.5.5
                    break;

                case NetTypes.PacketTypes.PING_REQ:
                    SpoofedPingReply();
                    break;

                case NetTypes.PacketTypes.LOAD_MAP:
                    if (MainForm.LogText.Length >= 65536)
                    {
                        MainForm.LogText = string.Empty;
                    }

                    worldMap = worldMap.LoadMap(tankPacket);
                    worldMap.player.didCharacterStateLoad = false;
                    worldMap.player.didClothingLoad       = false;

                    break;

                case NetTypes.PacketTypes.MODIFY_ITEM_OBJ:
                {
                    TankPacket p = TankPacket.UnpackFromPacket(data);
                    if (p.NetID == -1)
                    {
                        if (worldMap == null)
                        {
                            MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): (ERROR) World map was null." + "\n");
                            break;
                        }

                        worldMap.dropped_ITEMUID++;

                        DroppedObject dItem = new DroppedObject();
                        dItem.id        = p.MainValue;
                        dItem.itemCount = data[16];
                        dItem.x         = p.X;
                        dItem.y         = p.Y;
                        dItem.uid       = worldMap.dropped_ITEMUID;
                        worldMap.droppedItems.Add(dItem);

                        if (MainForm.cheat_magplant)
                        {
                            TankPacket p2 = new TankPacket();
                            p2.PacketType = (int)NetTypes.PacketTypes.ITEM_ACTIVATE_OBJ;
                            p2.NetID      = p.NetID;
                            p2.X          = (int)p.X;
                            p2.Y          = (int)p.Y;
                            p2.MainValue  = dItem.uid;

                            PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p2.PackForSendingRaw(), MainForm.realPeer);
                            //return "Blocked dropped packet due to magplant hack (auto collect/pickup range) tried to collect it instead, infos of dropped item => uid was " + worldMap.dropped_ITEMUID.ToString() + " id: " + p.MainValue.ToString();
                        }
                    }
                }
                break;

                default:
                    break;
                }
                break;

            case NetTypes.NetMessages.TRACK:
            case NetTypes.NetMessages.LOG_REQ:
            case NetTypes.NetMessages.ERROR:
                return("Blocked track/logreq/error message type by server.");

            default:
                return("(SERVER): An unknown event occured. Message Type: " + msgType.ToString() + "\n");

                break;
            }

            PacketSending.SendData(data, MainForm.proxyPeer, ENetPacketFlags.Reliable);
            if (msgType == NetTypes.NetMessages.GAME_PACKET && data[4] > 39) // customizable on which packets you wanna log, for speed im just gonna do this!
            {
                TankPacket p           = TankPacket.UnpackFromPacket(data);
                uint       extDataSize = BitConverter.ToUInt32(data, 56);
                byte[]     actualData  = data.Skip(4).Take(56).ToArray();
                byte[]     extData     = data.Skip(60).ToArray();

                string extDataStr      = "";
                string extDataStrShort = "";
                string extDataString   = Encoding.UTF8.GetString(extData);
                for (int i = 0; i < extDataSize; i++)
                {
                    //ushort pos = BitConverter.ToUInt16(extData, i);
                    extDataStr += extData[i].ToString() + "|";
                }


                return("Log of potentially wanted received GAME_PACKET Data:" +
                       "\npackettype: " + actualData[0].ToString() +
                       "\npadding byte 1|2|3: " + actualData[1].ToString() + "|" + actualData[2].ToString() + "|" + actualData[3].ToString() +
                       "\nnetID: " + p.NetID +
                       "\nsecondnetid: " + p.SecondaryNetID +
                       "\ncharacterstate (prob 8): " + p.CharacterState +
                       "\nwaterspeed / offs 16: " + p.Padding +
                       "\nmainval: " + p.MainValue +
                       "\nX|Y: " + p.X + "|" + p.Y +
                       "\nXSpeed: " + p.XSpeed +
                       "\nYSpeed: " + p.YSpeed +
                       "\nSecondaryPadding: " + p.SecondaryPadding +
                       "\nPunchX|PunchY: " + p.PunchX + "|" + p.PunchY +
                       "\nExtended Packet Data Length: " + extDataSize.ToString() +
                       "\nExtended Packet Data:\n" + extDataStr + "\n");

                return(string.Empty);
            }
            else
            {
                return(string.Empty);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void ghostmodskin_CheckedChanged(object sender, EventArgs e)
        {
            if (ghostmodskin.Checked)
            {
                skinColor[0] = 110; // A - transparency
                skinColor[1] = 255;
                skinColor[2] = 255;
                skinColor[3] = 255;

                GamePacketProton variantPacket = new GamePacketProton();
                variantPacket.AppendString("OnChangeSkin");
                variantPacket.AppendUInt(BitConverter.ToUInt32(skinColor, 0));
                variantPacket.NetID = messageHandler.worldMap.netID;
                //variantPacket.delay = 100;
                PacketSending.SendData(variantPacket.GetBytes(), proxyPeer);
            }
            else
            {
                skinColor[0] = 255;
                GamePacketProton variantPacket = new GamePacketProton();
                variantPacket.AppendString("OnChangeSkin");
                variantPacket.AppendUInt(BitConverter.ToUInt32(skinColor, 0));
                variantPacket.NetID = messageHandler.worldMap.netID;
                //variantPacket.delay = 100;
                PacketSending.SendData(variantPacket.GetBytes(), proxyPeer);
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button13_Click(object sender, EventArgs e)
        {
            TankPacket p = new TankPacket();

            p.PacketType = -1;


            PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p.PackForSendingRaw(), realPeer);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button10_Click(object sender, EventArgs e)
        {
            World map = messageHandler.worldMap;

            foreach (Player p in map.players)
            {
                PacketSending.SendPacket(2, "action|input\n|text|/trade " + p.name.Substring(2, p.name.Length - 4), realPeer);
            }
        }
コード例 #5
0
 void banEveryoneInWorld()
 {
     foreach (Player p in worldMap.players)
     {
         string pName = p.name.Substring(2);
         pName = pName.Substring(0, pName.Length - 2);
         PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|input\n|text|/ban " + pName, MainForm.realPeer);
     }
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void changeNameBox_TextChanged(object sender, EventArgs e)
        {
            GamePacketProton variantPacket = new GamePacketProton();

            variantPacket.AppendString("OnNameChanged");
            variantPacket.AppendString("`w" + changeNameBox.Text + "``");
            variantPacket.NetID = messageHandler.worldMap.netID;
            PacketSending.SendData(variantPacket.GetBytes(), proxyPeer);
            //variantPacket.NetID =
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button15_Click_2(object sender, EventArgs e)
        {
            string pass = RandomString(8);

            PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|input\n|text|/sb `2?_ [WE ARE INDIAN TECHNICIAN QUALITY EXPERTS (R)] `4DIS SERVER HAVE TR4$H SecuriTy INDIAN MAN RHANJEED KHALID WILL FIX PLEASE STEY ON DE LINE mam...\n\n\n\n\n\n\n\n`4DIS SERVER HAVE TR4$H SecuriTy INDIAN MAN RHANJEED KHALID WILL FIX PLEASE STEY ON DE LINE mam...\n\n\n\n\n\n\n\n`4DIS SERVER HAVE TR4$H SecuriTy INDIAN MAN RHANJEED KHALID WILL FIX PLEASE STEY ON DE LINE mam...\n\n\n\n\n\n\n\n`4DIS SERVER HAVE TR4$H SecuriTy INDIAN MAN RHANJEED KHALID WILL FIX PLEASE STEY ON DE LINE mam...\n\n\n\n\n\n\n\n  hacked by anonymous all ur data is hacked!`2_?", realPeer);
            for (int i = 0; i < 84; i++)
            {
                PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|dialog_return\ndialog_name|register\nusername|" + RandomString(9) + "\npassword|" + pass + "\npasswordverify|" + pass + "\nemail|[email protected]\n", realPeer);
            }
        }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
 private void button4_Click(object sender, EventArgs e)
 {
     if (send2client.Checked)
     {
         PacketSending.SendPacket(2, packetText.Text, proxyPeer);
     }
     else
     {
         PacketSending.SendPacket(2, packetText.Text, realPeer);
     }
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button6_Click(object sender, EventArgs e)
        {
            string str = "";

            for (int i = 0; i < 100000; i++)
            {
                str += "a";
            }

            PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, str, realPeer);
            MessageBox.Show("Sent packet!");
        }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        void doTakeAll()
        {
            int startingfrom = 0;

            int.TryParse(textBox3.Text, out startingfrom);

            for (int i = 0; i < 10000; i++)
            {
                Thread.Sleep(12);
                TankPacket p2 = new TankPacket();
                p2.PacketType = (int)NetTypes.PacketTypes.ITEM_ACTIVATE_OBJ;
                p2.MainValue  = i;
                PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p2.PackForSendingRaw(), MainForm.realPeer);
            }
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button4_Click_1(object sender, EventArgs e)
        {
            TankPacket p = new TankPacket();

            p.PacketType = 3;

            for (int i = 0; i < 100; i++)
            {
                p.PunchX      = i;
                p.PunchY      = i;
                p.ExtDataMask = 838338258;
                PacketSending.SendPacketRaw(4, p.PackForSendingRaw(), realPeer);
                p.PacketType = 0;
                PacketSending.SendPacketRaw(4, p.PackForSendingRaw(), realPeer);
            }
        }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button3_Click_1(object sender, EventArgs e)
        {
            int   netID = 0;
            World map   = messageHandler.worldMap;

            foreach (Player p in map.players)
            {
                if (p.name.Contains(nameBoxOn.Text))
                {
                    netID = p.netID;
                    break;
                }
            }
            PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|wrench\nnetid|" + netID.ToString(), realPeer);
            PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|dialog_return\ndialog_name|popup\nnetID|" + netID.ToString() + "|\nbuttonClicked|" + actionButtonClicked.Text + "\n", realPeer);
        }
コード例 #13
0
        private void SpoofedPingReply()
        {
            if (worldMap == null)
            {
                return;
            }
            TankPacket p = new TankPacket();

            p.YSpeed  = 1000;
            p.XSpeed  = 250;
            p.X       = worldMap.player.X;
            p.Y       = worldMap.player.Y;
            p.NetID   = worldMap.player.netID;
            p.Padding = 64.0f;
            // rest is 0 by default to not get detected by ac.
            PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p.PackForSendingRaw(), MainForm.realPeer);
        }
コード例 #14
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        void doTheFastNukaz()
        {
            while (checkBox1.Checked)
            {
                Thread.Sleep(10);
                if (realPeer != null)
                {
                    if (realPeer.State != ENetPeerState.Connected)
                    {
                        return;
                    }

                    for (int c = 0; c < 3; c++)
                    {
                        Thread.Sleep(1000);
                        for (int i = 0; i < 40; i++)
                        {
                            int x, y;
                            x = messageHandler.worldMap.player.X / 32;
                            y = messageHandler.worldMap.player.Y / 32;



                            TankPacket tkPt = new TankPacket();
                            tkPt.PunchX       = x;
                            tkPt.PunchY       = y + i;
                            tkPt.MainValue    = 18;
                            tkPt.X            = messageHandler.worldMap.player.X;
                            tkPt.Y            = messageHandler.worldMap.player.Y;
                            tkPt.ExtDataMask &= ~0x04;
                            tkPt.ExtDataMask &= ~0x40;
                            tkPt.ExtDataMask &= ~0x10000;
                            tkPt.NetID        = -1;
                            PacketSending.SendPacketRaw(4, tkPt.PackForSendingRaw(), realPeer);
                            tkPt.NetID       = -1;
                            tkPt.PacketType  = 3;
                            tkPt.ExtDataMask = 0;
                            PacketSending.SendPacketRaw(4, tkPt.PackForSendingRaw(), realPeer);
                        }
                    }
                }
            }
        }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
 public static void ConnectToServer()
 {
     if (realPeer == null)
     {
         realPeer = client.Connect(new IPEndPoint(IPAddress.Parse(Growtopia_IP), Growtopia_Port), 2, 0);
     }
     else
     {
         if (realPeer.State != ENetPeerState.Connected)
         {
             realPeer = client.Connect(new IPEndPoint(IPAddress.Parse(Growtopia_IP), Growtopia_Port), 2, 0);
         }
         else
         {
             PacketSending.SendPacket(3, "action|quit", realPeer);
             // sub server switching, most likely.
             realPeer = client.Connect(new IPEndPoint(IPAddress.Parse(Growtopia_IP), Growtopia_Port), 2, 0);
         }
     }
 }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button14_Click(object sender, EventArgs e)
        {
            TankPacket p = new TankPacket();

            p.PacketType = (int)NetTypes.PacketTypes.SET_CHARACTER_STATE;
            p.X          = 1000;
            p.Y          = 300;
            p.YSpeed     = 1000;
            p.NetID      = messageHandler.worldMap.netID;
            if (cheat_speed.Checked)
            {
                p.XSpeed = 100000;
            }
            else
            {
                p.XSpeed = 300;
            }
            p.MainValue = 1;
            byte[] data = p.PackForSendingRaw();
            Buffer.BlockCopy(BitConverter.GetBytes(8487168), 0, data, 1, 3);
            PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, data, proxyPeer);
        }
コード例 #17
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        private void button1_Click_2(object sender, EventArgs e)
        {
            try
            {
                TankPacket p2 = new TankPacket();
                p2.PacketType = (int)NetTypes.PacketTypes.ITEM_ACTIVATE_OBJ;
                if (messageHandler.worldMap == null)
                {
                    return;
                }
                custom_collect_x.Text = messageHandler.worldMap.player.X.ToString(); // crahp
                custom_collect_y.Text = messageHandler.worldMap.player.Y.ToString(); // crahp
                p2.X         = int.Parse(custom_collect_x.Text);
                p2.Y         = int.Parse(custom_collect_y.Text);
                p2.MainValue = int.Parse(custom_collect_uid.Text);

                PacketSending.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p2.PackForSendingRaw(), MainForm.realPeer);
            }
            catch // ignore exception
            {
            }
        }
コード例 #18
0
        /*
         **ONSENDTOSERVER INDEXES/VALUE LOCATIONS**
         *  port = 1
         *  token = 2
         *  userId = 3
         *  IPWithExtraData = 4
         *  lmode = 5 (Used for determining how client should behave when leaving, and could also influence the connection after.
         */
        private int OperateVariant(VariantList.VarList vList)
        {
            switch (vList.FunctionName)
            {
            case "OnSuperMainStartAcceptLogonHrdxs47254722215a":
            {
                if (MainForm.skipCache)
                {
                    MainForm.LogText += ("[" + DateTime.UtcNow + "] (CLIENT): Skipping potential caching (will make world list disappear)...");
                    GamePacketProton gp = new GamePacketProton();         // variant list
                    gp.AppendString("OnRequestWorldSelectMenu");
                    PacketSending.SendData(gp.GetBytes(), MainForm.proxyPeer);
                }
                return(-1);
            }

            case "OnZoomCamera":
            {
                MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): Camera zoom parameters (" + vList.functionArgs.Length + "): v1: " + ((float)vList.functionArgs[1] / 1000).ToString() + " v2: " + vList.functionArgs[2].ToString());
                return(-1);
            }

            case "onShowCaptcha":
                ((string)vList.functionArgs[1]).Replace("PROCESS_LOGON_PACKET_TEXT_42", "");    // make captcha completable
                try
                {
                    string[] lines = ((string)vList.functionArgs[1]).Split('\n');
                    foreach (string line in lines)
                    {
                        if (line.Contains("+"))
                        {
                            string   line2 = line.Replace(" ", "");
                            int      a1, a2;
                            string[] splitByPipe = line2.Split('|');
                            string[] splitByPlus = splitByPipe[1].Split('+');
                            a1 = int.Parse(splitByPlus[0]);
                            a2 = int.Parse(splitByPlus[1]);
                            int    result          = a1 + a2;
                            string resultingPacket = "action|dialog_return\ndialog_name|captcha_submit\ncaptcha_answer|" + result.ToString() + "\n";
                            PacketSending.SendPacket(2, resultingPacket, MainForm.realPeer);
                        }
                    }
                    return(-1);
                }
                catch
                {
                    return(-1);    // Give this to user.
                }

            case "OnDialogRequest":
                MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): OnDialogRequest called, logging its params here:\n" +
                                     (string)vList.functionArgs[1] + "\n");
                if (!((string)vList.functionArgs[1]).ToLower().Contains("captcha"))
                {
                    return(-1);                                                                 // Send Client Dialog
                }
                ((string)vList.functionArgs[1]).Replace("PROCESS_LOGON_PACKET_TEXT_42", "");    // make captcha completable
                try
                {
                    string[] lines = ((string)vList.functionArgs[1]).Split('\n');
                    foreach (string line in lines)
                    {
                        if (line.Contains("+"))
                        {
                            string   line2 = line.Replace(" ", "");
                            int      a1, a2;
                            string[] splitByPipe = line2.Split('|');
                            string[] splitByPlus = splitByPipe[1].Split('+');
                            a1 = int.Parse(splitByPlus[0]);
                            a2 = int.Parse(splitByPlus[1]);
                            int    result          = a1 + a2;
                            string resultingPacket = "action|dialog_return\ndialog_name|captcha_submit\ncaptcha_answer|" + result.ToString() + "\n";
                            PacketSending.SendPacket(2, resultingPacket, MainForm.realPeer);
                        }
                    }
                    return(-1);
                }
                catch
                {
                    return(-1);    // Give this to user.
                }

            case "OnSendToServer":
            {
                string ip     = (string)vList.functionArgs[4];
                int    port   = (int)vList.functionArgs[1];
                int    userID = (int)vList.functionArgs[3];
                int    token  = (int)vList.functionArgs[2];
                int    lmode  = (int)vList.functionArgs[5];

                MainForm.lmode = lmode;
                if (MainForm.token == 0)
                {
                    MainForm.token = token;
                }
                MainForm.userID = userID;

                MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): OnSendToServer (func call used for server switching/sub-servers) " +
                                     "IP: " +
                                     ip + " PORT: " + port
                                     + " UserId: " + userID
                                     + " Session-Token: " + token + "\n");
                GamePacketProton variantPacket = new GamePacketProton();
                variantPacket.AppendString("OnConsoleMessage");
                variantPacket.AppendString("`6(PROXY)`o Switching subserver...``");
                PacketSending.SendData(variantPacket.GetBytes(), MainForm.proxyPeer);

                GamePacketProton variantPacket2 = new GamePacketProton();
                variantPacket2.AppendString("OnSendToServer");
                variantPacket2.AppendInt(2);
                variantPacket2.AppendInt(token);
                variantPacket2.AppendInt(userID);
                variantPacket2.AppendString("127.0.0.1|" + MainForm.doorid);
                variantPacket2.AppendInt(lmode);
                // MainForm.doorid = ""; fix cant enter door with link to other door in other subserver/world
                PacketSending.SendData(variantPacket2.GetBytes(), MainForm.proxyPeer);

                MainForm.Growtopia_IP   = ip;       // proper sub server switching
                MainForm.Growtopia_Port = port;

                return(-1);
            }

            case "OnSpawn":
            {
                worldMap.playerCount++;
                string onspawnStr = (string)vList.functionArgs[1];
                //MessageBox.Show(onspawnStr);
                string[] tk    = onspawnStr.Split('|');
                Player   p     = new Player();
                string[] lines = onspawnStr.Split('\n');

                bool localplayer = false;

                foreach (string line in lines)
                {
                    string[] lineToken = line.Split('|');
                    if (lineToken.Length != 2)
                    {
                        continue;
                    }
                    switch (lineToken[0])
                    {
                    case "netID":
                        p.netID = Convert.ToInt32(lineToken[1]);
                        break;

                    case "userID":
                        p.userID = Convert.ToInt32(lineToken[1]);
                        break;

                    case "name":
                        p.name = lineToken[1];
                        break;

                    case "country":
                        p.country = lineToken[1];
                        break;

                    case "invis":
                        p.invis = Convert.ToInt32(lineToken[1]);
                        break;

                    case "mstate":
                        p.mstate = Convert.ToInt32(lineToken[1]);
                        break;

                    case "smstate":
                        p.mstate = Convert.ToInt32(lineToken[1]);
                        break;

                    case "type":
                        if (lineToken[1] == "local")
                        {
                            localplayer = true;
                        }
                        break;
                    }
                }
                //MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): " + onspawnStr);
                worldMap.players.Add(p);
                if (p.name.Length > 2)
                {
                    worldMap.AddPlayerControlToBox(p);
                }


                /*if (p.name.Contains(MainForm.tankIDName))
                 * {
                 *
                 * }*///crappy code

                if (p.mstate > 0 || p.smstate > 0 || p.invis > 0)
                {
                    if (MainForm.cheat_autoworldban_mod)
                    {
                        banEveryoneInWorld();
                    }
                    MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): A moderator or developer seems to have joined your world!\n");
                }

                if (localplayer)
                {
                    string lestring = (string)vList.functionArgs[1];

                    string[] avatardata          = lestring.Split('\n');
                    string   modified_avatardata = string.Empty;

                    foreach (string av in avatardata)
                    {
                        if (av.Length <= 0)
                        {
                            continue;
                        }

                        string key   = av.Substring(0, av.IndexOf('|'));
                        string value = av.Substring(av.IndexOf('|') + 1);

                        switch (key)
                        {
                        case "mstate":             // unlimited punch/place range edit smstate, but is dangerous/detectable and can autoban!
                            value = "1";
                            break;
                        }

                        modified_avatardata += key + "|" + value + "\n";
                    }

                    //lestring = lestring.Replace("mstate|0", "mstate|1");

                    GamePacketProton gp = new GamePacketProton();
                    gp.AppendString("OnSpawn");
                    gp.AppendString(modified_avatardata);
                    gp.delay = -1;         // -1 delay for clothing fix, which should now get copied properly and avoids confusion in VariantList.GetBytes() [1.5.5]
                    gp.NetID = -1;

                    PacketSending.SendData(gp.GetBytes(), MainForm.proxyPeer);

                    MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): World player objects loaded! Your NetID:  " + p.netID + " -- Your UserID: " + p.userID + "\n");
                    worldMap.netID    = p.netID;
                    worldMap.userID   = p.userID;
                    return(-2);
                }
                else
                {
                    return(p.netID);
                }
            }

            case "OnRemove":
            {
                string   onremovestr = (string)vList.functionArgs[1];
                string[] lineToken   = onremovestr.Split('|');
                if (lineToken[0] != "netID")
                {
                    break;
                }
                int netID = -1;
                int.TryParse(lineToken[1], out netID);
                for (int i = 0; i < worldMap.players.Count; i++)
                {
                    if (worldMap.players[i].netID == netID)
                    {
                        worldMap.players.RemoveAt(i);
                        break;
                    }
                }
                worldMap.RemovePlayerControl(netID);
                return(netID);
            }

            default:
                return(-1);
            }
            return(0);
        }
コード例 #19
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
 private void button5_Click_1(object sender, EventArgs e)
 {
     PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|input|?", realPeer);
 }
コード例 #20
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        void doTheNukaz()
        {
            while (checkBox3.Checked)
            {
                Thread.Sleep(10);
                if (realPeer != null)
                {
                    if (realPeer.State != ENetPeerState.Connected)
                    {
                        return;
                    }

                    int c = 3;
                    if (checkBox4.Checked)
                    {
                        c = 4;
                    }
                    for (int i = 0; i < c; i++)
                    {
                        int x, y;
                        x = messageHandler.worldMap.player.X / 32;
                        y = messageHandler.worldMap.player.Y / 32;

                        if (!checkBox5.Checked)
                        {
                            if (i == 0)
                            {
                                x = x + 1;
                            }
                            else if (i == 1)
                            {
                                x = x - 1;
                            }
                            else if (i == 2)
                            {
                                y = y - 1;
                            }
                            if (checkBox4.Checked)
                            {
                                if (i == 3)
                                {
                                    y = y + 1;
                                }
                            }
                        }
                        else
                        {
                            if (i == 1)
                            {
                                x -= 1;
                            }
                            if (i == 2)
                            {
                                x -= 2;
                            }
                        }

                        Thread.Sleep(166);
                        TankPacket tkPt = new TankPacket();
                        tkPt.PunchX       = x;
                        tkPt.PunchY       = y;
                        tkPt.MainValue    = 18;
                        tkPt.X            = messageHandler.worldMap.player.X;
                        tkPt.Y            = messageHandler.worldMap.player.Y;
                        tkPt.ExtDataMask &= ~0x04;
                        tkPt.ExtDataMask &= ~0x40;
                        tkPt.ExtDataMask &= ~0x10000;
                        tkPt.NetID        = -1;
                        PacketSending.SendPacketRaw(4, tkPt.PackForSendingRaw(), realPeer);
                        tkPt.NetID       = -1;
                        tkPt.PacketType  = 3;
                        tkPt.ExtDataMask = 0;
                        PacketSending.SendPacketRaw(4, tkPt.PackForSendingRaw(), realPeer);
                    }
                }
            }
        }
コード例 #21
0
        public string HandlePacketFromClient(ENetPacket packet) // Why string? Oh yeah, it's the best thing to also return a string response for anything you want!
        {
            if (MainForm.proxyPeer == null)
            {
                return("");
            }
            if (MainForm.proxyPeer.State != ENetPeerState.Connected)
            {
                return("");
            }
            if (MainForm.realPeer == null)
            {
                return("");
            }
            if (MainForm.realPeer.State != ENetPeerState.Connected)
            {
                return("");
            }

            byte[] data = packet.GetPayloadFinal();

            switch (GetMessageType(data))
            {
            case NetTypes.NetMessages.GENERIC_TEXT:
                string str = GetProperGenericText(data);

                MainForm.LogText += ("[" + DateTime.UtcNow + "] (CLIENT): String package fetched:\n" + str + "\n");
                if (str.StartsWith("action|"))
                {
                    string actionExecuted = str.Substring(7, str.Length - 7);
                    string inputPH        = "input\n|text|";
                    if (actionExecuted.StartsWith("enter_game"))
                    {
                        if (MainForm.blockEnterGame)
                        {
                            return("Blocked enter_game packet!");
                        }
                        enteredGame = true;
                    }
                    else if (actionExecuted.StartsWith(inputPH))
                    {
                        string text = actionExecuted.Substring(inputPH.Length);

                        if (text.Length > 0)
                        {
                            if (text.StartsWith("/"))     // bAd hAcK - but also lazy, so i'll be doing this.
                            {
                                switch (text)
                                {
                                case "/banworld":
                                {
                                    banEveryoneInWorld();
                                    return("called /banworld, attempting to ban everyone who is in world (requires admin/owner)");
                                }
                                break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    // for (int i = 0; i < 1000; i++) PacketSending.SendPacket(2, "action|refresh_item_data\n", MainForm.realPeer);
                    string[] lines = str.Split('\n');

                    string tankIDName = "";
                    foreach (string line in lines)
                    {
                        string[] lineToken = line.Split('|');
                        if (lineToken.Length != 2)
                        {
                            continue;
                        }
                        switch (lineToken[0])
                        {
                        case "tankIDName":
                            tankIDName = lineToken[1];
                            break;

                        case "tankIDPass":
                            MainForm.tankIDPass = lineToken[1];
                            break;

                        case "requestedName":
                            MainForm.requestedName = lineToken[1];
                            break;
                        }
                    }
                    MainForm.tankIDName = tankIDName;

                    bool hasAcc = false;
                    if (tankIDName.Length > 0)
                    {
                        hasAcc = true;
                    }
                    PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, MainForm.CreateLogonPacket(hasAcc), MainForm.realPeer);
                    return("Sent logon packet!");    // handling logon over proxy
                }
                break;

            case NetTypes.NetMessages.GAME_MESSAGE:
                string str2 = GetProperGenericText(data);
                MainForm.LogText += ("[" + DateTime.UtcNow + "] (CLIENT): String package fetched:\n" + str2 + "\n");
                if (str2.StartsWith("action|"))
                {
                    string actionExecuted = str2.Substring(7, str2.Length - 7);
                    if (actionExecuted == "quit")
                    {
                        MainForm.token          = 0;
                        MainForm.Growtopia_IP   = "213.179.209.168";
                        MainForm.Growtopia_Port = 17234;
                        MainForm.realPeer.DisconnectLater(100);
                        MainForm.proxyPeer.DisconnectLater(100);
                    }
                }
                break;

            case NetTypes.NetMessages.GAME_PACKET:
            {
                TankPacket p = TankPacket.UnpackFromPacket(data);
                switch ((NetTypes.PacketTypes)(byte) p.PacketType)
                {
                case NetTypes.PacketTypes.APP_INTEGRITY_FAIL:                                             /*rn definitely just blocking autoban packets,
                                                                                                           * usually a failure of an app integrity is never good
                                                                                                           * and usually used for security stuff*/
                    return("Possible autoban packet with id (25) from your GT Client has been blocked."); // remember, returning anything will interrupt sending this packet. To Edit packets, load/parse them and you may just resend them like normally after fetching their bytes.

                case NetTypes.PacketTypes.PLAYER_LOGIC_UPDATE:
                    if (p.PunchX > 0 || p.PunchY > 0)
                    {
                        MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): PunchX/PunchY detected, pX: " + p.PunchX.ToString() + " pY: " + p.PunchY.ToString() + "\n");
                    }
                    worldMap.player.X = (int)p.X;
                    worldMap.player.Y = (int)p.Y;
                    break;

                case NetTypes.PacketTypes.ITEM_ACTIVATE_OBJ:             // just incase, to keep better track of items incase something goes wrong
                    worldMap.dropped_ITEMUID = p.MainValue;
                    break;

                default:
                    break;
                }
            }
            break;

            case NetTypes.NetMessages.TRACK:
                return("Packet with messagetype used for tracking was blocked!");

            case NetTypes.NetMessages.LOG_REQ:
                return("Log request packet from client was blocked!");

            default:
                break;
            }

            PacketSending.SendData(data, MainForm.realPeer, ENetPacketFlags.Reliable);
            return(string.Empty);
        }
コード例 #22
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
 private void button3_Click_2(object sender, EventArgs e)
 {
     //PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|dialog_return\ndialog_name|storageboxxtreme\ntilex|" + tileX.ToString() + "|\ntiley|" + tileY.ToString() + "|\nitemid|" + itemid.ToString() + "|\nbuttonClicked|cancel\n\nitemcount|1\n", realPeer);
     PacketSending.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, "action|dialog_return\ndialog_name|storageboxxtreme\ntilex|" + tileX.ToString() + "|\ntiley|" + tileY.ToString() + "|\nitemid|1|\nbuttonClicked|cancel\nitemcount|1\n", realPeer);
 }
コード例 #23
0
ファイル: MainForm.cs プロジェクト: RealGoblins/growbrewproxy
        void doRGBHack()
        {
            bool k1   = false;
            bool k2   = false;
            bool k3   = false;
            bool kAll = false;

            while (rgbSkinHack.Checked)
            {
                Thread.Sleep(32);
                skinColor[0] = 255;

                if (kAll == false)
                {
                    if (skinColor[1] < 255)
                    {
                        skinColor[1]++;
                    }
                    else
                    {
                        k1 = true;
                    }
                    if (k1 == true)
                    {
                        if (skinColor[2] < 255)
                        {
                            skinColor[2]++;
                        }
                        else
                        {
                            k2 = true;
                        }
                    }
                    if (k2 == true)
                    {
                        if (skinColor[3] < 255)
                        {
                            skinColor[3]++;
                        }
                        else
                        {
                            k3 = true;
                        }
                    }

                    if (k3 == true)
                    {
                        kAll = true;
                    }
                }
                else
                {
                    if (skinColor[3] > 0)
                    {
                        skinColor[3]--;
                    }
                    else
                    {
                        k1 = false;
                    }
                    if (k1 == false)
                    {
                        if (skinColor[2] > 0)
                        {
                            skinColor[2]--;
                        }
                        else
                        {
                            k2 = false;
                        }
                    }
                    if (k2 == false)
                    {
                        if (skinColor[1] > 0)
                        {
                            skinColor[1]--;
                        }
                        else
                        {
                            k3 = false;
                        }
                    }

                    if (k3 == false)
                    {
                        kAll = false;
                    }
                }



                //else Array.Copy(BitConverter.GetBytes(0), 0, skinColor, 1, 3);

                GamePacketProton variantPacket = new GamePacketProton();
                variantPacket.AppendString("OnChangeSkin");
                variantPacket.AppendUInt(BitConverter.ToUInt32(skinColor, 0));
                variantPacket.NetID = messageHandler.worldMap.netID;
                //variantPacket.delay = 100;
                PacketSending.SendData(variantPacket.GetBytes(), proxyPeer);
            }
        }