Exemple #1
0
        /// <summary>
        /// this event will trigger when punkbuster get new player connect and run "pb_sv_plist" to list player.
        /// <para>1, MUST wait "admin.listPlayers all" finished (<see cref="hasListPlayers"/>)</para>
        /// <para>2, Only get new punkbuster player info (<see cref="isNewConnection"/>)</para>
        /// <para>3, If first enable plugin,get all punkbuster player info (<see cref="isFirstEnable"/>)</para>
        /// </summary>
        /// <param name="playerInfo"></param>
        public override void OnPunkbusterPlayerInfo(CPunkbusterInfo playerInfo)
        {
            if (!isEnable)
            {
                return;
            }
            base.OnPunkbusterPlayerInfo(playerInfo);

            if ((isNewConnection || isFirstEnable) && hasListPlayers)
            {
                string soldierName = playerInfo.SoldierName;
                if (!FrostbitePlayerInfoList.ContainsKey(soldierName) ||
                    FrostbitePlayerInfoList[soldierName].GUID.Length != 35 ||
                    playerInfo.GUID.Length != 32)
                {
                    return;
                }
                CPlayerInfo           info        = FrostbitePlayerInfoList[soldierName];
                Func <object, object> NullChecker = o => o ?? DBNull.Value;
                DbParameter[]         parameters  = new DbParameter[]
                {
                    new MySqlParameter("@ipaddress", NullChecker(playerInfo.Ip)),
                    new MySqlParameter("@clantag", NullChecker(info.ClanTag)),
                    new MySqlParameter("@soldiername", NullChecker(soldierName)),
                    new MySqlParameter("@eaguid", NullChecker(info.GUID)),
                    new MySqlParameter("@pbguid", NullChecker(playerInfo.GUID)),
                    new MySqlParameter("@country", NullChecker(playerInfo.PlayerCountry)),
                    new MySqlParameter("@countrycode", NullChecker(playerInfo.PlayerCountryCode)),
                };
                InsertPbInfo(parameters);
            }
        }
Exemple #2
0
        public Hashtable updatePB(CPunkbusterInfo cpbiPlayer, String apiKey)
        {
            try
            {
                String result = (string)bf4db_API.GetType().GetMethod("updatePB").Invoke(bf4db_API, new object[] { (object)cpbiPlayer.SoldierName, (object)cpbiPlayer.GUID, (object)cpbiPlayer.Ip, (object)cpbiPlayer.PlayerCountryCode, (object)apiKey });

                Hashtable json = (Hashtable)JSON.JsonDecode(result);

                // check we got a valid response
                if (!(json.ContainsKey("response")))
                {
                    ConsoleException("No Response!");
                }

                String response = (String)json["response"];
                String message  = (String)json["message"];

                // verify we got a success message
                if (!(response.StartsWith("success")))
                {
                    ConsoleException("BF4DB, " + message);
                }

                DebugWrite(message, 1);

                return(json);
            }
            catch (Exception ex)
            {
                ConsoleException(ex.Message);
                return(null);
            }
        }
Exemple #3
0
        public override void OnPunkbusterPlayerInfo(CPunkbusterInfo playerInfo)
        {
            if (!this.dicPingPlayer.ContainsKey(playerInfo.SoldierName))
            {
                string[] ipPort = playerInfo.Ip.Split(':');
                string   ip     = ipPort[0];
                this.dicPingPlayer.Add(playerInfo.SoldierName, new CPingPlayer(playerInfo.SoldierName, ip));
            }

            this.RegisterAllCommands();
        }
