コード例 #1
0
        public void T1_CheckFailAfterAttempt()
        {
            var antispam = new AntiSpam(TimeSpan.FromSeconds(10), 3);

            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeFalse();
            antispam.Check().Should().BeFalse();
        }
コード例 #2
0
        public async Task PrepareAsync()
        {
            _serviceControlManager = new ServiceControlManager(_type);
            _reactionHandler       = new ReactionHandler();
            _antiMessageSpam       = new AntiSpam(SpamType.Message);
            _antiReactionSpam      = new AntiSpam(SpamType.Reaction);

            _client.ReactionAdded   += OnReactionAdditionAsync;
            _client.ReactionRemoved += OnReactionRemoving;
            _client.Connected       += OnConnection;
            _client.Disconnected    += OnDisconnection;
            _client.UserJoined      += OnUserJoining;
            _client.MessageReceived += OnMessageReceivingAsync;

            await _client.SetGameAsync("ANBOTIP Group");
        }
コード例 #3
0
        public void T2_CheckPassWhenWaitingEnough()
        {
            var fakeTimeProvider = new FakeTimeProvider();

            var antispam = new AntiSpam(TimeSpan.FromSeconds(10), 3, fakeTimeProvider);

            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();

            fakeTimeProvider.date = fakeTimeProvider.date.AddSeconds(10);

            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeTrue();
            antispam.Check().Should().BeFalse();
            antispam.Check().Should().BeFalse();
        }
コード例 #4
0
 static void KPAVWebProxyApplication_BeforeRequest(Session session)
 {
     try
     {
         con++;
         if (!session.fullUrl.Contains("arsslenserv.eb2a.com") && !session.fullUrl.Contains("arsslensoft.tk") && !(session.fullUrl == "http://www.threatexpert.com/reports.aspx"))
         {
             if (BlockNet)
             {
                 session.Abort();
             }
             else
             {
                 string content = session.oRequest["Accept"];
                 if (session.HTTPMethodIs("GET"))
                 {
                     if (CTYPE.Contains(content))
                     {
                         Pages.Add(session.fullUrl);
                         SafeBrowse(session);
                     }
                 }
                 else if (session.HTTPMethodIs("POST"))
                 {
                     if (SettingsManager.HighSenseFilter)
                     {
                         string w = null;
                         if (AntiSpam.TCheck(session.GetRequestBodyAsString(), out w))
                         {
                             session.requestBodyBytes = session.GetRequestBodyEncoding().GetBytes(session.GetRequestBodyAsString().Replace(w, "UNSAFE"));
                         }
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }
コード例 #5
0
        public void T3_CheckFailWhenZeroMessages()
        {
            var antispam = new AntiSpam(TimeSpan.FromSeconds(10), 0);

            antispam.Check().Should().BeFalse();
        }