{"id":22206791,"url":"https://github.com/usercode/aspnetcore.honeypot","last_synced_at":"2025-07-27T07:32:35.691Z","repository":{"id":109494201,"uuid":"142685237","full_name":"usercode/AspNetCore.Honeypot","owner":"usercode","description":"Simple honeypot implementation for ASP.NET Core to detect bot posts","archived":false,"fork":false,"pushed_at":"2024-04-03T18:50:45.000Z","size":36,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-13T02:42:02.310Z","etag":null,"topics":["aspnet","honeypot"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usercode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-07-28T14:47:22.000Z","updated_at":"2024-05-31T14:04:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f1edca4-1207-437b-82ae-fe7c2196f673","html_url":"https://github.com/usercode/AspNetCore.Honeypot","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usercode%2FAspNetCore.Honeypot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usercode%2FAspNetCore.Honeypot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usercode%2FAspNetCore.Honeypot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usercode%2FAspNetCore.Honeypot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usercode","download_url":"https://codeload.github.com/usercode/AspNetCore.Honeypot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227777711,"owners_count":17818455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnet","honeypot"],"created_at":"2024-12-02T18:18:21.230Z","updated_at":"2025-07-27T07:32:35.685Z","avatar_url":"https://github.com/usercode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AspNetCore.Honeypot\n\nIt's a simple honeypot implementation for ASP.NET Core to detect bot posts.\n  \n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n[![nuget](https://img.shields.io/nuget/v/AspNetCore.Honeypot.svg)](https://www.nuget.org/packages/AspNetCore.Honeypot)\n  \n## How to use it ##\n\n1. Register honeypot service.\n\n```cs\n public void ConfigureServices(IServiceCollection services)\n {\n      services.AddHoneypot();\n }\n```\n\n2. Add tag helper to _ViewImports.cshtml\n\n```cs\n@addTagHelper *, AspNetCore.Honeypot\n```\n\n3. Place any honeypot tag to a form with a custom name (e.g. \"name\", \"email\" or \"city\") and use *your* css class to hide it.\n\n```html\n\u003choneypot-field name=\"email\" class=\"hide\" /\u003e\n\u003choneypot-field name=\"name\" class=\"hide\" /\u003e\n\u003choneypot-field name=\"city\" class=\"hide\" /\u003e\n```\n\n4. Place one time-based honeypot tag. \n```html\n\u003choneypot-time /\u003e\n```\n\n6. Bot detection handling\n\n4.1 Place the honeypot attribute to your action method for automatic bot detection handling.\n\n```cs\n  [Honeypot]\n  [HttpPost]\n  public async Task\u003cIActionResult\u003e PostRegister(RegisterViewModel registerData)\n  {\n      //..\n  }\n```\n\n4.2 Use the extension method to handle bot detection by yourself.\n```cs\n  [HttpPost]\n  public async Task\u003cIActionResult\u003e PostRegister(RegisterViewModel registerData)\n  {\n      if (await HttpContext.IsHoneypotTriggeredAsync())\n      {\n          ModelState.Clear();\n          ModelState.AddModelError(\"\", \"bot detection\");\n\n          //log\n\n          return View(\"Register\", new RegisterViewModel());\n      }\n  }\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusercode%2Faspnetcore.honeypot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusercode%2Faspnetcore.honeypot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusercode%2Faspnetcore.honeypot/lists"}