public Add_Allow_Rule(ReceiveGPacket dados)
        {
            // codigo de operação - 1 byte
            // ipSize - 1 byte
            // ip
            int    ipSize = dados.readC();
            string ip     = dados.readS(ipSize);

            IPAddress ipAddr;

            if (!IPAddress.TryParse(ip, out ipAddr))
            {
                Printf.danger("[Error] Invalid IP");
                return;
            }

            if (allowed.Contains(ip))
            {
                Printf.info("[Permitir] Já esta na liberado " + ip);
                return;
            }

            Netsh.Permit(ip);
            allowed.Add(ip);

            Printf.blue("[Permitir] IP: " + ip + " Ports " + Config.gamePort + " UDP " + Config.battlePort);
        }
        private static void Monitoring_Blocks() // Remove as regras usando o nome
        {
            try
            {
                if (unlockQueue.Count < 1)
                {
                    return;
                }


                Printf.roxo("[Monitoring] Awaiting unlock: " + unlockQueue.Count);

                for (int i = 0; i < unlockQueue.Count; i++)
                {
                    uint date = uint.Parse(DateTime.Now.ToString("yyMMddHHmm"));

                    if (date >= unlockQueue[i].end) // Remova o ban da lista
                    {
                        Printf.sucess("Desbloqueado  [" + unlockQueue[i].name + "]");
                        Add_Drop_Rule.blocked.Remove(unlockQueue[i]._ip);

                        Netsh.Remove(unlockQueue[i].name);

                        unlockQueue.RemoveAt(i);
                        i--;
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                Printf.b_danger("[RemoveRule]\n" + ex);
            }
        }
        public Add_Drop_Rule(ReceiveGPacket dados)
        {
            try
            {
                int    ipSize   = dados.readC();
                int    descSize = dados.readC();
                string ip       = dados.readS(ipSize);

                if (blocked.Contains(ip))
                {
                    return;
                }

                IPAddress ipAddr;
                if (!IPAddress.TryParse(ip, out ipAddr))
                {
                    Printf.danger("[Error] Invalid IP");
                    return;
                }

                if (WhiteList.check(ipAddr))
                {
                    return;                           // WhiteList
                }
                string descricao = "[" + DateTime.Now.ToString() + "] " + dados.readS(descSize);
                int    timeBan   = Tools.getGravit(dados.readC());


                // Verifica se o ip já foi permitido
                if (Add_Allow_Rule.allowed.Contains(ip))
                {
                    Printf.info("[Remove] Removendo ip ja liberado para bloqueio" + ip);
                    Netsh.Remove("PB API Protection " + ip);
                    Add_Allow_Rule.allowed.Remove(ip);
                }



                uint date = uint.Parse(DateTime.Now.ToString("yyMMddHHmm"));

                string name = Netsh.RandName(timeBan, ip, date);
                Netsh.Block(ip, name, descricao); // Bloqueia no firewall

                Printf.danger("[Blocked " + timeBan + " Min]", false);
                Printf.white("...IP " + ip, false);
                Printf.white("...Name: " + name, false);
                Printf.white("...Description: " + descricao, false);

                // Adiciona na lista de bloqueados caso o tempo seja diferente de 0
                if (timeBan > 0)
                {
                    Monitoring.RuleInfo ev = new Monitoring.RuleInfo
                    {
                        start = date,
                        end   = (date + (int)timeBan),
                        name  = name,
                        _ip   = ip
                    };
                    Monitoring.unlockQueue.Add(ev);
                    Printf.info("Adicionado, vence: " + (date + timeBan) + " Name:" + name);
                }
                else
                {
                    Memory.blockPerm++;
                    Printf.info("Bloqueio permanente - " + ip);
                }

                blocked.Add(ip);
            }
            catch (Exception ex)
            {
                Printf.b_danger("[AddRule]\n" + ex);
            }
        }