Add Flypaper solution skeleton with HTTP tarpit, SQLite event log and tests
This commit is contained in:
1 parent
20314268c6
commit
f9161f48e7
55 files changed
+1331
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flypaper.Storage;
|
||||
|
||||
public sealed class FlypaperDbContext(DbContextOptions<FlypaperDbContext> options) : DbContext(options)
|
||||
{
|
||||
internal const int MaxTextLength = 2048;
|
||||
|
||||
public DbSet<TrapEventEntity> TrapEvents => Set<TrapEventEntity>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
var trapEvent = modelBuilder.Entity<TrapEventEntity>();
|
||||
trapEvent.Property(e => e.Protocol).HasConversion<string>().HasMaxLength(16);
|
||||
trapEvent.Property(e => e.Outcome).HasConversion<string>().HasMaxLength(16);
|
||||
trapEvent.Property(e => e.RemoteIp).HasMaxLength(64);
|
||||
trapEvent.Property(e => e.Strategy).HasMaxLength(64);
|
||||
trapEvent.Property(e => e.Target).HasMaxLength(MaxTextLength);
|
||||
trapEvent.Property(e => e.ClientInfo).HasMaxLength(MaxTextLength);
|
||||
trapEvent.HasIndex(e => e.StartedAt);
|
||||
trapEvent.HasIndex(e => e.RemoteIp);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user