Exemple #4
0
 public void threadPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
     if (!bf4db_PBPlayers.Contains(cpbiPlayer.SoldierName))
     {
         bf4db_PBPlayers.Add(cpbiPlayer.SoldierName);
         updatePB(cpbiPlayer, bf4db_APIKey);
     }
     else
     {
         DebugWrite("Player " + cpbiPlayer.SoldierName + " already updated!", 1);
     }
 }
 public override void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
     if (cpbiPlayer != null)
     {
         if (this.dicCountrys.ContainsKey(cpbiPlayer.SoldierName) == false)
         {
             this.dicCountrys.Add(cpbiPlayer.SoldierName, cpbiPlayer.PlayerCountry);
         }
         else
         {
             this.dicCountrys[cpbiPlayer.SoldierName] = cpbiPlayer.PlayerCountry;
         }
     }
 }
 public void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
     if (cpbiPlayer != null)
     {
         if (this.m_dicPbInfo.ContainsKey(cpbiPlayer.SoldierName) == false)
         {
             this.m_dicPbInfo.Add(cpbiPlayer.SoldierName, cpbiPlayer);
         }
         else
         {
             this.m_dicPbInfo[cpbiPlayer.SoldierName] = cpbiPlayer;
         }
     }
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="playerInfo"></param>
 public virtual void OnPunkbusterPlayerInfo(CPunkbusterInfo playerInfo)
 {
     if (playerInfo != null)
     {
         if (this.PunkbusterPlayerInfoList.ContainsKey(playerInfo.SoldierName) == false)
         {
             this.PunkbusterPlayerInfoList.Add(playerInfo.SoldierName, playerInfo);
         }
         else
         {
             this.PunkbusterPlayerInfoList[playerInfo.SoldierName] = playerInfo;
         }
     }
 }
Exemple #8
0
 public void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
     if (bf4db_IsValid == true)
     {
         CPunkbusterInfo player = cpbiPlayer;
         ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state)
         {
             threadPunkbusterPlayerInfo(player);
         }), null);
     }
     else
     {
         ConsoleError("API Key is invalid! Please fix it and toggle plugin.");
     }
 }
Exemple #9
0
        public override void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
        {
            if (cpbiPlayer != null)
            {
                if (this.m_dicPbInfo.ContainsKey(cpbiPlayer.SoldierName) == false)
                {
                    this.m_dicPbInfo.Add(cpbiPlayer.SoldierName, cpbiPlayer);
                }
                else
                {
                    this.m_dicPbInfo[cpbiPlayer.SoldierName] = cpbiPlayer;
                }

                this.RegisterAllCommands();
            }
        }
Exemple #10
0
 public override void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
     if (cpbiPlayer != null)
     {
         if (this.punkbusterPlayer.ContainsKey(cpbiPlayer.SoldierName) == false)
         {
             this.punkbusterPlayer.Add(cpbiPlayer.SoldierName, cpbiPlayer);
         }
         else
         {
             this.punkbusterPlayer[cpbiPlayer.SoldierName] = cpbiPlayer;
         }
         if (this.joinDelay.Contains(cpbiPlayer.SoldierName) == true)
         {
             this.joinDelay.Remove(cpbiPlayer.SoldierName);
         }
     }
 }
Exemple #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="playerInfo"></param>
 public virtual void OnPunkbusterPlayerInfo(CPunkbusterInfo playerInfo) {
     if (playerInfo != null) {
         if (this.PunkbusterPlayerInfoList.ContainsKey(playerInfo.SoldierName) == false) {
             this.PunkbusterPlayerInfoList.Add(playerInfo.SoldierName, playerInfo);
         }
         else {
             this.PunkbusterPlayerInfoList[playerInfo.SoldierName] = playerInfo;
         }
     }
 }
Exemple #12
0
 public void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
 {
 }
Exemple #13
0
 private void m_prcClient_PunkbusterPlayerInfo(PRoConClient sender, CPunkbusterInfo pbInfo) {
     InvokeOnAllEnabled("OnPunkbusterPlayerInfo", pbInfo);
 }
        private void m_prcClient_PunkbusterPlayerInfo(PRoConClient sender, CPunkbusterInfo pbInfo) {
            this.m_blPropogatingIndexChange = true;

            if (this.m_dicPlayers.ContainsKey(pbInfo.SoldierName) == true) {

                AdditionalPlayerInfo sapiAdditional;

                if (this.m_dicPlayers[pbInfo.SoldierName].Tag == null) {
                    sapiAdditional = new AdditionalPlayerInfo();
                    sapiAdditional.m_strResolvedHostName = String.Empty;
                }
                else {
                    sapiAdditional = (AdditionalPlayerInfo)this.m_dicPlayers[pbInfo.SoldierName].Tag;
                }

                sapiAdditional.m_pbInfo = pbInfo;

                this.m_dicPlayers[pbInfo.SoldierName].Tag = sapiAdditional;

                this.m_dicPlayers[pbInfo.SoldierName].Text = pbInfo.SlotID;
                
                //string strCountryCode = this.m_frmMain.GetCountryCode(pbInfo.Ip);
                if (this.m_frmMain.iglFlags.Images.ContainsKey(pbInfo.PlayerCountryCode + ".png") == true && this.m_dicPlayers[sapiAdditional.m_pbInfo.SoldierName].ImageIndex < 0) {
                    this.m_dicPlayers[pbInfo.SoldierName].ImageIndex = this.m_frmMain.iglFlags.Images.IndexOfKey(pbInfo.PlayerCountryCode + ".png");
                }

                this.RefreshSelectedPlayer();
            }

            this.m_blPropogatingIndexChange = false;
        }
