private void method_9(bool bool_1) { if (!this.bool_0 && bool_1) { this.bool_0 = true; try { base.Shutdown(SocketShutdown.Both); base.Close(); base.Dispose(); } catch { } Array.Clear(this.mDataBuffer, 0, this.mDataBuffer.Length); this.mDataBuffer = null; this.mDataReceivedCallback = null; this.mRouteReceivedDataCallback = null; HabboIM.GetSocketsManager().method_6(this.uint_0); AntiDDosSystem.FreeConnection(this.string_0); if (HabboIM.GetConfig().data["emu.messages.connections"] == "1") { Console.WriteLine(string.Concat(new object[] { ">> Connection Dropped [", this.uint_0, "] from [", this.String_0, "]" })); } } }
internal static bool CheckConnection(Socket Sock) { string text = Sock.RemoteEndPoint.ToString().Split(new char[] { ':' })[0]; if (text == AntiDDosSystem.mLastIpBlocked) { return(false); } else { if (AntiDDosSystem.GetConnectionAmount(text) > 10 && text != "127.0.0.1" && text != ServerConfiguration.ProxyIP && !ServerConfiguration.DDoSProtectionEnabled) { Process[] peerblockrunning = Process.GetProcessesByName("peerblock"); if (peerblockrunning.Length == 0) { } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("PeerBlock is running! Adding IP to PeerBlock blacklist!"); Console.ForegroundColor = ConsoleColor.White; using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"ddos.p2p", true)) { file.Write("DDoS IP:" + text + "-" + text + "\n"); } uint msg = RegisterWindowMessage("PeerBlockLoadLists"); SendMessage(HWND_BROADCAST, msg, IntPtr.Zero, IntPtr.Zero); } Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(text + " was banned by Anti-DDoS system."); Console.ForegroundColor = ConsoleColor.White; Logging.LogDDoS(text + " - " + DateTime.Now.ToString()); AntiDDosSystem.mLastIpBlocked = text; return(false); } else { int num = AntiDDosSystem.GetFreeConnectionID(); if (num < 0) { return(false); } else { AntiDDosSystem.mConnectionStorage[num] = text; return(true); } } } }
public Class114(string string_0, int int_2, int maxConnections, SocketsManager class113_1) { this.int_1 = Process.GetCurrentProcess().Id; this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(HabboIM.GetConfig().data["game.tcp.bindip"]), int_2); this.socket_0.Bind(localEP); this.socket_0.Listen(maxConnections + (maxConnections / 2)); this.asyncCallback_0 = new AsyncCallback(this.method_4); this.class113_0 = class113_1; AntiDDosSystem.SetupTcpAuthorization(20000); Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Emulator wurde gestartet! Port: " + int_2 + " | Maximal erlaubte Habbos: " + maxConnections); }
private void method_4(IAsyncResult iasyncResult_0) { if (this.bool_0) { try { int num = this.class113_0.method_4(); if (num > -1) { Socket socket = ((Socket)iasyncResult_0.AsyncState).EndAccept(iasyncResult_0); if (AntiDDosSystem.CheckConnection(socket)) { this.class113_0.method_5(socket.DuplicateAndClose(this.int_1), num); } else { try { socket.Shutdown(SocketShutdown.Both); socket.Close(); socket.Dispose(); } catch { } } } } catch (Exception ex) { Logging.LogException("[TCPListener.OnRequest]: Could not handle new connection request: " + ex.ToString()); } finally { this.method_3(); } } }