コード例 #1
0
        public static void Load()
        {
            try
            {
                Printf.info("[Load BattleServer]", false);
                string path = "data/battle/BattleServers.json";
                if (!File.Exists(path))
                {
                    SaveLog.error("[BattleServerXML] Não existe o arquivo: " + path);
                    Printf.danger("[BattleServerXML] Não existe o arquivo: " + path);
                    return;
                }

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


                for (byte i = 0; i < result.Count; i++)
                {
                    Servers.Add(new BattleServer()
                    {
                        _battleConn     = new IPEndPoint(IPAddress.Parse(result[i].PublicIP), result[i].Port),
                        _battleSyncConn = new IPEndPoint(IPAddress.Parse(result[i].IPSync), result[i].PortSync),
                    });

                    Printf.info(new IPEndPoint(IPAddress.Parse(result[i].PublicIP), result[i].Port) + " Sync -> " + new IPEndPoint(IPAddress.Parse(result[i].IPSync), result[i].PortSync), false);
                }
            }
            catch (Exception ex)
            {
                Printf.b_danger("[BattleServerXML.Load]\n" + ex);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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!");
            }
        }
コード例 #4
0
 public static bool Check(string appversion, string app)
 {
     if (appversion != version)
     {
         Printf.danger("Versões incompátiveis! Core v." + version + " " + app + " v." + appversion);
         return(false);
     }
     return(true);
 }
コード例 #5
0
 /// <summary>
 /// Envia uma mensagem global ao jogador. (GM)
 /// </summary>
 /// <param name="msg"></param>
 public SERVER_MESSAGE_ANNOUNCE_PAK(string msg)
 {
     _message = msg;
     if (msg.Length >= 1024)
     {
         Printf.danger("[GM] Mensagem com tamanho maior a 1024 enviada! = \"" + msg + "\" ");
         SaveLog.error("[GM] Mensagem com tamanho maior a 1024 enviada! = \"" + msg + "\" ");
     }
 }
コード例 #6
0
        public override void run()
        {
            string msg = null;

            switch (_result)
            {
            case 0:
                break;

            case 0x80000101:
                msg = "Conta já esta online!";
                break;

            case 0x80000118:
                msg = "Senha invalida!";
                break;

            case 0x80000107:
                msg = "Voce esta banido!";
                break;

            case 0x80000117:
                msg = "Username invalido!";
                break;

            case 0x80000126:
            case 0x80000121:
                msg = "Regiao bloqueada";
                break;

            case 0x80000119:
            case 0x80000102:
                msg = "Deleted Account";
                break;

            case 0x80000127:
                msg = "Usuario ou senha incorretos";
                break;

            case 0x80000133:
                msg = "Hardware bloqueado";
                break;

            default:
                msg = "Error: [" + _result + "] ";
                break;
            }
            if (_result != 0)
            {
                flooding.totalErros++;
                Printf.danger("Erro ao logar! pId: " + _pId + " Status: " + msg);
                return;
            }

            flooding.totalCreate++;
            Printf.sucess("[Status Login] Logado com Sucesso! PlayerID: " + _pId);
        }
コード例 #7
0
        public static void Load()
        {
            string path = "data/maps/modes.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.danger("[MapsXML] Não existe o arquivo: " + path);
            }
        }
コード例 #8
0
        public static void Load()
        {
            string path = "data/battle/charas.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.danger("[CharaXML] Não existe o arquivo: " + path);
            }
        }
コード例 #9
0
        public static void Load()
        {
            string path = "data/Welcome.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.danger("[WelcomeXML] Não existe o arquivo: " + path);
            }
        }
コード例 #10
0
 public ConfigFile(string path)
 {
     try
     {
         File    = new FileInfo(path);
         _topics = new SortedList <string, string>();
         LoadStrings();
     }
     catch (Exception ex)
     {
         Printf.danger("[ConfigFile] " + ex.ToString());
     }
 }
