Add link labyrinth, static robots.txt and robots bait paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7027e2a72
commit
a25072e6fb
29 files changed
+774
-34
No files matched your search
@@ -18,7 +18,6 @@ public sealed class FileContentTests
|
||||
[InlineData("/docker-compose.yml", "yaml-drip")]
|
||||
[InlineData("/backup/db.sql", "sql-drip")]
|
||||
[InlineData("/.git/config", "git-drip")]
|
||||
[InlineData("/robots.txt", "robots-drip")]
|
||||
[InlineData("/SDK/webLanguage", "hikvision-drip")]
|
||||
[InlineData("/ISAPI/System/deviceInfo", "hikvision-drip")]
|
||||
[InlineData("/wp-login.php", "wordpress-drip")]
|
||||
@@ -42,7 +41,6 @@ public sealed class FileContentTests
|
||||
[InlineData("/docker-compose.yml", "version:")]
|
||||
[InlineData("/dump.sql", "-- MySQL dump")]
|
||||
[InlineData("/.git/config", "[core]")]
|
||||
[InlineData("/robots.txt", "User-agent:")]
|
||||
[InlineData("/SDK/webLanguage", "<?xml")]
|
||||
[InlineData("/wp-login.php", "<!DOCTYPE html>")]
|
||||
public void Generates_an_endless_file_that_starts_like_the_real_thing(string path, string start)
|
||||
@@ -62,8 +60,24 @@ public sealed class FileContentTests
|
||||
var context = new TrapContext(session, "GET /.env", Path: "/.env");
|
||||
|
||||
Selector(matchPath: true).Select(context).ShouldNotBeNull().Name.ShouldBe("env-drip");
|
||||
Selector(matchPath: true).Select(context with { Path = "/" }).ShouldNotBeNull().Name.ShouldBe("html-drip");
|
||||
Selector(matchPath: false).Select(context).ShouldNotBeNull().Name.ShouldBe("html-drip");
|
||||
Selector(matchPath: true).Select(context with { Path = "/" }).ShouldNotBeNull().Name.ShouldBe("maze-drip");
|
||||
Selector(matchPath: false).Select(context).ShouldNotBeNull().Name.ShouldBe("maze-drip");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Robots_txt_is_served_completely_and_at_once_even_without_path_matching()
|
||||
{
|
||||
var session = new TrapSession(Guid.NewGuid(), TrapProtocol.Http, IPAddress.Parse("203.0.113.9"), DateTimeOffset.UtcNow);
|
||||
var context = new TrapContext(session, "GET /robots.txt", Path: "/Robots.txt");
|
||||
|
||||
var strategy = Selector(matchPath: false).Select(context).ShouldNotBeNull();
|
||||
var channel = new FakeTrapChannel();
|
||||
await strategy.RunAsync(channel, CancellationToken.None);
|
||||
|
||||
strategy.Name.ShouldBe("robots-static");
|
||||
channel.Writes.Count.ShouldBe(1);
|
||||
Encoding.UTF8.GetString(channel.Writes.Single())
|
||||
.ShouldBe("User-agent: *\nDisallow: /\nDisallow: /backup-2024/\nDisallow: /admin-old/\nDisallow: /internal/db-export/\nDisallow: /old-site/\n");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -89,7 +103,11 @@ public sealed class FileContentTests
|
||||
return new ConfiguredStrategySelector(
|
||||
[
|
||||
new HtmlDripStrategy(options, random, TimeProvider.System),
|
||||
new MazeDripStrategy(MazeKind.Page, options, random, TimeProvider.System),
|
||||
new MazeDripStrategy(MazeKind.Listing, options, random, TimeProvider.System),
|
||||
new TextDripStrategy(options, random, TimeProvider.System),
|
||||
new RobotsStaticStrategy(options),
|
||||
new MazeDripStrategy(MazeKind.Bait, options, random, TimeProvider.System),
|
||||
.. FileContent.Profiles.Select(profile => new FileDripStrategy(profile, options, random, TimeProvider.System))
|
||||
],
|
||||
options,
|
||||
|
||||
Reference in new issue
Block a user