Answer first visits to / and favicon with an instant WordPress lure
Unknown IPs get a small WordPress-looking page or icon and are not held; later requests are trapped as before. Switch: Flypaper__Drip__Lure. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2437880013
commit
4b946453fb
18 files changed
+360
-2
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using System.Net;
|
||||
using Flypaper.Core.Models;
|
||||
using Flypaper.Storage.Entities;
|
||||
using Flypaper.Storage.Queries;
|
||||
using Flypaper.Tests.Mcp;
|
||||
using Shouldly;
|
||||
|
||||
namespace Flypaper.Tests.Storage;
|
||||
|
||||
public sealed class KnownIpLookupTests : IDisposable
|
||||
{
|
||||
private readonly McpTestData _data = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Knows_only_ips_with_a_stored_catch()
|
||||
{
|
||||
using (var db = _data.Factory.CreateDbContext())
|
||||
{
|
||||
var started = McpTestData.Now.AddHours(-2);
|
||||
db.TrapEvents.Add(TrapEventEntity.From(new TrapEvent(
|
||||
Guid.NewGuid(), TrapProtocol.Http, IPAddress.Parse("2001:db8::7"), "lure-page", started, started.AddSeconds(1), 100, TrapOutcome.Completed, "GET /", null)));
|
||||
db.SaveChanges();
|
||||
}
|
||||
|
||||
var lookup = new KnownIpLookup(_data.Factory);
|
||||
|
||||
(await lookup.HasSeenAsync(IPAddress.Parse("2001:db8::7"), default)).ShouldBeTrue();
|
||||
(await lookup.HasSeenAsync(IPAddress.Parse("203.0.113.99"), default)).ShouldBeFalse();
|
||||
}
|
||||
|
||||
public void Dispose() => _data.Dispose();
|
||||
}
|
||||
Reference in new issue
Block a user