Add Hikvision and WordPress login decoy profiles
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
13468bbdf9
commit
aeafaa71a8
5 files changed
+67
-3
No files matched your search
+2
-1
@@ -9,7 +9,8 @@ All notable changes to Flypaper are documented in this file. The format follows
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Content matches the requested path: `.env`, `*.json`, `*.xml` (sitemaps), `*.yml`, `*.sql`,
|
- Content matches the requested path: `.env`, `*.json`, `*.xml` (sitemaps), `*.yml`, `*.sql`,
|
||||||
`/.git/…` and `robots.txt` get an endless, matching file with the right `Content-Type`
|
`/.git/…`, `robots.txt`, Hikvision `/SDK/…` and `/ISAPI/…` (XML) and `wp-login.php`
|
||||||
|
(WordPress login page) get an endless, matching file with the right `Content-Type`
|
||||||
instead of an HTML page (strategy names `env-drip`, `json-drip`, …). Switchable on the
|
instead of an HTML page (strategy names `env-drip`, `json-drip`, …). Switchable on the
|
||||||
settings page (`Flypaper__Drip__MatchPath`).
|
settings page (`Flypaper__Drip__MatchPath`).
|
||||||
- Head start: the first bytes of the page (at least `HeadStartSize`, default 1024) are sent
|
- Head start: the first bytes of the page (at least `HeadStartSize`, default 1024) are sent
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ All optional. Read at startup; list entries need an index (`__0`, `__1`, ...).
|
|||||||
| `Flypaper__Drip__MinDelay` / `MaxDelay` | Pause between chunks | `00:00:00.05` / `00:00:01` |
|
| `Flypaper__Drip__MinDelay` / `MaxDelay` | Pause between chunks | `00:00:00.05` / `00:00:01` |
|
||||||
| `Flypaper__Drip__MinChunkSize` / `MaxChunkSize` | Bytes per chunk | `1` / `64` |
|
| `Flypaper__Drip__MinChunkSize` / `MaxChunkSize` | Bytes per chunk | `1` / `64` |
|
||||||
| `Flypaper__Drip__HeadStartSize` | Bytes sent immediately before dripping starts (`0` = off) | `1024` |
|
| `Flypaper__Drip__HeadStartSize` | Bytes sent immediately before dripping starts (`0` = off) | `1024` |
|
||||||
| `Flypaper__Drip__MatchPath` | Pick content by request path (`/.env`, `*.json`, `*.xml`, `*.yml`, `*.sql`, `/.git/…`, `robots.txt`) | `true` |
|
| `Flypaper__Drip__MatchPath` | Pick content by request path (`/.env`, `*.json`, `*.xml`, `*.yml`, `*.sql`, `/.git/…`, `robots.txt`, `/SDK/…`, `/ISAPI/…`, `wp-login.php`) | `true` |
|
||||||
| `TZ` | Time zone for the dashboard | UTC |
|
| `TZ` | Time zone for the dashboard | UTC |
|
||||||
|
|
||||||
The defaults of the runtime settings below can also be set this way, e.g.
|
The defaults of the runtime settings below can also be set this way, e.g.
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public static class FileContent
|
|||||||
[
|
[
|
||||||
new("git-drip", "text/plain; charset=utf-8", path => path.Contains("/.git/", StringComparison.Ordinal), GitConfig),
|
new("git-drip", "text/plain; charset=utf-8", path => path.Contains("/.git/", StringComparison.Ordinal), GitConfig),
|
||||||
new("robots-drip", "text/plain; charset=utf-8", path => LastSegment(path) == "robots.txt", Robots),
|
new("robots-drip", "text/plain; charset=utf-8", path => LastSegment(path) == "robots.txt", Robots),
|
||||||
|
new("wordpress-drip", "text/html; charset=UTF-8", path => LastSegment(path) == "wp-login.php", WordPressLogin),
|
||||||
|
new("hikvision-drip", "application/xml", path => path.StartsWith("/sdk/", StringComparison.Ordinal) || path.StartsWith("/isapi/", StringComparison.Ordinal), Hikvision),
|
||||||
new("env-drip", "text/plain; charset=utf-8", path => IsEnv(LastSegment(path)), Env),
|
new("env-drip", "text/plain; charset=utf-8", path => IsEnv(LastSegment(path)), Env),
|
||||||
new("json-drip", "application/json", path => path.EndsWith(".json", StringComparison.Ordinal), Json),
|
new("json-drip", "application/json", path => path.EndsWith(".json", StringComparison.Ordinal), Json),
|
||||||
new("xml-drip", "application/xml", path => path.EndsWith(".xml", StringComparison.Ordinal), Xml),
|
new("xml-drip", "application/xml", path => path.EndsWith(".xml", StringComparison.Ordinal), Xml),
|
||||||
@@ -58,6 +60,59 @@ public static class FileContent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<string> WordPressLogin(IRandomSource random)
|
||||||
|
{
|
||||||
|
yield return """
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>Log In ‹ Portal — WordPress</title>
|
||||||
|
<meta name='robots' content='max-image-preview:large, noindex, noarchive' />
|
||||||
|
<link rel='stylesheet' id='login-css' href='/wp-admin/css/login.min.css?ver=6.4.3' media='all' />
|
||||||
|
<meta name='viewport' content='width=device-width' />
|
||||||
|
</head>
|
||||||
|
<body class="login no-js login-action-login wp-core-ui locale-en-us">
|
||||||
|
<div id="login">
|
||||||
|
<h1><a href="https://wordpress.org/">Powered by WordPress</a></h1>
|
||||||
|
<form name="loginform" id="loginform" action="/wp-login.php" method="post">
|
||||||
|
<p>
|
||||||
|
<label for="user_login">Username or Email Address</label>
|
||||||
|
<input type="text" name="log" id="user_login" class="input" value="" size="20" autocapitalize="off" autocomplete="username" required="required" />
|
||||||
|
</p>
|
||||||
|
<div class="user-pass-wrap">
|
||||||
|
<label for="user_pass">Password</label>
|
||||||
|
<input type="password" name="pwd" id="user_pass" class="input password-input" value="" size="20" autocomplete="current-password" required="required" />
|
||||||
|
</div>
|
||||||
|
<p class="submit">
|
||||||
|
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Log In" />
|
||||||
|
<input type="hidden" name="redirect_to" value="/wp-admin/" />
|
||||||
|
<input type="hidden" name="testcookie" value="1" />
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
<p id="nav"><a href="/wp-login.php?action=lostpassword">Lost your password?</a></p>
|
||||||
|
<p id="backtoblog"><a href="/">← Go to Portal</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
""";
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
yield return $"<!-- {Hex(random, 32)} -->\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<string> Hikvision(IRandomSource random)
|
||||||
|
{
|
||||||
|
yield return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LanguageList version=\"2.0\" xmlns=\"http://www.hikvision.com/ver20/XMLSchema\">\n";
|
||||||
|
|
||||||
|
var id = 1;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
yield return $" <Language>\n <id>{id++}</id>\n <name>{LoremText.Word(random)}</name>\n <enabled>{(random.Next(0, 2) == 0 ? "true" : "false")}</enabled>\n </Language>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static IEnumerable<string> Json(IRandomSource random)
|
private static IEnumerable<string> Json(IRandomSource random)
|
||||||
{
|
{
|
||||||
yield return "{\n \"name\": \"portal\",\n \"version\": \"1.4.2\",\n \"private\": true,\n \"entries\": [\n";
|
yield return "{\n \"name\": \"portal\",\n \"version\": \"1.4.2\",\n \"private\": true,\n \"entries\": [\n";
|
||||||
|
|||||||
@@ -19,13 +19,17 @@ public sealed class FileContentTests
|
|||||||
[InlineData("/backup/db.sql", "sql-drip")]
|
[InlineData("/backup/db.sql", "sql-drip")]
|
||||||
[InlineData("/.git/config", "git-drip")]
|
[InlineData("/.git/config", "git-drip")]
|
||||||
[InlineData("/robots.txt", "robots-drip")]
|
[InlineData("/robots.txt", "robots-drip")]
|
||||||
|
[InlineData("/SDK/webLanguage", "hikvision-drip")]
|
||||||
|
[InlineData("/ISAPI/System/deviceInfo", "hikvision-drip")]
|
||||||
|
[InlineData("/wp-login.php", "wordpress-drip")]
|
||||||
|
[InlineData("/blog/WP-Login.php", "wordpress-drip")]
|
||||||
public void Matches_known_paths(string path, string expected) =>
|
public void Matches_known_paths(string path, string expected) =>
|
||||||
FileContent.Match(path).ShouldNotBeNull().Name.ShouldBe(expected);
|
FileContent.Match(path).ShouldNotBeNull().Name.ShouldBe(expected);
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("/")]
|
[InlineData("/")]
|
||||||
[InlineData("/index.php")]
|
[InlineData("/index.php")]
|
||||||
[InlineData("/wp-login.php")]
|
[InlineData("/sdkfoo")]
|
||||||
[InlineData("/environment")]
|
[InlineData("/environment")]
|
||||||
[InlineData("")]
|
[InlineData("")]
|
||||||
[InlineData(null)]
|
[InlineData(null)]
|
||||||
@@ -39,6 +43,8 @@ public sealed class FileContentTests
|
|||||||
[InlineData("/dump.sql", "-- MySQL dump")]
|
[InlineData("/dump.sql", "-- MySQL dump")]
|
||||||
[InlineData("/.git/config", "[core]")]
|
[InlineData("/.git/config", "[core]")]
|
||||||
[InlineData("/robots.txt", "User-agent:")]
|
[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)
|
public void Generates_an_endless_file_that_starts_like_the_real_thing(string path, string start)
|
||||||
{
|
{
|
||||||
var profile = FileContent.Match(path).ShouldNotBeNull();
|
var profile = FileContent.Match(path).ShouldNotBeNull();
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public sealed class ContentTypeTests
|
|||||||
[InlineData("Html", "/config.json", "application/json")]
|
[InlineData("Html", "/config.json", "application/json")]
|
||||||
[InlineData("Html", "/.env", "text/plain; charset=utf-8")]
|
[InlineData("Html", "/.env", "text/plain; charset=utf-8")]
|
||||||
[InlineData("Html", "/sitemap.xml", "application/xml")]
|
[InlineData("Html", "/sitemap.xml", "application/xml")]
|
||||||
|
[InlineData("Html", "/SDK/webLanguage", "application/xml")]
|
||||||
|
[InlineData("Html", "/wp-login.php", "text/html; charset=UTF-8")]
|
||||||
public async Task Trap_answers_with_the_media_type_of_the_selected_strategy(string content, string path, string expected)
|
public async Task Trap_answers_with_the_media_type_of_the_selected_strategy(string content, string path, string expected)
|
||||||
{
|
{
|
||||||
var configuration = new ConfigurationBuilder()
|
var configuration = new ConfigurationBuilder()
|
||||||
|
|||||||
Reference in new issue
Block a user