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); } }
private static void Peer_OnReceive_Client(object sender, ENetPacket e) { try { // this is a specific, external client made only for the purpose of using the TRACK packet for our gains/advantage in order to check all accounts quick and efficiently. byte[] packet = e.GetPayloadFinal(); Console.WriteLine("RECEIVE TYPE: " + packet[0].ToString()); switch (packet[0]) { case 1: // HELLO server packet. { string username = accountsToCheck[checkCurrentIndex].GrowID; string pass = accountsToCheck[checkCurrentIndex].password; // todo add mac optionally, will do that incases aap bypass gets fixed. Console.WriteLine("[ACCOUNT-CHECKER] Logging on " + username + "..."); packetSender.SendPacket(2, MainForm.CreateLogonPacket(username, pass), g_Peer); break; } case 2: case 3: { Console.WriteLine("[ACCOUNT-CHECKER] TEXT PACKET CONTENT:\n" + Encoding.ASCII.GetString(packet.Skip(4).ToArray())); break; } case 4: { byte[] tankPacket = VariantList.get_struct_data(packet); if (tankPacket[0] == 1) { VariantList.VarList vList = VariantList.GetCall(VariantList.get_extended_data(tankPacket)); vList.netID = BitConverter.ToInt32(tankPacket, 4); // add netid vList.delay = BitConverter.ToUInt32(tankPacket, 20); // add keep track of delay modifier // Console.WriteLine(VarListFetched.FunctionName); if (vList.FunctionName == "OnSendToServer") { string ip = (string)vList.functionArgs[4]; if (ip.Contains("|")) { ip = ip.Substring(0, ip.IndexOf("|")); } int port = (int)vList.functionArgs[1]; int userID = (int)vList.functionArgs[3]; int token = (int)vList.functionArgs[2]; int lmode = (int)vList.functionArgs[5]; Growtopia_IP = ip; Growtopia_Port = port; ConnectCurrent(); } // variant call, just rn used for subserver switching } break; } case (byte)NetTypes.NetMessages.TRACK: // TRACK packet. { Console.WriteLine("[ACCOUNT-CHECKER] TRACK PACKET CONTENT:\n" + Encoding.ASCII.GetString(packet.Skip(4).ToArray())); checkCurrentIndex++; Console.WriteLine("[ACCOUNT-CHECKER] +1 account checked, disconnecting and moving onto the next one."); Growtopia_Port = MainForm.Growtopia_Master_Port; // todo auto get port Growtopia_IP = MainForm.Growtopia_Master_IP; ConnectCurrent(); break; } default: break; } } catch { } }
public World LoadMap(byte[] packet) { try { ResetAndInit(); // just incase, may be removed when disposing or in here, ill keep it like that tho. byte[] data = VariantList.get_extended_data(packet); // agh, maybe puublically declare and use then like that but too late, too lazy to refactor now. if (data.Length < 8192) { return(this); } if (data.Length > 200000) { return(this); // 200kb too big not gonna do that... } readPos += 6; short pLen = BitConverter.ToInt16(data, readPos); readPos += sizeof(short); // 2 for (int i = 0; i < pLen; i++) { currentWorld += (char)data[readPos++]; } width = BitConverter.ToInt32(data, readPos); readPos += sizeof(int); height = BitConverter.ToInt32(data, readPos); readPos += sizeof(int); tileCount = BitConverter.ToInt32(data, readPos); readPos += sizeof(int); tiles = new Tile[tileCount]; // allocate exact tile data. MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): Loading world: " + currentWorld + ", total tile count is: " + tileCount.ToString() + "\n"); for (int i = 0; i < tileCount; i++) { if (Tile_Serialize(data, i) != 0) { break; } } MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): [" + currentWorld + "]" + " Tiles properly serialized (without any errors): " + tilesProperlySerialized.ToString() + "\n"); if (readPos >= data.Length) { return(this); } //weather n dropped items: droppedItems.Clear(); dropped_ITEMUID = BitConverter.ToInt32(data, readPos); readPos += sizeof(int); int count = BitConverter.ToInt32(data, readPos); readPos += sizeof(int); /*for (int i = 0; i < count; i++) * { * if (WorldObjects_Serialize(data) != 0) * { * MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): ERROR! Dropped objects in world '" + currentWorld + "' could not be loaded properly! This might have made the magplant hack/pickup range cheat malfunctioning, its recommended to turn it off now!\n"); * break; * } * }*/ //tiles properly serialized: " + tilesProperlySerialized.ToString() + ", dropped_ITEMUID = count; // yeah at least if serializing them fails we can atleast get uid count.... total_bytes_serialized = (ulong)readPos; MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): Succeeded loading world '" + currentWorld + "'! Total bytes serialized: " + total_bytes_serialized.ToString() + ", dropped item uid count: " + count + "\n"); } catch { return(this); } return(this); }
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(); //else //{ //return "_none_"; //} NetTypes.NetMessages msgType = (NetTypes.NetMessages)data[0]; // more performance. 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 = ""; GamePacketProton gp = new GamePacketProton(); gp.AppendString("OnConsoleMessage"); gp.AppendString("`6(PROXY) `4Handling server relogon request automatically..."); packetSender.SendData(gp.GetBytes(), MainForm.proxyPeer); SwitchServers(MainForm.Growtopia_Master_IP, MainForm.Growtopia_Master_Port); 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; } byte tankPacketType = tankPacket[0]; NetTypes.PacketTypes packetType = (NetTypes.PacketTypes)tankPacketType; if (MainForm.logallpackettypes) { GamePacketProton gp = new GamePacketProton(); gp.AppendString("OnConsoleMessage"); gp.AppendString("`6(PROXY) `wPacket TYPE: " + tankPacketType.ToString()); packetSender.SendData(gp.GetBytes(), MainForm.proxyPeer); } switch (packetType) { case NetTypes.PacketTypes.INVENTORY_STATE: { worldMap.player.SerializePlayerInventory(VariantList.get_extended_data(tankPacket)); /*foreach (InventoryItem item in worldMap.player.inventory.items) * { * ItemDatabase.ItemDefinition itemDef = ItemDatabase.GetItemDef(item.itemID); * MessageBox.Show("ITEM NAME: " + itemDef.itemName + " AMOUNT: " + item.amount); * }*/ break; } case NetTypes.PacketTypes.PLAYER_LOGIC_UPDATE: { TankPacket p = TankPacket.UnpackFromPacket(data); foreach (Player pl in worldMap.players) { if (pl.netID == p.NetID) { pl.X = (int)p.X; pl.Y = (int)p.Y; break; } } break; } case NetTypes.PacketTypes.TILE_CHANGE_REQ: { TankPacket p = TankPacket.UnpackFromPacket(data); // world tile map in proxy, by playingo :) if (worldMap == null) { MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): (ERROR) World map was null." + "\n"); break; } byte tileX = (byte)p.PunchX; byte tileY = (byte)p.PunchY; ushort item = (ushort)p.MainValue; if (tileX >= worldMap.width) { break; } else if (tileY >= worldMap.height) { break; } ItemDatabase.ItemDefinition itemDef = ItemDatabase.GetItemDef(item); if (ItemDatabase.isBackground(item)) { worldMap.tiles[tileX + (tileY * worldMap.width)].bg = item; } else { worldMap.tiles[tileX + (tileY * worldMap.width)].fg = item; } break; } 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) { if (MainForm.unlimitedZoom) { 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. } } break; case NetTypes.PacketTypes.SET_CHARACTER_STATE: { /*TankPacket p = TankPacket.UnpackFromPacket(data); * * return "Log of potentially wanted received GAME_PACKET Data:" + * "\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;*/ break; } case NetTypes.PacketTypes.PING_REQ: SpoofedPingReply(); break; case NetTypes.PacketTypes.LOAD_MAP: if (MainForm.LogText.Length >= 32678) { MainForm.LogText = string.Empty; } worldMap = worldMap.LoadMap(tankPacket); worldMap.player.didCharacterStateLoad = false; worldMap.player.didClothingLoad = false; if (MainForm.pForm.IsHandleCreated) { Action action = () => { MainForm.pForm.Text = "All players in " + worldMap.currentWorld; foreach (Button btn in MainForm.pForm.playerBox.Controls) { btn.Dispose(); } MainForm.pForm.playerBox.Controls.Clear(); }; MainForm.pForm.Invoke(action); } MainForm.realPeer.Timeout(1000, 7000, 11000); 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; packetSender.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; } packetSender.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); } }
public string HandlePacketFromServer(ref ENetPeer peer, ENetPacket packet) { if (Proxyhelper.proxyPeer.IsNull) { return("HandlePacketFromServer() -> Proxy peer is null!"); } if (Proxyhelper.proxyPeer.State != ENetPeerState.Connected) { return($"HandlePacketFromServer() -> proxyPeer is not connected: state = {Proxyhelper.proxyPeer.State}"); } if (peer.IsNull) { return("HandlePacketFromServer() -> peer.IsNull is true!"); } if (peer.State != ENetPeerState.Connected) { return("HandlePacketFromServer() -> peer.State was not ENetPeerState.Connected!"); } byte[] data = packet.Data.ToArray(); NetTypes.NetMessages msgType = (NetTypes.NetMessages)data[0]; // more performance. switch (msgType) { case NetTypes.NetMessages.SERVER_HELLO: { Proxyhelper.UserData ud; if (peer.TryGetUserData(out ud)) { packetSender.SendPacket(2, Proxyhelper.CreateLogonPacket(ud.tankIDName, ud.tankIDPass, ud.userID, ud.token, ud.doorid), peer); } break; } case NetTypes.NetMessages.GAME_MESSAGE: string str = GetProperGenericText(data); Proxyhelper.LogText += ("[" + DateTime.UtcNow + "] (SERVER): A game_msg packet was sent: " + str + "\n"); if (str.Contains("Server requesting that you re-logon")) { Proxyhelper.globalUserData.token = -1; Proxyhelper.globalUserData.Growtopia_IP = Proxyhelper.globalUserData.Growtopia_Master_IP; Proxyhelper.globalUserData.Growtopia_Port = Proxyhelper.globalUserData.Growtopia_Master_Port; Proxyhelper.globalUserData.isSwitchingServer = true; Proxyhelper.realPeer.Disconnect(0); } break; case NetTypes.NetMessages.GAME_PACKET: byte[] tankPacket = VariantList.get_struct_data(data); if (tankPacket == null) { break; } byte tankPacketType = tankPacket[0]; NetTypes.PacketTypes packetType = (NetTypes.PacketTypes)tankPacketType; if (Proxyhelper.logallpackettypes) { GamePacketProton gp = new GamePacketProton(); gp.AppendString("OnConsoleMessage"); gp.AppendString("`6(PROXY) `wPacket TYPE: " + tankPacketType.ToString()); packetSender.SendData(gp.GetBytes(), Proxyhelper.proxyPeer); if (tankPacketType > 18) { File.WriteAllBytes("newpacket.dat", tankPacket); } } switch (packetType) { case NetTypes.PacketTypes.PLAYER_LOGIC_UPDATE: { TankPacket p = TankPacket.UnpackFromPacket(data); foreach (Player pl in worldMap.players) { if (pl.netID == p.NetID) { pl.X = (int)p.X; pl.Y = (int)p.Y; break; } } break; } case NetTypes.PacketTypes.INVENTORY_STATE: { if (!Proxyhelper.globalUserData.dontSerializeInventory) { worldMap.player.SerializePlayerInventory(VariantList.get_extended_data(tankPacket)); } break; } case NetTypes.PacketTypes.TILE_CHANGE_REQ: { TankPacket p = TankPacket.UnpackFromPacket(data); if (worldMap == null) { Proxyhelper.LogText += ("[" + DateTime.UtcNow + "] (PROXY): (ERROR) World map was null." + "\n"); break; } byte tileX = (byte)p.PunchX; byte tileY = (byte)p.PunchY; ushort item = (ushort)p.MainValue; if (tileX >= worldMap.width) { break; } else if (tileY >= worldMap.height) { break; } ItemDatabase.ItemDefinition itemDef = ItemDatabase.GetItemDef(item); if (ItemDatabase.isBackground(item)) { worldMap.tiles[tileX + (tileY * worldMap.width)].bg = item; } else { worldMap.tiles[tileX + (tileY * worldMap.width)].fg = item; } break; } 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 bool isABot = false; Proxyhelper.UserData ud = null; int netID = OperateVariant(VarListFetched, isABot ? (object)peer : null); // box enetpeer obj to generic obj string argText = string.Empty; for (int i = 0; i < VarListFetched.functionArgs.Count(); i++) { argText += " [" + i.ToString() + "]: " + (string)VarListFetched.functionArgs[i].ToString(); } Proxyhelper.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 == "OnDialogRequest" && ((string)VarListFetched.functionArgs[1]).ToLower().Contains("gazette")) { return("Received gazette, skipping it..."); } if (VarListFetched.FunctionName == "OnSetPos" && Proxyhelper.globalUserData.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) { if (Proxyhelper.globalUserData.unlimitedZoom) { 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. } } break; case NetTypes.PacketTypes.SET_CHARACTER_STATE: { /*TankPacket p = TankPacket.UnpackFromPacket(data); * * return "Log of potentially wanted received GAME_PACKET Data:" + * "\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;*/ break; } case NetTypes.PacketTypes.PING_REQ: SpoofedPingReply(TankPacket.UnpackFromPacket(data)); break; case NetTypes.PacketTypes.LOAD_MAP: if (Proxyhelper.LogText.Length >= 32678) { Proxyhelper.LogText = string.Empty; } worldMap = worldMap.LoadMap(tankPacket); worldMap.player.didCharacterStateLoad = false; worldMap.player.didClothingLoad = false; Proxyhelper.realPeer.Timeout(1000, 2800, 3400); break; case NetTypes.PacketTypes.MODIFY_ITEM_OBJ: { TankPacket p = TankPacket.UnpackFromPacket(data); if (p.NetID == -1) { if (worldMap == null) { 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 (Proxyhelper.globalUserData.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; packetSender.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p2.PackForSendingRaw(), Proxyhelper.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: { return("Track message:\n" + GetProperGenericText(data)); break; } case NetTypes.NetMessages.LOG_REQ: case NetTypes.NetMessages.ERROR: return("Blocked LOG_REQUEST/ERROR message from server"); default: //return "(SERVER): An unknown event occured. Message Type: " + msgType.ToString() + "\n"; break; } packetSender.SendData(data, Proxyhelper.proxyPeer); 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); } }