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); }
public static void Reload() { lock (_servers) { _servers.Clear(); Load(); } Printf.info("Sucess! Total servers: " + _servers.Count, false); }
public static void info() // Exibe informações do rankUp { for (int i = 0; i < _events.Count; i++) { Console.WriteLine(" [" + (i + 1) + "]" + " Exp: " + _events[i]._percentXp + "% Gold: " + _events[i]._percentGp + "% Date: " + _events[i]._startDate + " - " + _events[i]._endDate); } short[] ativo = getEvent(); if (ativo == null) { Printf.info("\tActive: 0", false); } else { Printf.info("\tActive: Exp: " + ativo[0] + "% Gold: " + ativo[1] + "%", false); } }
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!"); } }
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); } }
public override void run() { try { Account p = _client._player; if (p == null) { return; } Room room = p._room; if (room == null) { return; } bool isBotMode = room.isBotMode(); SLOT slot = room.getSlot(p._slotId); if (slot == null || slot.state != SLOT_STATE.BATTLE) { return; } if (unk0 != 1 || unk5 != 0) { bool dc = false; bool autoBan = false; string msg = "[ANT HACK] O jogador " + p.player_name + " foi automaticamente BANIDO!"; switch (unk5) { case 1: autoBan = true; dc = true; break; case 24: dc = true; break; } SaveLog.LogAbuse((HackType)unk5 + " [" + unk0 + "," + unk5 + "] Player: " + p.player_name + " pId:" + p.player_id); if (autoBan) { ComDiv.updateDB("contas","access_level",-1,"player_id",p.player_id); p.access = AccessLevel.Banned; using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) room.SendPacketToPlayers(packet); SaveLog.info(msg); Printf.info(msg); } if (dc) { p.SendPacket(new SERVER_MESSAGE_DISCONNECT_PAK()); Printf.info("Jogador " + p.player_name + " desconectado por abuso"); SaveLog.info("Jogador " + p.player_name + " desconectado por abuso"); } } room._timeRoom = TimeRemaining; SyncPlayerPings(p,room,slot,isBotMode); //ENVIA A INFO PRO HOST if ((TimeRemaining > 0x80000000) && !room.swapRound && CompareRounds(room,Round) && (int)room._state == 5) { EndRound(room,isBotMode); } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[BATTLE_TIMERSYNC_REC.run] Erro fatal!"); } }