Ejemplo n.º 1
0
        public void onMovementRequest(ByteQueue state, PacketReader pvSrc, Socket s)
        {
            Direction          dir       = (Direction)pvSrc.ReadByte();
            int                seq       = pvSrc.ReadByte();
            int                key       = pvSrc.ReadInt32();
            ClientIdentifier   client    = ClientStorage.GetInstance().GetClient(s);
            Filter <Direction> f         = m_DirectionFilterManager.get(client);
            bool               speedhack = f.DoFilter(dir);

            if (speedhack)
            {
                //LOGGA SU FILE PER ORA STAMPO
                String baseDirecotry = Directory.GetCurrentDirectory();
                AppendPath(ref baseDirecotry, "Logs");
                AppendPath(ref baseDirecotry, "SpeedHack");
                baseDirecotry = Path.Combine(baseDirecotry, String.Format("{0}.log", f.Username));
                using (StreamWriter sw = new StreamWriter(baseDirecotry, true))
                    sw.WriteLine("Account: " + f.Username + " usa speedhack " + " Data: " + DateTime.Now);

                //Console.WriteLine("Account: " + f.Username + "usa speedhack" + "Data: " + DateTime.Now);
                //Console.WriteLine("THREAD ID " + Thread.CurrentThread.ManagedThreadId);
            }
            if (f.Sequence == 0 && seq != 0)
            {
                f.Reset();
            }
            ++seq;

            if (seq == 256)
            {
                seq = 1;
            }

            f.Sequence = seq;
        }
Ejemplo n.º 2
0
        public void Resynchronize(ByteQueue state, PacketReader pvSrc, Socket s)
        {
            ClientIdentifier   client = ClientStorage.GetInstance().GetClient(s);
            Filter <Direction> f      = m_DirectionFilterManager.get(client);

            f.Sequence = 0;
            f.Reset();
        }
Ejemplo n.º 3
0
 public static ClientStorage GetInstance()
 {
     if (m_Instance == null)
     {
         m_Instance = new ClientStorage();
     }
     return(m_Instance);
 }
Ejemplo n.º 4
0
 public static ClientStorage GetInstance()
 {
     if (m_Instance == null)
     {
         m_Instance = new ClientStorage();
     }
     return m_Instance;
 }
Ejemplo n.º 5
0
        public void onPreLogin(ByteQueue state, PacketReader pvSrc, Socket s)
        {
            int                authID   = pvSrc.ReadInt32();
            String             username = pvSrc.ReadString(30);
            ClientIdentifier   client   = ClientStorage.GetInstance().GetClient(s);
            Filter <Direction> f        = m_DirectionFilterManager.get(client);

            f.start();
        }
Ejemplo n.º 6
0
        public void onAccountLogin(ByteQueue state, PacketReader pvSrc, Socket s)
        {
            int      authID   = pvSrc.ReadInt32();
            String   username = pvSrc.ReadString(30);
            FastWalk fastWalk = new FastWalk(username);

            fastWalk.Sequence = 0;
            IPEndPoint endPoint = s.RemoteEndPoint as IPEndPoint;

            this.m_IpStorage.Add(username, endPoint.Address);
            ClientIdentifier client = ClientStorage.GetInstance().GetClient(s);

            client.Username = username;
            this.m_DirectionFilterManager.add(client, fastWalk);
        }
Ejemplo n.º 7
0
        private bool handleSocket(Socket socket)
        {
            try
            {
                NetworkStream m_NetworkStreamLocal = new NetworkStream(socket);

                TcpClient     m_RemoteSocket        = new TcpClient(ConfigurationManager.AppSettings.Get("ultimaIp"), Int32.Parse(ConfigurationManager.AppSettings.Get("ultimaPort")));
                NetworkStream m_NetworkStreamRemote = m_RemoteSocket.GetStream();

                Client _RemoteClient = new RemoteClient("remote" + i, m_Handler)
                {
                    m_SendingNetworkStream = m_NetworkStreamLocal,
                    m_ListenNetworkStream  = m_NetworkStreamRemote,
                    m_ListenSocket         = m_RemoteSocket.Client
                };

                Client _LocalClient = new LocalClient("local" + i, m_Handler)
                {
                    m_SendingNetworkStream = m_NetworkStreamRemote,
                    m_ListenNetworkStream  = m_NetworkStreamLocal,
                    m_ListenSocket         = socket
                };

                _RemoteClient.Other = _LocalClient;
                _LocalClient.Other  = _RemoteClient;
                ThreadPool.QueueUserWorkItem(_RemoteClient.ThreadStartHander, "remote" + i);
                ThreadPool.QueueUserWorkItem(_LocalClient.ThreadStartHander, "local" + i);
                i++;
                ClientIdentifier client = new ClientIdentifier(m_RemoteSocket.Client, socket);
                ClientStorage.GetInstance().AddClient(client);
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }