private void MainForm_Load(object sender, EventArgs e) { this.Opacity = 98; imports.GetWindowRect(imports.handle, out imports.rect); this.Left = imports.rect.left; this.Top = imports.rect.top; backgroundWorker1.RunWorkerAsync(); guna2ComboBox1.StartIndex = 1; guna2ComboBox2.StartIndex = 1; guna2ComboBox3.StartIndex = 0; Proxyhelper.loadproxy(); backgroundWorker2.RunWorkerAsync(); try { label45.Text = BWare.dcusername; guna2CirclePictureBox2.Load(BWare.dcavatar); int leg = label45.Text.Length; int x = label45.Location.X; int o = x - 7; int f = o - leg; label45.Location = new Point(f, 311); } catch { } timer1.Start(); timer2.Start(); }
private void SwitchServers(ref ENetPeer peer, string ip, int port, int lmode = 0, int userid = 0, int token = 0) { Proxyhelper.globalUserData.Growtopia_IP = token < 0 ? Proxyhelper.globalUserData.Growtopia_Master_IP : ip; Proxyhelper.globalUserData.Growtopia_Port = token < 0 ? Proxyhelper.globalUserData.Growtopia_Master_Port : port; isSwitchingServers = true; Proxyhelper.ConnectToServer(ref peer, Proxyhelper.globalUserData); }
private void SpoofedPingReply(TankPacket tPacket) { if (worldMap == null) { return; } TankPacket p = new TankPacket(); p.PacketType = (int)NetTypes.PacketTypes.PING_REPLY; p.PunchX = (int)1000.0f; p.PunchY = (int)250.0f; p.X = 64.0f; p.Y = 64.0f; p.MainValue = tPacket.MainValue; // GetTickCount() p.SecondaryNetID = (int)Proxyhelper.HashBytes(BitConverter.GetBytes(tPacket.MainValue)); // HashString of it // rest is 0 by default to not get detected by ac. packetSender.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p.PackForSendingRaw(), Proxyhelper.realPeer); }
private void guna2CustomCheckBox1_CheckedChanged_1(object sender, EventArgs e) { if (ipaddrBox.Text != "" && portBox.Text != "") { Proxyhelper.globalUserData.Growtopia_IP = ipaddrBox.Text; Proxyhelper.globalUserData.Growtopia_Port = Convert.ToInt32(portBox.Text); } Proxyhelper.isHTTPRunning = !Proxyhelper.isHTTPRunning; if (Proxyhelper.isHTTPRunning) { string[] arr = new string[1]; arr[0] = "http://*:80/"; HTTPServer.StartHTTP(this, arr); } else { HTTPServer.StopHTTP(); } Proxyhelper.LaunchProxy(); }
public string HandlePacketFromClient(ref ENetPeer peer, ENetPacket packet) // Why string? Oh yeah, it's the best thing to also return a string response for anything you want! { if (peer.IsNull) { return(""); } if (peer.State != ENetPeerState.Connected) { return(""); } if (Proxyhelper.realPeer.IsNull) { return(""); } if (Proxyhelper.realPeer.State != ENetPeerState.Connected) { return(""); } bool respondToBotPeers = true; byte[] data = packet.Data.ToArray(); string log = string.Empty; switch ((NetTypes.NetMessages)data[0]) { case NetTypes.NetMessages.GENERIC_TEXT: string str = GetProperGenericText(data); if (str.StartsWith("action|")) { string actionExecuted = str.Substring(7, str.Length - 7); string inputPH = "input\n|text|"; if (actionExecuted.StartsWith("enter_game")) { respondToBotPeers = true; if (Proxyhelper.globalUserData.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++) packetSender.SendPacket(2, "action|refresh_item_data\n", MainForm.realPeer); respondToBotPeers = false; 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": Proxyhelper.globalUserData.tankIDPass = lineToken[1]; break; case "requestedName": Proxyhelper.globalUserData.requestedName = lineToken[1]; break; case "token": Proxyhelper.globalUserData.token = int.Parse(lineToken[1]); break; case "user": Proxyhelper.globalUserData.userID = int.Parse(lineToken[1]); break; case "lmode": Proxyhelper.globalUserData.lmode = int.Parse(lineToken[1]); break; } } Proxyhelper.globalUserData.tankIDName = tankIDName; bool hasAcc = false; packetSender.SendPacket((int)NetTypes.NetMessages.GENERIC_TEXT, Proxyhelper.CreateLogonPacket(), Proxyhelper.realPeer); return("Sent logon packet!"); // handling logon over proxy } break; case NetTypes.NetMessages.GAME_MESSAGE: string str2 = GetProperGenericText(data); if (str2.StartsWith("action|")) { string actionExecuted = str2.Substring(7); if (actionExecuted.StartsWith("quit") && !actionExecuted.StartsWith("quit_to_exit")) { // super multibotting will not mirror all packets in here (the "quit" action), cuz i found it unnecessary, although, you can enable that by pasting the code that does it. respondToBotPeers = true; Proxyhelper.globalUserData.token = -1; Proxyhelper.globalUserData.Growtopia_IP = Proxyhelper.globalUserData.Growtopia_Master_IP; Proxyhelper.globalUserData.Growtopia_Port = Proxyhelper.globalUserData.Growtopia_Master_Port; if (Proxyhelper.realPeer != null) { if (!Proxyhelper.realPeer.IsNull) { if (Proxyhelper.realPeer.State != ENetPeerState.Disconnected) { Proxyhelper.realPeer.Disconnect(0); } } } if (Proxyhelper.proxyPeer != null) { if (!Proxyhelper.proxyPeer.IsNull) { if (Proxyhelper.proxyPeer.State == ENetPeerState.Connected) { Proxyhelper.proxyPeer.Disconnect(0); } } } } else if (actionExecuted.StartsWith("join_request\nname|")) // ghetto fetching of worldname { string[] rest = actionExecuted.Substring(18).Split('\n'); string joinWorldName = rest[0]; Console.WriteLine($"Joining world {joinWorldName}..."); } } 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) { Proxyhelper.LogText += ("[" + DateTime.UtcNow + "] (PROXY): PunchX/PunchY detected, pX: " + p.PunchX.ToString() + " pY: " + p.PunchY.ToString() + "\n"); } Proxyhelper.globalUserData.isFacingSwapped = IsBitSet(p.CharacterState, 4); worldMap.player.X = (int)p.X; worldMap.player.Y = (int)p.Y; break; case NetTypes.PacketTypes.PING_REPLY: { //SpoofedPingReply(p); return("Blocked ping reply!"); } case NetTypes.PacketTypes.TILE_CHANGE_REQ: respondToBotPeers = true; if (p.MainValue == 32) { /*MessageBox.Show("Log of potentially wanted received GAME_PACKET Data:" + * "\npackettype: " + data[4].ToString() + * "\npadding byte 1|2|3: " + data[5].ToString() + "|" + data[6].ToString() + "|" + data[7].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);*/ Proxyhelper.globalUserData.lastWrenchX = (short)p.PunchX; Proxyhelper.globalUserData.lastWrenchY = (short)p.PunchY; } else if (p.MainValue == 18 && Proxyhelper.globalUserData.redDamageToBlock) { // playingo p.SecondaryPadding = -1; p.ExtDataMask |= 1 << 27; // 28 p.Padding = 1; packetSender.SendPacketRaw(4, p.PackForSendingRaw(), Proxyhelper.realPeer); return(""); } break; case NetTypes.PacketTypes.ITEM_ACTIVATE_OBJ: // just incase, to keep better track of items incase something goes wrong worldMap.dropped_ITEMUID = p.MainValue; if (Proxyhelper.globalUserData.blockCollecting) { return(""); } break; default: //MainForm.LogText += ("[" + DateTime.UtcNow + "] (CLIENT): Got Packet Type: " + p.PacketType.ToString() + "\n"); break; } if (data[4] > 23) { log = $"(CLIENT) Log of potentially wanted received GAME_PACKET Data:" + "\npackettype: " + data[4].ToString() + "\npadding byte 1|2|3: " + data[5].ToString() + "|" + data[6].ToString() + "|" + data[7].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; } } 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; } packetSender.SendData(data, Proxyhelper.realPeer); return(log); }
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); } }