public static void sendAllow(string ip)
        {
            // codigo de operação - 1 byte
            // ipSize - 1 byte
            // ip


            UdpClient udpClient = new UdpClient("127.0.0.1", 1911);

            SendGPacket pk = new SendGPacket();

            pk.writeC(23);
            pk.writeC((byte)ip.Length);
            pk.writeB(Encoding.ASCII.GetBytes(ip));

            try
            {
                udpClient.Send(pk.mstream.ToArray(), pk.mstream.ToArray().Length);
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[Firewall] Fatal Error!");
            }
        }
 public static void GenerateList()
 {
     try
     {
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command = connection.CreateCommand();
             connection.Open();
             command.CommandText = "SELECT * FROM events_xmas";
             command.CommandType = CommandType.Text;
             NpgsqlDataReader data = command.ExecuteReader();
             while (data.Read())
             {
                 EventXmasModel ev = new EventXmasModel
                 {
                     startDate = (UInt32)data.GetInt64(0),
                     endDate   = (UInt32)data.GetInt64(1)
                 };
                 _events.Add(ev);
             }
             command.Dispose();
             data.Close();
             connection.Dispose();
             connection.Close();
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[EventXmasSyncer] Erro fatal!");
     }
 }
Exemple #3
0
 private void AddItems(Account p, ItemsModel item)
 {
     try
     {
         ItemsModel modelo = new ItemsModel(item)
         {
             _objId = item._objId
         };
         if (_type == 1)
         {
             PlayerManager.tryCreateItem(modelo, p._inventory, p.player_id);
         }
         SEND_ITEM_INFO.LoadItem(p, modelo);
         if (modelo._category == 1)
         {
             weapons.Add(modelo);
         }
         else if (modelo._category == 2)
         {
             charas.Add(modelo);
         }
         else if (modelo._category == 3)
         {
             cupons.Add(modelo);
         }
     }
     catch (Exception ex)
     {
         p.Close(0);
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[INVENTORY_ITEM_CREATE_PAK2.AddItems] Erro fatal! Player Desconectado");
     }
 }