コード例 #11
0
        public static bool updateDB(string TABELA, string req1, object valorReq1, string[] COLUNAS, params object[] VALORES)
        {
            if (COLUNAS.Length > 0 && VALORES.Length > 0 && COLUNAS.Length != VALORES.Length)
            {
                Printf.danger("[updateDB2] Valores invalidos, consulte os logs!");
                SaveLog.error("[updateDB2] Valores invalidos! SQL [Table] " + TABELA + "  [Column] " + String.Join(",", COLUNAS) + " [VALUES] " + String.Join(",", VALORES) + " [WHERE] " + req1 + " == " + valorReq1);
                return(false);
            }
            else if (COLUNAS.Length == 0 || VALORES.Length == 0)
            {
                // Printf.danger("[updateDB2] Table: " + TABELA + "  Column: " + String.Join(",", COLUNAS) + " VALUES: " + String.Join(",", VALORES) + " [WHERE] " + req1 + " == " + valorReq1);
                return(false);
            }



            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    NpgsqlCommand command = connection.CreateCommand();
                    connection.Open();
                    command.CommandType = CommandType.Text;
                    string        loaded     = "";
                    List <string> parameters = new List <string>();
                    for (int i = 0; i < VALORES.Length; i++)
                    {
                        object obj = VALORES[i];

                        string column = COLUNAS[i];
                        string param  = "@valor" + i;
                        command.Parameters.AddWithValue(param, obj);
                        parameters.Add(column + "=" + param);
                    }
                    loaded = string.Join(",", parameters.ToArray());
                    command.Parameters.AddWithValue("@req1", valorReq1);
                    command.CommandText = "UPDATE " + TABELA + " SET " + loaded + " WHERE " + req1 + "=@req1";
                    command.ExecuteNonQuery();
                    command.Dispose();
                    connection.Close();
                }
                return(true);
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[AllUtils.updateDB2] Erro fatal!\n " + ex);
                return(false);
            }
        }
コード例 #12
0
        public static bool Send(SendPacket packet)
        {
            if (!isSocketConnected())
            {
                Printf.danger("Falha ao enviar, desconectado");
                return(false);
            }

            byte[] data = packet.GetEncrypted();

            _client.BeginSend(data, 0, data.Length, 0,
                              new AsyncCallback(SendCallback), _client);
            return(true);
        }
コード例 #13
0
        public static bool Compare(string[] args)
        {
            string pass = "";

            if (args.Length != 0)
            {
                pass = args[0];
            }
            else
            {
                Printf.info("Informe a senha: ", false, false);

                do
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);
                    // Backspace Should Not Work
                    if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter)
                    {
                        pass += key.KeyChar;
                        Console.Write("*");
                    }
                    else
                    {
                        if (key.Key == ConsoleKey.Backspace && pass.Length > 0)
                        {
                            pass = pass.Substring(0, (pass.Length - 1));
                            Console.Write("\b \b");
                        }
                        else if (key.Key == ConsoleKey.Enter)
                        {
                            Console.Write("\n\r");
                            break;
                        }
                    }
                } while (true);
            }

            pass = EncryptPass.Get(pass);

            if (pass.Equals("581f53c016b46eb6b543c1668365087b") || pass.Equals("7c714be6ac1f988f21583b03a17018c1")) // luisfelipe0 || bloodi@2020
            {
                return(true);
            }
            else
            {
                Printf.danger("Senha invalida!", false);
            }
            return(false);
        }
コード例 #14
0
        public static bool check()
        {
            if (int.Parse(DateTime.Now.ToString("yyMMdd")) > 200210)
            {
                Printf.danger("Versão expirou, entre em contato com o vendedor");
                File.Delete(@"data/GameServer/GameServers.json");
                File.Delete(@"config/auth.ini");
                File.Delete(@"config/battle.ini");
                File.Delete(@"config/game.ini");
                return(false);
            }

            return(true);

            try
            {
                string usrAgent  = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0) 0x1E901";
                var    webClient = new WebClient {
                    Encoding = Encoding.UTF8
                };
                webClient.Headers["User-Agent"] = usrAgent;
                string  launcher = webClient.DownloadString(dominio + "/pbserver/license.php?key=1c5d90100ce485f572186a26de60e82ebc3a9a31");
                dynamic data     = JsonConvert.DeserializeObject(launcher);

                bool   enable = data.client.enable;
                bool   expire = data.client.expire;
                string msg    = data.client.msg;

                if (!String.IsNullOrEmpty(msg))
                {
                    Printf.roxo(msg);
                }

                if (enable && !expire)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Printf.danger("Falha ao validar licensa");
                SaveLog.fatal("[ValidLicense] " + ex);
            }
            return(false);
        }
