Exemplo n.º 1
0
            public Task LoginAttemptFailed(string ipAddress, string source, string userName, string machineGuid, string osName, string osVersion, int count, DateTime timestamp)
            {
                var events = new IPAddressLogEvent[] { new IPAddressLogEvent(ipAddress, userName, source, count, IPAddressEventType.Blocked, IPBanService.UtcNow, true) };

                service.AddIPAddressLogEvents(events);
                return(Task.CompletedTask);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Process event viewer XML
        /// </summary>
        /// <param name="xml">XML</param>
        public void ProcessEventViewerXml(string xml)
        {
            IPBanLog.Debug("Processing event viewer xml: {0}", xml);

            XmlDocument       doc  = ParseXml(xml);
            IPAddressLogEvent info = ExtractEventViewerXml(doc);

            if (info != null && info.FoundMatch && (info.Type == IPAddressEventType.FailedLogin || info.Type == IPAddressEventType.SuccessfulLogin))
            {
                if (!FindSourceAndUserNameForInfo(info, doc))
                {
                    // bad ip address
                    return;
                }
                service.AddIPAddressLogEvents(new IPAddressLogEvent[] { info });
                IPBanLog.Debug("Event viewer found: {0}, {1}, {2}, {4}", info.IPAddress, info.Source, info.UserName, info.Type);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Process event viewer XML
        /// </summary>
        /// <param name="xml">XML</param>
        public void ProcessEventViewerXml(string xml)
        {
            IPBanLog.Debug("Processing event viewer xml: {0}", xml);

            XmlDocument       doc  = ParseXml(xml);
            IPAddressLogEvent info = ExtractEventViewerXml(doc);

            if (info != null && info.FoundMatch)
            {
                if (info.Type == IPAddressEventType.FailedLogin && !AddFailedLoginForEventViewerXml(info, doc))
                {
                    // if fail to add the failed login (bad ip, etc.) exit out
                    return;
                }
                System.Diagnostics.Debug.Assert(info.Type == IPAddressEventType.FailedLogin || info.Type == IPAddressEventType.SuccessfulLogin);
                service.AddIPAddressLogEvents(new IPAddressLogEvent[] { info });
                IPBanLog.Debug("Event viewer found: {0}, {1}, {2}, {4}", info.IPAddress, info.Source, info.UserName, info.Type);
            }
        }