Exemple #4
0
        public bool RemovePlayer(Account p)
        {
            bool result = false;

            try
            {
                p.channelId = -1;
                if (p.Session != null)
                {
                    lock (_players)
                    {
                        result = _players.Remove(p.Session);
                    }
                    if (result)
                    {
                        Game_SyncNet.UpdateGSCount(serverId);
                    }
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[Channel.RemovePlayer] Erro fatal!");
            }
            return(result);
        }
Exemple #5
0
        private static void AcceptCallback(IAsyncResult result)
        {
            Socket clientSocket = (Socket)result.AsyncState;

            try
            {
                Socket handler = clientSocket.EndAccept(result);
                if (handler != null)
                {
                    LoginClient client = new LoginClient(handler);
                    AddSocket(client);
                    if (client == null)
                    {
                        Printf.warning("LoginClient destruído após falha ao adicionar na lista.");
                    }
                    Thread.Sleep(5);
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[LoginManager.AcceptCallback] [Failed a LC connection] Erro fatal!");
            }
            mainSocket.BeginAccept(new AsyncCallback(AcceptCallback), mainSocket);
        }
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         Room room = p._room;
         SLOT slot;
         if (room != null && room.isPreparing() && room.getSlot(p._slotId,out slot) && slot.state == SLOT_STATE.LOAD)
         {
             slot.preLoadDate = DateTime.Now;
             room.StartCounter(0,p,slot);
             room.changeSlotState(slot,SLOT_STATE.RENDEZVOUS,true);
             room._mapName = name;
             if (slot._id == room._leader)
             {
                 room._state = RoomState.Rendezvous;
                 room.updateRoomInfo();
             }
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BATTLE_LOADING_REC.run] Erro fatal!");
     }
 }
 public static void Load()
 {
     try
     {
         configFile = new ConfigFile("data/maps/defaults.ini");
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[ConfigMaps.Load] Erro fatal!");
         return;
     }
     Tutorial     = configFile.readInt32("Tutorial", 0);
     Deathmatch   = configFile.readInt32("Deathmatch", 1);
     Destruction  = configFile.readInt32("Destruction", 25);
     Sabotage     = configFile.readInt32("Sabotage", 35);
     Supression   = configFile.readInt32("Supression", 11);
     Defense      = configFile.readInt32("Defense", 39);
     Challenge    = configFile.readInt32("Challenge", 1);
     Dinosaur     = configFile.readInt32("Dinosaur", 40);
     Sniper       = configFile.readInt32("Sniper", 1);
     Shotgun      = configFile.readInt32("Shotgun", 1);
     HeadHunter   = configFile.readInt32("HeadHunter", 0);
     Knuckle      = configFile.readInt32("Knuckle", 0);
     CrossCounter = configFile.readInt32("Cross-Counter", 54);
     Chaos        = configFile.readInt32("Chaos", 1);
     TheifMode    = configFile.readInt32("TheifMode", 1);
 }
        public override void run()
        {
            Account player = _client._player;
            Room    room   = player == null ? null : player._room;

            try
            {
                if (room == null || room._leader == slotId || room._slots[slotId]._playerId == 0)
                {
                    _client.SendPacket(new ROOM_CHANGE_HOST_PAK(0x80000000));
                }
                else if (room._state == RoomState.Ready && room._leader == player._slotId)
                {
                    room.setNewLeader(slotId, 0, room._leader, false);
                    using (ROOM_CHANGE_HOST_PAK packet = new ROOM_CHANGE_HOST_PAK(slotId))
                        room.SendPacketToPlayers(packet);
                    room.updateSlotsInfo();
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[ROOM_CHANGE_HOST_REC.run] Erro fatal!");
            }
        }
        public static int getMsgsCount(long owner_id)
        {
            int msgs = 0;

            if (owner_id == 0)
            {
                return(msgs);
            }
            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    NpgsqlCommand command = connection.CreateCommand();
                    connection.Open();
                    command.Parameters.AddWithValue("@owner", owner_id);
                    command.CommandText = "SELECT COUNT(*) FROM player_messages WHERE owner_id=@owner";
                    msgs = Convert.ToInt32(command.ExecuteScalar());
                    command.Dispose();
                    connection.Dispose();
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[MessageManager] Fatal Error!");
            }
            return(msgs);
        }
        public override void run()
        {
            try
            {
                Account player = _client._player;
                Room    room   = player == null ? null : player._room;
                if (teamIdx < 2 && room != null && (player.LastSlotChange == new DateTime() ||
                                                    (DateTime.Now - player.LastSlotChange).TotalSeconds >= 1.5) &&
                    !room.changingSlots)
                {
                    SLOT slot = room.getSlot(player._slotId);
                    if (slot != null && teamIdx != slot._team && slot.state == SLOT_STATE.NORMAL)
                    {
                        player.LastSlotChange = DateTime.Now;
                        Monitor.Enter(room._slots);
                        room.changingSlots = true;

                        List <SLOT_CHANGE> changeList = new List <SLOT_CHANGE>();
                        room.SwitchNewSlot(changeList,player,slot,teamIdx);
                        if (changeList.Count > 0)
                        {
                            using (ROOM_CHANGE_SLOTS_PAK packet = new ROOM_CHANGE_SLOTS_PAK(changeList,room._leader,0))
                                room.SendPacketToPlayers(packet);
                        }
                        room.changingSlots = false;
                        Monitor.Exit(room._slots);
                    }
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[ROOM_CHANGE_SLOT_REC.run] Erro fatal!");
            }
        }
Exemple #11
0
        public override void run()
        {
            Account player = _client._player;

            if (player == null || player._match == null)
            {
                return;
            }
            try
            {
                int     channelId = serverInfo - ((serverInfo / 10) * 10);
                Channel ch        = ChannelsXML.getChannel(channelId);
                if (ch != null)
                {
                    Match match = ch.getMatch(id);
                    if (match != null)
                    {
                        _client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0, match.clan));
                    }
                    else
                    {
                        _client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0x80000000));
                    }
                }
                else
                {
                    _client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0x80000000));
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[CLAN_WAR_MATCH_TEAM_INFO_REC.run] Erro fatal!");
            }
        }
 public static bool GetBanStatus(PhysicalAddress mac)
 {
     try
     {
         DateTime now = DateTime.Now;
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command = connection.CreateCommand();
             connection.Open();
             command.Parameters.AddWithValue("@mac", mac);
             command.CommandText = "SELECT * FROM block_mac WHERE inicio <= now()::date AND inicio+ dias  > NOW()::date AND mac=@mac ";
             NpgsqlDataReader data = command.ExecuteReader();
             if (data.HasRows)
             {
                 return(true);
             }
             command.Dispose();
             data.Close();
             connection.Dispose();
             connection.Close();
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[Banimento.GetBanStatus] Erro fatal!");
     }
     return(false);
 }
        public static bool checkBan(long player_id)
        {
            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    NpgsqlCommand command = connection.CreateCommand();
                    connection.Open();
                    command.Parameters.AddWithValue("@pid", player_id);
                    command.CommandText = "SELECT id FROM banimentos WHERE inicio <= now()::date AND inicio+ dias  > NOW()::date AND player=@pid";
                    NpgsqlDataReader data = command.ExecuteReader();

                    if (data.HasRows)
                    {
                        return(true);
                    }

                    command.Dispose();
                    data.Close();
                    connection.Dispose();
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[Banimento.checkBan] Erro fatal!");
                return(false);
            }
            return(false);
        }
