{"id":18165618,"url":"https://github.com/thealpha16/c2server","last_synced_at":"2025-07-27T12:33:51.286Z","repository":{"id":260660294,"uuid":"881944723","full_name":"TheAlpha16/C2Server","owner":"TheAlpha16","description":"A multi-threaded http server written in C# ","archived":false,"fork":false,"pushed_at":"2024-11-01T16:31:50.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T04:05:20.736Z","etag":null,"topics":["c-sharp","dotnet-console","http-server","socket-programming"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheAlpha16.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,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T14:48:03.000Z","updated_at":"2024-11-01T16:31:53.000Z","dependencies_parsed_at":"2024-11-01T17:26:59.400Z","dependency_job_id":"521ddb56-4de4-42a7-a7e1-84d209f55364","html_url":"https://github.com/TheAlpha16/C2Server","commit_stats":null,"previous_names":["thealpha16/c2server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheAlpha16/C2Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlpha16%2FC2Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlpha16%2FC2Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlpha16%2FC2Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlpha16%2FC2Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheAlpha16","download_url":"https://codeload.github.com/TheAlpha16/C2Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlpha16%2FC2Server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260288461,"owners_count":22986665,"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":["c-sharp","dotnet-console","http-server","socket-programming"],"created_at":"2024-11-02T12:08:07.996Z","updated_at":"2025-06-17T04:05:24.943Z","avatar_url":"https://github.com/TheAlpha16.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C2 Server\n\nAn efficient and lightweight C2 (Command and Control) server built for secure communication and control over remote devices or clients in real-time. This server offers flexible routing, request handling, and built-in cookie management, designed for custom integration with tools and security projects.\n\n## Features\n\n- **Flexible Request Handling**: Supports custom HTTP methods, query parameters, and request parsing.\n- **Cookie Management**: Efficient cookie parsing and support for managing session data.\n- **Error Handling**: Defined HTTP error classes for custom exception handling.\n- **Routing**: Custom routing for handling requests and responses.\n- **Custom Protocol**: Built-in support for custom protocols and data serialization.\n\n## Contents\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [API Reference](#api-reference)\n- [License](#license)\n\n## Usage\n\n1. Clone the repsitory and navigate to the project directory.\n\n```bash\ngit clone\ncd C2Server\n```\n\n2. Use .NET SDK to build the project.\n\n```bash\ndotnet build\n```\n\n3. Run the server using the .NET CLI.\n\n```bash\ndotnet run\n```\n\n4. Server can be accessed at `8989` port.\n\n```bash\ncurl -X GET http://localhost:8989/ping\n```\n\n\n## Configuration\n- You can change the default port it binds to in the `.env` file.\n\n- Define your routes as an async function in the `Routes.cs` file. \n\n```csharp\npublic async static Task\u003cHTTPResponse\u003e Ping(HTTPRequest request)\n{\n    return new HTTPResponse().Text(\"Pong!\");\n}\n```\n\n## API Reference\n\n- Access request data using the `HTTPRequest` object.\n\n```csharp\nCookie token = request.Cookies[\"token\"];\nstring someParameter = request.Queries[\"someKey\"];\nstring body = request.Body;\nstring Referer = request.Headers[\"Referer\"];\n```\n\n- Return response using `HTTPResponse` object from the handlers.\n\n```csharp\nHTTPResponse response = new HTTPResponse();\n\n// Set cookie\nvar cookie = new Cookie(\"SessionID\", \"abc123\")\n{\n    Expiration = DateTime.UtcNow.AddHours(1),\n    Secure = true,\n    HttpOnly = true\n};\nresponse.AddCookie(cookie);\n\n// Send text data in response\nreturn response.Text(\"Welcome to C2Server!\");\n\n// Send JSON data\nreturn response.JSON(new {\n    \"status\": \"success\",\n    \"message\": \"ready to fire\"\n});\n\n// Set a different HTTP status\nreturn response.SetStatus(HTTPStatus.Accepted).JSON(new {\n    \"status\": \"success\",\n    \"message\": \"ready to fire\"\n});\n```\n\n## License\nThis project is licensed under the GNU General Public License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealpha16%2Fc2server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthealpha16%2Fc2server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealpha16%2Fc2server/lists"}