Exemple #15
0
        protected void OnPunkbusterMessage(FrostbiteClient sender, string strPunkbusterMessage) {

            strPunkbusterMessage = strPunkbusterMessage.TrimEnd('\r', '\n');

            // PunkBuster Server: ([0-9]+)[ ]? ([A-Za-z0-9]+)\(.*?\) ([0-9\.:]+).*?\(.*?\) "(.*?)"
            // PunkBuster Server: 1  2c90591ce08a5f799622705d7ba1155c(-) 192.168.1.3:52460 OK   1 3.0 0 (W) "(U3)Phogue"
            //Match mMatch = Regex.Match(strPunkbusterMessage, @":[ ]+?(?<slotid>[0-9]+)[ ]+?(?<guid>[A-Za-z0-9]+)\(.*?\)[ ]+?(?<ip>[0-9\.:]+).*?\(.*?\)[ ]+?""(?<name>.*?)\""", RegexOptions.IgnoreCase);
            Match mMatch = this.Parent.RegexMatchPunkbusterPlist.Match(strPunkbusterMessage);
            // If it is a punkbuster pb_plist update
            if (mMatch.Success == true && mMatch.Groups.Count >= 5) {

                CPunkbusterInfo newPbInfo = new CPunkbusterInfo(mMatch.Groups["slotid"].Value, mMatch.Groups["name"].Value, mMatch.Groups["guid"].Value, mMatch.Groups["ip"].Value, this.Parent.GetCountryName(mMatch.Groups["ip"].Value), this.Parent.GetCountryCode(mMatch.Groups["ip"].Value));

                if (this.PunkbusterPlayerInfo != null) {
                    FrostbiteConnection.RaiseEvent(this.PunkbusterPlayerInfo.GetInvocationList(), this, newPbInfo);
                }
            }

            mMatch = this.Parent.RegexMatchPunkbusterBeginPlist.Match(strPunkbusterMessage);
            if (mMatch.Success == true && this.PunkbusterBeginPlayerInfo != null) {
                FrostbiteConnection.RaiseEvent(this.PunkbusterBeginPlayerInfo.GetInvocationList(), this);
            }

            mMatch = this.Parent.RegexMatchPunkbusterEndPlist.Match(strPunkbusterMessage);
            if (mMatch.Success == true && this.PunkbusterEndPlayerInfo != null) {
                FrostbiteConnection.RaiseEvent(this.PunkbusterEndPlayerInfo.GetInvocationList(), this);
            }

            // PunkBuster Server: Player Guid Computed ([A-Za-z0-9]+)\(.*?\) \(slot #([0-9]+)\) ([0-9\.:]+) (.*)
            // PunkBuster Server: Player Guid Computed 2c90591ce08a5f799622705d7ba1155c(-) (slot #1) 192.168.1.3:52581 (U3)Phogue
            //mMatch = Regex.Match(strPunkbusterMessage, @": Player Guid Computed[ ]+?(?<guid>[A-Za-z0-9]+)\(.*?\)[ ]+?\(slot #(?<slotid>[0-9]+)\)[ ]+?(?<ip>[0-9\.:]+)[ ]+?(?<name>.*)", RegexOptions.IgnoreCase);
            mMatch = this.Parent.RegexMatchPunkbusterGuidComputed.Match(strPunkbusterMessage);
            // If it is a new connection, technically its a resolved guid type command but stil..
            if (mMatch.Success == true && mMatch.Groups.Count >= 5) {

                CPunkbusterInfo newPbInfo = new CPunkbusterInfo(mMatch.Groups["slotid"].Value, mMatch.Groups["name"].Value, mMatch.Groups["guid"].Value, mMatch.Groups["ip"].Value, this.Parent.GetCountryName(mMatch.Groups["ip"].Value), this.Parent.GetCountryCode(mMatch.Groups["ip"].Value));

                if (this.PunkbusterPlayerInfo != null) {
                    FrostbiteConnection.RaiseEvent(this.PunkbusterPlayerInfo.GetInvocationList(), this, newPbInfo);
                }
            }

            //mMatch = Regex.Match(strPunkbusterMessage, @":[ ]+?(?<banid>[0-9]+)[ ]+?(?<guid>[A-Za-z0-9]+)[ ]+?{(?<remaining>[0-9\-]+)/(?<banlength>[0-9\-]+)}[ ]+?""(?<name>.+?)""[ ]+?""(?<ip>.+?)""[ ]+?(?<reason>.*)", RegexOptions.IgnoreCase);
            mMatch = this.Parent.RegexMatchPunkbusterBanlist.Match(strPunkbusterMessage);
            if (mMatch.Success == true && mMatch.Groups.Count >= 5) {

                //IPAddress ipOut;
                string strIP = String.Empty;
                string[] a_strIP;

                if (mMatch.Groups["ip"].Value.Length > 0 && (a_strIP = mMatch.Groups["ip"].Value.Split(':')).Length > 0) {
                    strIP = a_strIP[0];
                }

                CBanInfo newPbBanInfo = new CBanInfo(mMatch.Groups["name"].Value, mMatch.Groups["guid"].Value, mMatch.Groups["ip"].Value, new TimeoutSubset(mMatch.Groups["banlength"].Value, mMatch.Groups["remaining"].Value), mMatch.Groups["reason"].Value);

                if (this.PunkbusterPlayerBanned != null) {
                    FrostbiteConnection.RaiseEvent(this.PunkbusterPlayerBanned.GetInvocationList(), this, newPbBanInfo);
                }
            }
            
            //PunkBuster Server: Kick/Ban Command Issued (testing) for (slot#1) xxx.xxx.xxx.xxx:yyyy GUID name
            mMatch = this.Parent.RegexMatchPunkbusterKickBanCmd.Match(strPunkbusterMessage);
            if (mMatch.Success == true && mMatch.Groups.Count >= 5)
            {
                //IPAddress ipOut;
                string strIP = String.Empty;
                string[] a_strIP;

                if (mMatch.Groups["ip"].Value.Length > 0 && (a_strIP = mMatch.Groups["ip"].Value.Split(':')).Length > 0)
                {
                    strIP = a_strIP[0];
                }

                TimeoutSubset kb_timeoutSubset;
                if (String.Compare(mMatch.Groups["kb_type"].ToString(), "Kick/Ban", true) == 0) {
                    kb_timeoutSubset = new TimeoutSubset(new List<string>() { "perm", "" });
                }
                else {
                    kb_timeoutSubset = new TimeoutSubset(new List<string>() { "seconds", "120" });
                }

                //CBanInfo newPbBanInfo = new CBanInfo(mMatch.Groups["name"].Value, mMatch.Groups["guid"].Value, mMatch.Groups["ip"].Value, new TimeoutSubset("perm",""), mMatch.Groups["reason"].Value);
                CBanInfo newPbBanInfo = new CBanInfo(mMatch.Groups["name"].Value, mMatch.Groups["guid"].Value, mMatch.Groups["ip"].Value, kb_timeoutSubset, mMatch.Groups["reason"].Value);

                if (this.PunkbusterPlayerBanned != null)
                {
                    FrostbiteConnection.RaiseEvent(this.PunkbusterPlayerBanned.GetInvocationList(), this, newPbBanInfo);
                }
            }
            
            //mMatch = Regex.Match(strPunkbusterMessage, @":[ ]+?Guid[ ]+?(?<guid>[A-Za-z0-9]+)[ ]+?has been Unbanned", RegexOptions.IgnoreCase);
            mMatch = this.Parent.RegexMatchPunkbusterUnban.Match(strPunkbusterMessage);
            // If it is a new connection, technically its a resolved guid type command but stil..
            if (mMatch.Success == true && mMatch.Groups.Count >= 2) {
                CBanInfo cbiUnbannedPlayer = new CBanInfo(String.Empty, mMatch.Groups["guid"].Value, String.Empty, new TimeoutSubset(TimeoutSubset.TimeoutSubsetType.None), String.Empty);

                if (this.PunkbusterPlayerUnbanned != null) {
                    FrostbiteConnection.RaiseEvent(this.PunkbusterPlayerUnbanned.GetInvocationList(), this, cbiUnbannedPlayer);
                }
            }

            //mMatch = Regex.Match(strPunkbusterMessage, @": Ban Added to Ban List", RegexOptions.IgnoreCase);
            mMatch = this.Parent.RegexMatchPunkbusterBanAdded.Match(strPunkbusterMessage);
            if (mMatch.Success == true && mMatch.Groups.Count >= 5) {
                this.SendRequest(new List<string>() { "punkBuster.pb_sv_command", this.Variables.GetVariable<string>("PUNKBUSTER_BANLIST_REFRESH", "pb_sv_banlist BC2! ") });
            }
        }