Exemple #14
0
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         Clan c = ClanManager.getClan(clanId);
         if (c._id == 0)
         {
             erro = 0x80000000;
         }
         else if (c.limite_rank > p._rank)
         {
             erro = 2147487867;
         }
         _client.SendPacket(new CLAN_CHECK_CREATE_INVITE_PAK(erro));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_CHECK_CREATE_INVITE_REC.run] Erro fatal!");
     }
 }
Exemple #15
0
 public void addMissionDB(long player_id)
 {
     if (player_id == 0)
     {
         return;
     }
     try
     {
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand cmd = connection.CreateCommand();
             connection.Open();
             cmd.Parameters.AddWithValue("@owner", player_id);
             cmd.CommandText = "INSERT INTO player_missions (owner_id) VALUES (@owner)";
             cmd.CommandType = CommandType.Text;
             cmd.ExecuteNonQuery();
             cmd.Dispose();
             connection.Close();
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[MissionManager.addMissionDB] Erro fatal!");
     }
 }
        public static void Block(string addr, string name, string description)
        {
            try
            {
                string arg = "";
                if (1 != 1)
                {
                    string tcpPorts = Config.authPort + "," + Config.gamePort;

                    arg += "/C netsh advfirewall firewall add rule name=\"" + name + "\" description=\"" + description + "\" protocol=tcp localport=" + tcpPorts + " dir=in action=block remoteip=" + addr;
                    arg += " && netsh advfirewall firewall add rule name=\"" + name + "\" description=\"" + description + "\" protocol=udp  localport=" + Config.battlePort + " dir=in action=block remoteip=" + addr;
                }
                else
                {
                    arg += "/C netsh advfirewall firewall add rule name=\"" + name + "\" description=\"" + description + "\" protocol=tcp localport=39190 dir=in action=block remoteip=" + addr;
                }


                Process          pr  = new Process();
                ProcessStartInfo prs = new ProcessStartInfo();
                prs.FileName    = @"cmd.exe";
                prs.Verb        = "runas"; // Run to admin
                prs.Arguments   = arg;
                prs.WindowStyle = ProcessWindowStyle.Hidden;
                pr.StartInfo    = prs;

                pr.Start();
            }
            catch (Exception ex)
            {
                Printf.b_danger("[Netsh.Block] FATAL! " + ex.ToString());
            }
        }
        public override void run()
        {
            try
            {
                Account player = _client._player;
                if (player == null)
                {
                    return;
                }
                Clan c = ClanManager.getClan(player.clanId);
                if (c._id > 0 && (c.owner_id == _client.player_id) && PlayerManager.updateClanInfo(c._id, autoridade, limite_rank, limite_idade, limite_idade2))
                {
                    c.autoridade    = autoridade;
                    c.limite_rank   = limite_rank;
                    c.limite_idade  = limite_idade;
                    c.limite_idade2 = limite_idade2;
                }
                else
                {
                    erro = 0x80000000;
                }

                _client.SendPacket(new CLAN_SAVEINFO3_PAK(erro));
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[CLAN_SAVEINFO3_REC.run] Erro fatal!");
            }
        }
        public static void Permit(string addr)
        {
            try
            {
                string arg = "";

                if (1 != 1)
                {
                    arg += "/C netsh advfirewall firewall add rule name=\"PB API Protection " + addr + "\" description=\"TCP - by luisfeliperm\" protocol=tcp localport=" + Config.gamePort + " dir=in action=allow remoteip=" + addr;
                    arg += " && netsh advfirewall firewall add rule name=\"PB API Protection " + addr + "\" description=\"UDP  - by luisfeliperm\" protocol=udp  localport=" + Config.battlePort + " dir=in action=allow remoteip=" + addr;
                }
                else
                {
                    arg += "/C netsh advfirewall firewall add rule name=\"PB API Protection " + addr + "\"  protocol=any dir=in action=allow remoteip=" + addr;
                }


                Process          pr  = new Process();
                ProcessStartInfo prs = new ProcessStartInfo();
                prs.FileName    = @"cmd.exe";
                prs.Verb        = "runas"; // Run to admin
                prs.Arguments   = arg;
                prs.WindowStyle = ProcessWindowStyle.Hidden;
                pr.StartInfo    = prs;

                pr.Start();
            }
            catch (Exception ex)
            {
                Printf.b_danger("[Netsh.Permit] FATAL! " + ex.ToString());
            }
        }
        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 override void run()
 {
     try
     {
         Account player = _client._player;
         if (player == null)
         {
             return;
         }
         if (player.clanId == 0)
         {
             _client.SendPacket(new CLAN_REQUEST_LIST_PAK(-1));
             return;
         }
         List <ClanInvite> clanInvites = PlayerManager.getClanRequestList(player.clanId);
         using (SendGPacket p = new SendGPacket())
         {
             int count = 0;
             for (int i = (page * 13); i < clanInvites.Count; i++)
             {
                 WriteData(clanInvites[i], p);
                 if (++count == 13)
                 {
                     break;
                 }
             }
             _client.SendPacket(new CLAN_REQUEST_LIST_PAK(0, count, page, p.mstream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_REQUEST_LIST_REC.run] Erro fatal!");
     }
 }
Exemple #21
0
 /// <summary>
 /// Limpa as salas que a quantidade de jogadores for 0. Proteção Thread-Safety.
 /// </summary>
 public void RemoveEmptyRooms()
 {
     try
     {
         lock (_rooms)
         {
             if ((DateTime.Now - LastRoomsSync).TotalSeconds >= 2)
             {
                 LastRoomsSync = DateTime.Now;
                 for (int i = 0; i < _rooms.Count; ++i)
                 {
                     Room r = _rooms[i];
                     if (r.getAllPlayers().Count < 1)
                     {
                         _rooms.RemoveAt(i--);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[Channel.RemoveEmptyRooms] Erro fatal!");
     }
 }
 public static void LoadCupomFlags()
 {
     try
     {
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command = connection.CreateCommand();
             connection.Open();
             command.CommandText = "SELECT * FROM info_cupons_flags";
             command.CommandType = CommandType.Text;
             NpgsqlDataReader data = command.ExecuteReader();
             while (data.Read())
             {
                 CupomFlag cupom = new CupomFlag
                 {
                     ItemId     = data.GetInt32(0),
                     EffectFlag = (CupomEffects)data.GetInt64(1)
                 };
                 Effects.Add(cupom);
             }
             command.Dispose();
             data.Close();
             connection.Dispose();
             connection.Close();
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CumpomEffectMananger] Fatal Error!");
     }
 }
Exemple #23
0
 public PlayerSession getPlayer(uint session, out int idx)
 {
     idx = -1;
     lock (_players)
     {
         try
         {
             for (int i = 0; i < _players.Count; i++)
             {
                 PlayerSession inf = _players[i];
                 if (inf._sessionId == session)
                 {
                     idx = i;
                     return(inf);
                 }
             }
         }
         catch (Exception ex)
         {
             SaveLog.fatal(ex.ToString());
             Printf.b_danger("[Channel.getPlayer] Erro fatal!");
         }
         return(null);
     }
 }
Exemple #24
0
 public override void write()
 {
     if (room == null || leader == null)
     {
         return;
     }
     writeH(3088);
     try
     {
         writeS(leader.player_name, 33);
         writeC((byte)room.killtime);
         writeC((byte)(room.rodada - 1));
         writeH((ushort)room.getInBattleTime());
         writeC((byte)room.limit);
         writeC((byte)room.seeConf);
         writeH((ushort)room.autobalans);
     }
     catch (Exception ex)
     {
         writeS("", 33);
         writeB(new byte[8]);
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[LOBBY_GET_ROOMINFO_PAK.write] Erro fatal!");
     }
 }
 public static bool deleteDB(string TABELA, string req1, object valorReq1)
 {
     try
     {
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command = connection.CreateCommand();
             connection.Open();
             command.CommandType = CommandType.Text;
             command.Parameters.AddWithValue("@req1", valorReq1);
             command.CommandText = "DELETE FROM " + TABELA + " WHERE " + req1 + "=@req1";
             command.ExecuteNonQuery();
             command.Dispose();
             connection.Dispose();
             connection.Close();
         }
         return(true);
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[AllUtils.DeleteDB] Erro fatal!");
         return(false);
     }
 }
 public override void run()
 {
     try
     {
         Account player = _client._player;
         if (player != null)
         {
             Clan clan = ClanManager.getClan(player.clanId);
             if (clan._id > 0 && clan.owner_id == _client.player_id &&
                 ComDiv.deleteDB("clan_data", "clan_id", clan._id) &&
                 ComDiv.updateDB("contas", "player_id", player.player_id, new string[] { "clan_id", "clanaccess", "clan_game_pt", "clan_wins_pt" }, 0, 0, 0, 0) &&
                 ClanManager.RemoveClan(clan))
             {
                 player.clanId     = 0;
                 player.clanAccess = 0;
                 SEND_CLAN_INFOS.Load(clan, 1);
             }
             else
             {
                 erro = 2147487850;
             }
         }
         else
         {
             erro = 2147487850;
         }
         _client.SendPacket(new CLAN_CLOSE_PAK(erro));
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_CLOSE_REC.run] Erro fatal!");
     }
 }
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         Room room = p._room;
         if (room != null)
         {
             room.changeSlotState(p._slotId, SLOT_STATE.CLAN, false);
             room.StopCountDown(p._slotId);
             room.updateSlotsInfo();
         }
         Clan clan = ClanManager.getClan(p.clanId);
         if (p.clanId == 0 && p.player_name.Length > 0)
         {
             id = PlayerManager.getRequestClanId(p.player_id);
         }
         _client.SendPacket(new CLAN_CLIENT_ENTER_PAK(id > 0 ? id : clan._id, p.clanAccess));
         if (clan._id > 0 && id == 0)
         {
             _client.SendPacket(new CLAN_DETAIL_INFO_PAK(0, clan));
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[CLAN_CLIENT_ENTER_REC.run] Erro fatal!");
     }
 }
Exemple #28
0
 public override void run()
 {
     try
     {
         Account p = _client._player;
         if (p == null || p.player_id == receiverId || p.player_name == receiverName)
         {
             return;
         }
         Account pW = AccountManager.getAccount(receiverId, 0);
         if (pW == null || pW.player_name != receiverName || !pW._isOnline)
         {
             _client.SendPacket(new AUTH_SEND_WHISPER_PAK(receiverName, text, 0x80000000));
         }
         else
         {
             pW.SendPacket(new AUTH_RECV_WHISPER_PAK(p.player_name, text, p.UseChatGM()), false);
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[AUTH_SEND_WHISPER2_REC.run] Erro fatal!");
     }
 }
        public static void Load()
        {
            try
            {
                string path = "config/api-protection/ignore.json";
                if (!File.Exists(path))
                {
                    SaveLog.error("[WhiteList] Não existe o arquivo: " + path);
                    Printf.danger("[WhiteList] Não existe o arquivo: " + path, false);
                    return;
                }

                var result = JsonConvert.DeserializeObject <List <whiteListJsonMODEL> >(File.ReadAllText(path));


                for (byte i = 0; i < result.Count; i++)
                {
                    _whiteList.Add(new whiteListModel()
                    {
                        _cidr = result[i]._cidr,

                        _address = IPAddress.Parse(result[i]._address),
                    });
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[WhiteList.Load] Erro fatal!");
            }
        }
        public static void sendBlock(string ip, string descricao, int gravidade)
        {
            // codigo de operação - 1 byte
            // ipSize - 1 byte
            // descSize - 1 byte
            // ip
            // descricao
            // Gravivade - 1 Byte (0=grave|1=perigo|2=Suspeito)


            UdpClient udpClient = new UdpClient("127.0.0.1", 1911);

            SendGPacket pk = new SendGPacket();

            pk.writeC(0);
            pk.writeC((byte)ip.Length);
            pk.writeC((byte)descricao.Length);
            pk.writeB(Encoding.ASCII.GetBytes(ip));
            pk.writeB(Encoding.ASCII.GetBytes(descricao));
            pk.writeC((byte)gravidade);

            try
            {
                udpClient.Send(pk.mstream.ToArray(), pk.mstream.ToArray().Length);
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[Firewall] Fatal Error!");
            }
        }