Exemplo n.º 1
0
        public static void PacketCounter()
        {
            Console.WriteLine("Counter started...");
            while (true)
            {
                Thread.Sleep(100);
                foreach (int count in hwCount.ToList())
                {
                    if (count > 20)
                    {
                        if (!hasAlerted)
                        {
                            Console.WriteLine("\nWARNING");
                            Console.WriteLine("\t" + hwList[hwCount.IndexOf(count)] + " seems to be attempting to wipe the network cache.");
                            Console.WriteLine("\tHas " + count + " packets sent with same hardware address");

                            Console.WriteLine("Flushing and Freezing...");

                            int    id      = AdapterController.GetAdapterId(adapterId);
                            string gateway = AdapterController.GetGateway();

                            CacheController.FlushFreezeArp(id, AdapterController.GetGateway());

                            hasAlerted = true;
                            Console.WriteLine();
                        }
                    }
                }
            }
        }