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>
28 lines
923 B
C#
28 lines
923 B
C#
using Flypaper.Core.Abstractions;
|
|
using Flypaper.Core.Models;
|
|
|
|
namespace Flypaper.Core.Strategies;
|
|
|
|
public sealed class LureStrategy(string name, string mediaType, byte[] body) : ITarpitStrategy, IStrategyDetails, IResponseHeaders
|
|
{
|
|
public const string PageName = "lure-page";
|
|
|
|
public const string IconName = "lure-icon";
|
|
|
|
public static LureStrategy Page() => new(PageName, "text/html; charset=utf-8", LureContent.Page());
|
|
|
|
public static LureStrategy Icon() => new(IconName, "image/x-icon", LureContent.Icon());
|
|
|
|
public string Name => name;
|
|
|
|
public string MediaType => mediaType;
|
|
|
|
public IReadOnlyDictionary<string, string> Headers => LureContent.Headers;
|
|
|
|
public bool Supports(TrapProtocol protocol) => protocol == TrapProtocol.Http;
|
|
|
|
public string Describe() => Name;
|
|
|
|
public async Task RunAsync(ITrapChannel channel, CancellationToken ct) => await channel.WriteAsync(body, ct);
|
|
}
|