Exemple #16
0
        //Do all our checks here
        public override void OnPlayerKilled(Kill kKillerVictimDetails)
        {
            if (readySetGo)
            {
                if (kKillerVictimDetails != null)
                {
                    CPlayerInfo killer = kKillerVictimDetails.Killer;
                    if ((String.IsNullOrEmpty(killer.SoldierName) == true) || (killer.Type == 3) || (this.joinDelay.Contains(killer.SoldierName)))
                    {
                        //	WriteLog("Killers name is blank.  They just killed " + kKillerVictimDetails.Victim.SoldierName);
                    }
                    else
                    {
                        if (this.normalPlayer.ContainsKey(killer.SoldierName) == true)
                        {
                            if (String.IsNullOrEmpty(killer.GUID) == true)
                            {
                                WriteLog(killer.SoldierName + " has missing EA_GUID", killer.SoldierName, "");
                                PBHackAction(killer.SoldierName, "");
                            }
                        }
                        else
                        {
                            WriteLog(killer.SoldierName + "(" + killer.GUID + ") has no record", killer.SoldierName, killer.GUID);
                        }

                        if (this.punkbusterPlayer.ContainsKey(killer.SoldierName) == true)
                        {
                            CPunkbusterInfo PBPlayer = this.punkbusterPlayer[killer.SoldierName];
                            if (String.IsNullOrEmpty(PBPlayer.GUID) == true)
                            {
                                WriteLog(killer.SoldierName + "(" + killer.GUID + ") has no PBGUID", killer.SoldierName, killer.GUID);
                                PBHackAction(killer.SoldierName, killer.GUID);
                            }
                            if (PBPlayer.GUID.Length != 32)
                            {
                                WriteLog(killer.SoldierName + "(" + killer.GUID + ") has incorrect PBGUID Length", killer.SoldierName, killer.GUID);
                                PBHackAction(killer.SoldierName, killer.GUID);
                            }

                            if (!(System.Text.RegularExpressions.Regex.IsMatch(PBPlayer.GUID, @"^[a-zA-Z0-9]+$")))
                            {
                                WriteLog(killer.SoldierName + "(" + killer.GUID + ") has invalid PBGUID", killer.SoldierName, killer.GUID);
                                PBHackAction(killer.SoldierName, killer.GUID);
                            }

                            if (String.IsNullOrEmpty(PBPlayer.Ip) == true)
                            {
                                WriteLog(killer.SoldierName + "(" + killer.GUID + ") has no IP Address", killer.SoldierName, killer.GUID);
                                PBHackAction(killer.SoldierName, killer.GUID);
                            }
                        }
                        else
                        {
                            WriteLog(killer.SoldierName + "(" + killer.GUID + ") has no PB record", killer.SoldierName, killer.GUID);
                            PBHackAction(killer.SoldierName, killer.GUID);
                        }
                    }
                }
                else
                {
                    WriteLog("Blank killer detected", "Log", "Log");
                }
            }
        }
Exemple #17
0
 public override void OnPunkbusterPlayerInfo(CPunkbusterInfo playerInfo)
 {
     base.OnPunkbusterPlayerInfo(playerInfo);
     Output.TraceInformation("OnPunkbusterPlayerInfo {0}", playerInfo.SoldierName);
 }
        public override void OnPunkbusterPlayerInfo(CPunkbusterInfo cpbiPlayer)
        {
            base.OnPunkbusterPlayerInfo(cpbiPlayer);

            this.RegisterAllCommands();
        }