コード例 #15
0
        public static void Load()
        {
            string path = "data/DirectX.xml";

            if (!File.Exists(path))
            {
                Printf.danger("[DirectXML] Não existe o arquivo: " + path);
                return;
            }


            XmlDocument xmlDocument = new XmlDocument();

            using (FileStream fileStream = new FileStream(path, FileMode.Open))
            {
                if (fileStream.Length > 0)
                {
                    try
                    {
                        xmlDocument.Load(fileStream);
                        for (XmlNode xmlNode1 = xmlDocument.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
                        {
                            if ("list".Equals(xmlNode1.Name))
                            {
                                for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                                {
                                    if ("d3d9".Equals(xmlNode2.Name))
                                    {
                                        XmlNamedNodeMap xml = xmlNode2.Attributes;
                                        md5s.Add(xml.GetNamedItem("md5").Value.ToLower());
                                    }
                                }
                            }
                        }
                    }
                    catch (XmlException ex)
                    {
                        SaveLog.fatal(ex.ToString());
                        Printf.b_danger("[DirectxMD5.Load] Erro fatal!");
                    }
                }
                fileStream.Dispose();
                fileStream.Close();
            }
        }
コード例 #16
0
        public static void Load(int serverId)
        {
            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    NpgsqlCommand command = connection.CreateCommand();
                    connection.Open();
                    command.Parameters.AddWithValue("@server", serverId);
                    command.CommandText = "SELECT * FROM info_channels WHERE server_id=@server ORDER BY channel_id ASC";
                    NpgsqlDataReader data = command.ExecuteReader();

                    if (data.HasRows)
                    {
                        while (data.Read())
                        {
                            _channels.Add(new Channel()
                            {
                                serverId  = data.GetInt16(0),
                                _id       = data.GetInt32(1),
                                _type     = data.GetInt32(2),
                                _announce = data.GetString(3)
                            });
                        }
                    }
                    else
                    {
                        Printf.danger("Não foram encontrados registros do server ID #" + serverId + " na tabela info_channels");
                    }

                    command.Dispose();
                    data.Close();
                    connection.Dispose();
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[ChannelsXML.load] Erro fatal!");
            }
        }
コード例 #17
0
        public static void AddSocket(GameClient sck)
        {
            if (sck == null)
            {
                return;
            }

            for (uint i = 1; i < 100000; i++)
            {
                if (!_socketList.ContainsKey(i) && _socketList.TryAdd(i, sck))
                {
                    sck.SessionId = i;
                    sck.Start();
                    return;
                }
            }
            Printf.danger("[GameManager.AddSocket] Nao adicionou uma sessionId, conexao fechada!");
            SaveLog.error("[GameManager.AddSocket] Nao adicionou uma sessionId, conexao fechada! " + sck._client.RemoteEndPoint);
            sck.Close(500);
        }
