Class OastInteractionStore

Namespace
Kuestenlogik.Bowire.Oast.Server
Assembly
Kuestenlogik.Bowire.Oast.dll

The server's session + interaction registry (#35 Phase 2f). Sessions are keyed by correlation id — the first 20 characters of a callback host — which is how a DNS query for <corr><nonce>.oast.example.com is routed back to the client that planted it.

public sealed class OastInteractionStore
Inheritance
OastInteractionStore
Inherited Members

Remarks

In-memory and deliberately so: an interaction catcher holds other people's callback traffic, so the less it persists the better. Sessions idle out, and nothing survives a restart.

Constructors

OastInteractionStore(TimeProvider?, TimeSpan?)

Create a store. idleTimeout evicts sessions that stop polling (default 1h) so a long-lived catcher doesn't accumulate other people's traffic indefinitely.

public OastInteractionStore(TimeProvider? time = null, TimeSpan? idleTimeout = null)

Parameters

time TimeProvider
idleTimeout TimeSpan?

Properties

SessionCount

Live session count — surfaced by the status endpoint.

public int SessionCount { get; }

Property Value

int

Methods

EvictIdle()

Evict sessions idle past the timeout. Returns the number dropped. Called on a timer by the host.

public int EvictIdle()

Returns

int

Poll(string, string)

Drain a session's callbacks. Returns null when the id is unknown or the secret is wrong — the endpoint maps both to 401 so a caller can't probe which correlation ids exist.

public (byte[] AesKey, RSA PublicKey, List<OastInteraction> Interactions)? Poll(string correlationId, string secret)

Parameters

correlationId string
secret string

Returns

(byte[] AesKey, RSA PublicKey, List<OastInteraction> Interactions)?

Record(string, OastInteraction)

Record a callback against whichever session planted the host. Unknown hosts are dropped: the internet scans port 53, and traffic nobody registered for is noise, not evidence.

public bool Record(string callbackHost, OastInteraction interaction)

Parameters

callbackHost string
interaction OastInteraction

Returns

bool

Remove(string, string)

Drop a session (client deregistered).

public bool Remove(string correlationId, string secret)

Parameters

correlationId string
secret string

Returns

bool

TryRegister(string, string, string)

Register a client. publicKeyPem is the PEM text the client base64'd into the request. Returns false when the key is unusable, which the endpoint turns into a 400 rather than a 500.

public bool TryRegister(string correlationId, string secret, string publicKeyPem)

Parameters

correlationId string
secret string
publicKeyPem string

Returns

bool