Show the strategy of each catch in the dashboard
Add a Strategie column to the catch list (searchable, filterable) and a Strategien tab to the Top 10 card. The MCP top tool accepts strategies. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d3e6f8842
commit
b7027e2a72
15 files changed
+83
-24
No files matched your search
@@ -98,6 +98,7 @@ public sealed class FlypaperToolsTests : IDisposable
|
||||
[InlineData("countries", "CN", 2)]
|
||||
[InlineData("providers", "AS4134", 2)]
|
||||
[InlineData("targets", "GET /.env", 1)]
|
||||
[InlineData("strategies", "html-drip", 4)]
|
||||
[InlineData("user_agents", "zgrab/0.x", 2)]
|
||||
public async Task Top_ranks_each_dimension(string dimension, string firstKey, int firstCount)
|
||||
{
|
||||
|
||||
@@ -119,8 +119,8 @@ public sealed class McpEndpointTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("top", """{"by":"countries","period":"all"}""", "unknown parameter 'by'; expected 'dimension' (ips|countries|providers|targets|user_agents)")]
|
||||
[InlineData("top", """{"period":"all"}""", "missing required parameter 'dimension' (ips|countries|providers|targets|user_agents)")]
|
||||
[InlineData("top", """{"by":"countries","period":"all"}""", "unknown parameter 'by'; expected 'dimension' (ips|countries|providers|targets|strategies|user_agents)")]
|
||||
[InlineData("top", """{"period":"all"}""", "missing required parameter 'dimension' (ips|countries|providers|targets|strategies|user_agents)")]
|
||||
[InlineData("list_catches", """{"countryCode":"GB"}""", "unknown parameter 'countryCode'")]
|
||||
public async Task Invalid_arguments_return_a_readable_tool_error(string tool, string arguments, string expected)
|
||||
{
|
||||
|
||||
@@ -19,11 +19,11 @@ internal sealed class McpTestData : IDisposable
|
||||
using var db = Factory.CreateDbContext();
|
||||
db.Database.Migrate();
|
||||
|
||||
Add(db, "203.0.113.9", hoursAgo: 1, seconds: 3600, "CN", "Volksrepublik China", "Beijing", 4134, "Chinanet", "GET /.env", "zgrab/0.x");
|
||||
Add(db, "203.0.113.9", hoursAgo: 1, seconds: 3600, "CN", "Volksrepublik China", "Beijing", 4134, "Chinanet", "GET /.env", "zgrab/0.x", strategy: "env-drip");
|
||||
Add(db, "203.0.113.9", hoursAgo: 2, seconds: 120, "CN", "Volksrepublik China", "Beijing", 4134, "Chinanet", "GET example.com/wp-login.php", "zgrab/0.x");
|
||||
Add(db, "198.51.100.7", hoursAgo: 3, seconds: 30, "TW", "Republik China", "Taipeh", 3462, "Data Communication Business Group", "GET /.git/config", "curl/8.5.0");
|
||||
Add(db, "2001:db8::1", hoursAgo: 30, seconds: 900, "US", "Vereinigte Staaten von Amerika", "Mountain View", 15169, "Google LLC", "POST /xmlrpc.php", "python-requests/2.31");
|
||||
Add(db, "198.51.100.7", hoursAgo: 4, seconds: 0, "TW", "Republik China", "Taipeh", 3462, "Data Communication Business Group", "GET /.env", "curl/8.5.0", TrapOutcome.Rejected);
|
||||
Add(db, "198.51.100.7", hoursAgo: 4, seconds: 0, "TW", "Republik China", "Taipeh", 3462, "Data Communication Business Group", "GET /.env", "curl/8.5.0", TrapOutcome.Rejected, "env-drip");
|
||||
Add(db, "192.0.2.50", hoursAgo: 200, seconds: 5, null, null, null, null, null, "GET /", null);
|
||||
db.SaveChanges();
|
||||
}
|
||||
@@ -44,14 +44,15 @@ internal sealed class McpTestData : IDisposable
|
||||
string? provider,
|
||||
string target,
|
||||
string? userAgent,
|
||||
TrapOutcome outcome = TrapOutcome.ClientAborted)
|
||||
TrapOutcome outcome = TrapOutcome.ClientAborted,
|
||||
string strategy = "html-drip")
|
||||
{
|
||||
var started = Now.AddHours(-hoursAgo);
|
||||
var entity = TrapEventEntity.From(new TrapEvent(
|
||||
Guid.NewGuid(),
|
||||
TrapProtocol.Http,
|
||||
IPAddress.Parse(ip),
|
||||
"html-drip",
|
||||
strategy,
|
||||
started,
|
||||
started.AddSeconds(seconds),
|
||||
seconds * 10,
|
||||
|
||||
Reference in new issue
Block a user