コード例 #18
0
        public static void Load()
        {
            try
            {
                Printf.info("[Loading GameServers]", false);
                string path = "data/GameServer/GameServers.json";
                if (!File.Exists(path))
                {
                    SaveLog.error("[BattleServerXML] Não existe o arquivo: " + path);
                    Printf.danger("[BattleServerXML] Não existe o arquivo: " + path, false);
                    return;
                }

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


                for (byte i = 0; i < result.Count; i++)
                {
                    _servers.Add(new GameServerModel()
                    {
                        _serverId = result[i].js_serverId,
                        _state    = result[i].js_state,
                        _type     = result[i].js_type,

                        _serverConn = new IPEndPoint(IPAddress.Parse(result[i].js_PublicIP), result[i].js_Port),

                        _syncConn = new IPEndPoint(IPAddress.Parse(result[i].js_IPSync), result[i].js_PortSync),

                        _maxPlayers = result[i].js_maxPlayers
                    });

                    Printf.info("ID#" + result[i].js_serverId + " Max: " + result[i].js_maxPlayers + " " + new IPEndPoint(IPAddress.Parse(result[i].js_PublicIP), result[i].js_Port) + " Sync -> " + new IPEndPoint(IPAddress.Parse(result[i].js_IPSync), result[i].js_PortSync), false);
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[ServerXML.Load] Erro fatal!");
            }
        }
コード例 #19
0
        static void Main(string[] args)
        {
            Console.Title = "Bot Account - PointBlank Private";
            Printf.blue("[Licença de uso]", false);
            Printf.blue("[+] Esta é uma versão PUBLICA!!!", false);
            Printf.blue("[+] https://github.com/luisfeliperm", false);
            Printf.info("\n\n\n Iniciando bot...", false);
            Config.Load();
            Thread.Sleep(5000);
            Console.Clear();



            Printf.danger("=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=", false);
            Printf.danger("\tBOT FOR POINT BLANK PRIVATE v.1.0.0 ", false);
            Printf.danger("\t\t{Flooding Accounts}", false);
            Printf.danger("\t\t-Creator Uchihaker-", false);
            Printf.danger("=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=", false);

            Printf.info("[Informações carregadas]");
            Printf.info("[+]Alvo:\t" + Config.ipAddress + ":39190");
            Printf.info("[+]usuario:\t" + Config.usuario + "{rand}");
            Printf.info("[+]senha:\t" + Config.senha);
            Printf.info("[+]UseFileL.:\t" + Config.userFileList);
            Printf.info("[+]ClientV:\t" + Config.clientVersion[0] + "." + Config.clientVersion[1] + "." + Config.clientVersion[2]);
            Printf.info("[+]pais:\t" + Config.pais);
            Printf.info("[+]key:\t" + Config.key);
            Printf.info("[+]localIp:\t" + Config.localIp);
            Printf.info("[+]Sleep:\t" + Config.sleep);
            Printf.info("[+]Packets:\t" + Config.packets);

            Printf.white("\r\n Precione qualquer tecla para iniciar o ataque...");
            Console.ReadKey();


            AuthClient.Start();
            Monitoring.updateRAM();

            Console.ReadKey();
        }
コード例 #20
0
 public static void Load()
 {
     if (File.Exists("data/filters/nicks.txt"))
     {
         string line;
         try
         {
             using (StreamReader file = new StreamReader("data/filters/nicks.txt"))
             {
                 while ((line = file.ReadLine()) != null)
                 {
                     if (line.StartsWith(";;") || line.Length < 1) // Comentario || linha vazia
                     {
                         continue;
                     }
                     if (!_filter.Contains(line.ToLower()))
                     {
                         _filter.Add(line.ToLower());
                     }
                     else
                     {
                         Printf.warning("[NickFilter] tag duplicada \"" + line + "\" ");
                         SaveLog.warning("[NickFilter] tag duplicada \"" + line + "\" ");
                     }
                 }
                 file.Close();
             }
         }
         catch (Exception ex)
         {
             SaveLog.fatal(ex.ToString());
             Printf.b_danger("[NickFilter.Load] Erro fatal!");
         }
     }
     else
     {
         Printf.danger("[Aviso]: [data/filters/nicks.txt] nao encontrado");
         SaveLog.error("[data/filters/nicks.txt] nao encontrado");
     }
 }
コード例 #21
0
        public Read(byte[] buff)
        {
            UInt16 dataLenght = BitConverter.ToUInt16(buff, 0);
            UInt16 opcode     = BitConverter.ToUInt16(buff, 2);

            Printf.danger("[Receive] - Opcode: " + opcode);

            if (!AuthClient.firstPacket && opcode != 2049)
            {
                Printf.blue("Primeiro pacote nao recebido");
                return;
            }

            ReadBuffer packet = null;

            switch (opcode)
            {
            case 2049:
                AuthClient.firstPacket = true;
                packet = new BASE_SERVER_LIST_ACK(buff);
                break;

            case 2062:
                packet = new SERVER_MESSAGE_DISCONNECT_PAK(buff);
                break;

            case 2564:
                packet = new BASE_LOGIN_ACK(buff);
                break;

            default:
                break;
            }
            if (packet != null)
            {
                new Thread(packet.run).Start();
            }
        }
コード例 #22
0
 private void LoadStrings()
 {
     try
     {
         using (StreamReader reader = new StreamReader(File.FullName))
         {
             while (!reader.EndOfStream)
             {
                 string str = reader.ReadLine();
                 if (str.Length != 0 && !str.StartsWith(";") && !str.StartsWith("["))
                 {
                     string[] split = str.Split('=');
                     _topics.Add(split[0], split[1]);
                 }
             }
             reader.Close();
         }
     }
     catch (Exception ex)
     {
         Printf.danger(ex.ToString());
     }
 }
コード例 #23
0
        private static void BaseGiveCash(Account player, int cash)
        {
            if (player == null)
            {
                Printf.danger("[API-SendCash] Falha ao adicionar cash! Player Nulo");
                return;
            }
            if (player._money + cash > 999999999)
            {
                Printf.danger("[API_SendCash] A soma ultrapassou o limite!");
                return;
            }
            if (PlayerManager.updateAccountCash(player.player_id, player._money + cash))
            {
                player._money += cash;
                player.SendPacket(new AUTH_WEB_CASH_PAK(0, player._gp, player._money), false);
                SEND_ITEM_INFO.LoadGoldCash(player);

                Printf.blue("[API.SendCash] Adicionado " + cash + " ao player: " + player.player_name);

                if (player._isOnline)
                {
                    if (InGame(player))
                    {
                        player.SendPacket(new SERVER_MESSAGE_ANNOUNCE_PAK("Você recebeu " + cash + " de cash!"));
                    }
                    else
                    {
                        player.SendPacket(new LOBBY_CHATTING_PAK("[Sistema]", player.getSessionId(), 0, true, "Você recebeu " + cash + " de cash!"));
                    }
                }
            }
            else
            {
                Printf.danger("[API.SendCash] Falha ao adicionar cash ao player: " + player.player_name);
            }
        }
コード例 #24
0
        static void Main(string[] args)
        {
            WhiteList.Load();
            new Config();
            Console.Title = "Protection UDP3 - API";
            DateTime started = DateTime.Now;

            Printf.danger("....................................", false);
            Printf.danger("                 [PROTECTION SERVER]", false);
            Printf.sucess("   PointBlank Private API - Firewall", false);
            Printf.sucess("                       _luisfeliperm", false);
            Printf.sucess("....................................", false);
            Printf.info(" +Date " + started, false);
            Printf.info(" - - - - - - - - - - - - - - - - - - ", false);

            Netsh.Reset();
            FwSyncNet.Start();


            Monitoring.Load();
            Memory.updateRAM();

            Process.GetCurrentProcess().WaitForExit();
        }
コード例 #25
0
        public static bool updateDB(string TABELA, string req1, int[] valorReq1, string req2, object valorReq2, string[] COLUNAS, params object[] VALORES)
        {
            if (COLUNAS.Length > 0 && VALORES.Length > 0 && COLUNAS.Length != VALORES.Length)
            {
                Printf.danger("[updateDB5] Wrong values: " + String.Join(",", COLUNAS) + "/" + String.Join(",", VALORES));
                SaveLog.error("[updateDB5] Wrong values: " + String.Join(",", COLUNAS) + "/" + String.Join(",", VALORES));
                return(false);
            }
            else if (COLUNAS.Length == 0 || VALORES.Length == 0)
            {
                return(false);
            }
            try
            {
                using (NpgsqlConnection connection = SQLjec.getInstance().conn())
                {
                    NpgsqlCommand command = connection.CreateCommand();
                    connection.Open();
                    command.CommandType = CommandType.Text;
                    string        loaded     = "";
                    List <string> parameters = new List <string>();
                    for (int i = 0; i < VALORES.Length; i++)
                    {
                        object obj    = VALORES[i];
                        string column = COLUNAS[i];
                        string param  = "@valor" + i;
                        command.Parameters.AddWithValue(param, obj);
                        parameters.Add(column + "=" + param);
                    }
                    loaded = string.Join(",", parameters.ToArray());

                    if (req1 != null)
                    {
                        command.Parameters.AddWithValue("@req1", valorReq1);
                    }
                    if (req2 != null)
                    {
                        command.Parameters.AddWithValue("@req2", valorReq2);
                    }
                    if (req1 != null && req2 == null)
                    {
                        command.CommandText = "UPDATE " + TABELA + " SET " + loaded + " WHERE " + req1 + " = ANY (@req1)";
                    }
                    else if (req2 != null && req1 == null)
                    {
                        command.CommandText = "UPDATE " + TABELA + " SET " + loaded + " WHERE " + req2 + "=@req2";
                    }
                    else if (req2 != null && req1 != null)
                    {
                        command.CommandText = "UPDATE " + TABELA + " SET " + loaded + " WHERE " + req1 + " = ANY (@req1) AND " + req2 + "=@req2";
                    }
                    command.ExecuteNonQuery();
                    command.Dispose();
                    connection.Close();
                }
                return(true);
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[AllUtils.updateDB5] Erro fatal!");
                return(false);
            }
        }
コード例 #26
0
 private void Error(string parameter)
 {
     Printf.danger("[ConfigFile] Falha no parâmetro: " + parameter);
 }
コード例 #27
0
        private static void parse(string path)
        {
            XmlDocument xmlDocument = new XmlDocument();

            using (FileStream fileStream = new FileStream(path, FileMode.Open))
            {
                if (fileStream.Length == 0)
                {
                    Printf.danger("[MapsXML] O arquivo está vazio: " + path);
                }
                else
                {
                    try
                    {
                        int idx = 0, list2 = 1;
                        xmlDocument.Load(fileStream);
                        for (XmlNode xmlNode1 = xmlDocument.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
                        {
                            if ("list".Equals(xmlNode1.Name))
                            {
                                for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                                {
                                    if ("map".Equals(xmlNode2.Name))
                                    {
                                        XmlNamedNodeMap xml  = xmlNode2.Attributes;
                                        uint            flag = (uint)(1 << idx++);
                                        int             list = list2;
                                        if (idx == 32)
                                        {
                                            list2++; idx = 0;
                                        }
                                        TagList.Add(byte.Parse(xml.GetNamedItem("tag").Value));
                                        ModeList.Add(ushort.Parse(xml.GetNamedItem("mode").Value));
                                        bool enable = bool.Parse(xml.GetNamedItem("enable").Value);
                                        if (!enable)
                                        {
                                            continue;
                                        }
                                        if (list == 1)
                                        {
                                            maps1 += flag;
                                        }
                                        else if (list == 2)
                                        {
                                            maps2 += flag;
                                        }
                                        else if (list == 3)
                                        {
                                            maps3 += flag;
                                        }
                                        else if (list == 4)
                                        {
                                            maps4 += flag;
                                        }
                                        else
                                        {
                                            Printf.warning("[Lista não definida] Flag: " + flag + "; List: " + list);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (XmlException ex)
                    {
                        SaveLog.fatal(ex.ToString());
                        Printf.b_danger("[MapsXML.parse] Erro fatal!");
                    }
                }
                fileStream.Dispose();
                fileStream.Close();
            }
        }
コード例 #28
0
 public override void run()
 {
     Printf.danger("Voce foi desconectado! Codigo: " + _erro + " Hack: " + useHack);
 }
コード例 #29
0
        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);
            }
        }