{"id":46244457,"url":"https://github.com/arvid-berndtsson/redstr-server","last_synced_at":"2026-03-03T21:02:55.226Z","repository":{"id":325785093,"uuid":"1102368257","full_name":"arvid-berndtsson/redstr-server","owner":"arvid-berndtsson","description":"HTTP API server for redstr string transformations","archived":false,"fork":false,"pushed_at":"2026-02-08T18:26:33.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-09T00:16:17.084Z","etag":null,"topics":["api","http-server","red-team","redstr","security"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/redstr-server","language":"Rust","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/arvid-berndtsson.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-23T10:35:34.000Z","updated_at":"2026-02-08T18:26:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/arvid-berndtsson/redstr-server","commit_stats":null,"previous_names":["arvid-berndtsson/redstr-server"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/arvid-berndtsson/redstr-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvid-berndtsson%2Fredstr-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvid-berndtsson%2Fredstr-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvid-berndtsson%2Fredstr-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvid-berndtsson%2Fredstr-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arvid-berndtsson","download_url":"https://codeload.github.com/arvid-berndtsson/redstr-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvid-berndtsson%2Fredstr-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30060680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","http-server","red-team","redstr","security"],"created_at":"2026-03-03T21:02:54.527Z","updated_at":"2026-03-03T21:02:55.219Z","avatar_url":"https://github.com/arvid-berndtsson.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redstr-server\n\nA high-performance HTTP API server for [redstr](https://github.com/arvid-berndtsson/redstr) string transformations. Built with Axum, this server provides a modern, async REST API that allows external tools to use redstr's transformation functions over HTTP.\n\n## Features\n\n- ⚡ **High Performance** - Built on Axum and Tokio for async I/O\n- 🚀 **Serverless Ready** - Compatible with Railway and other serverless platforms\n- 📝 **Structured Logging** - Professional logging with tracing and request tracking\n- 🔄 **Type-Safe** - Leverages Rust's type system with Serde for JSON handling\n- 🌐 **CORS Enabled** - Full CORS support for browser access\n- 📊 **Request Tracing** - Automatic request/response logging with latency tracking\n- 🛡️ **Modern Stack** - Axum, Tower, Tokio, and Serde\n\n## Prerequisites\n\n- Rust 1.70+ installed\n- Access to the [redstr](https://github.com/arvid-berndtsson/redstr) core library (as a dependency)\n\n## Installation\n\n```bash\ngit clone https://github.com/arvid-berndtsson/redstr-server.git\ncd redstr-server\ncargo build --release\n```\n\nThe binary will be available at `target/release/redstr-server`.\n\n## Usage\n\nStart the server:\n\n```bash\ncargo run --release\n```\n\nOr run the compiled binary:\n\n```bash\n./target/release/redstr-server\n```\n\nThe server will listen on `http://127.0.0.1:8080` by default.\n\n## API Endpoints\n\n### GET /\n\nReturns server information and available endpoints.\n\n**Response:**\n```json\n{\n  \"service\": \"redstr\",\n  \"version\": \"\u003credstr-version\u003e\",\n  \"endpoints\": [\"/transform\", \"/batch\", \"/functions\", \"/health\", \"/version\"]\n}\n```\n\n### GET /health\n\nHealth check endpoint.\n\n**Response:**\n```json\n{\n  \"status\": \"healthy\"\n}\n```\n\n### GET /version\n\nGet detailed version information.\n\n**Response:**\n```json\n{\n  \"service\": \"redstr-server\",\n  \"version\": \"\u003cserver-version\u003e\",\n  \"redstr_version\": \"\u003credstr-version\u003e\"\n}\n```\n\n### GET /functions\n\nList all available transformation functions.\n\n**Response:**\n```json\n{\n  \"functions\": [\"leetspeak\", \"base64_encode\", \"url_encode\", ...],\n  \"count\": \"\u003cfunction-count\u003e\"\n}\n```\n\n### POST /transform\n\nTransform a string using a redstr function.\n\n**Request:**\n```json\n{\n  \"function\": \"leetspeak\",\n  \"input\": \"Hello World\"\n}\n```\n\n**Response:**\n```json\n{\n  \"output\": \"H3ll0 W0rld\"\n}\n```\n\n**Error Response:**\n```json\n{\n  \"error\": \"Unknown function: invalid_function\"\n}\n```\n\n### POST /batch\n\nTransform multiple strings in a single request.\n\n**Request:**\n```json\n{\n  \"transforms\": [\n    {\"function\": \"leetspeak\", \"input\": \"Hello\"},\n    {\"function\": \"base64_encode\", \"input\": \"World\"}\n  ]\n}\n```\n\n**Response:**\n```json\n{\n  \"results\": [\n    {\"output\": \"H3ll0\"},\n    {\"output\": \"V29ybGQ=\"}\n  ]\n}\n```\n\n## Available Functions\n\nSee the [redstr documentation](https://github.com/arvid-berndtsson/redstr) for a complete list of available transformation functions. All redstr functions are available via the API.\n\n## Example Usage\n\n### Using curl\n\n```bash\n# List all available functions\ncurl http://localhost:8080/functions\n\n# Check server health\ncurl http://localhost:8080/health\n\n# Get version information\ncurl http://localhost:8080/version\n\n# Basic transformation\ncurl -X POST http://localhost:8080/transform \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"function\":\"leetspeak\",\"input\":\"password\"}'\n\n# Batch transformations\ncurl -X POST http://localhost:8080/batch \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"transforms\":[{\"function\":\"leetspeak\",\"input\":\"hello\"},{\"function\":\"base64_encode\",\"input\":\"world\"}]}'\n\n# SQL injection pattern\ncurl -X POST http://localhost:8080/transform \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"function\":\"sql_comment_injection\",\"input\":\"SELECT * FROM users\"}'\n\n# Domain typosquatting\ncurl -X POST http://localhost:8080/transform \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"function\":\"domain_typosquat\",\"input\":\"example.com\"}'\n```\n\n### Using Python\n\n```python\nimport requests\n\nurl = \"http://localhost:8080/transform\"\npayload = {\n    \"function\": \"xss_tag_variations\",\n    \"input\": \"\u003cscript\u003ealert('XSS')\u003c/script\u003e\"\n}\n\nresponse = requests.post(url, json=payload)\nprint(response.json()[\"output\"])\n```\n\n### Using JavaScript\n\n```javascript\nfetch('http://localhost:8080/transform', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({\n    function: 'base64_encode',\n    input: 'Hello World'\n  })\n})\n.then(res =\u003e res.json())\n.then(data =\u003e console.log(data.output));\n```\n\n## Integration with External Tools\n\nThis HTTP server is designed to be used as a bridge between redstr and external security testing tools:\n\n- **EvilJinx**: Use for domain generation and email obfuscation\n- **Caido**: Create plugins that call this API for transformations\n- **Burp Suite**: Build extensions that interface with this server\n- **OWASP ZAP**: Create add-ons that use this API\n- **Custom Tools**: Any tool that can make HTTP requests\n\n## Security Considerations\n\n- The server binds to localhost (127.0.0.1) by default for security\n- No authentication is implemented - add your own if exposing to network\n- Designed for local use and authorized security testing only\n- Log all transformation requests for audit purposes\n\n## Performance\n\n- **Async I/O** - Built on Tokio for high concurrency\n- **Low Latency** - Sub-millisecond response times\n- **Scalable** - Handles thousands of concurrent connections\n- **Memory Efficient** - Minimal memory footprint per request\n- **Production Ready** - Battle-tested Axum framework\n\n## Troubleshooting\n\n**Port already in use:**\n```\nError: Address already in use (os error 98)\n```\nSolution: Change the port in `main.rs` or kill the process using port 8080.\n\n**Connection refused:**\nEnsure the server is running and accessible at the configured address.\n\n## Testing\n\nThe project includes comprehensive unit and integration tests.\n\n### Run Unit Tests\n\n```bash\ncargo test --bin redstr-server\n```\n\n### Run Integration Tests\n\nIntegration tests require the server to be running. Start the server in one terminal:\n\n```bash\ncargo run --release\n```\n\nThen in another terminal, run the integration tests:\n\n```bash\ncargo test --test integration_tests -- --ignored\n```\n\n## Logging\n\nThe server provides comprehensive structured logging in **JSON format** using Rust's `tracing` framework, fully compatible with [Railway's log filtering](https://docs.railway.com/guides/logs#filtering-logs).\n\n### Log Format\n\nAll logs are output as JSON objects with structured fields for easy filtering and analysis:\n\n```json\n{\n  \"timestamp\": \"2025-11-25T16:10:22.262009Z\",\n  \"level\": \"ERROR\",\n  \"fields\": {\n    \"message\": \"Transformation failed\",\n    \"function\": \"invalid\",\n    \"error\": \"Unknown function: invalid\"\n  },\n  \"target\": \"redstr_server\",\n  \"span\": {\n    \"method\": \"POST\",\n    \"uri\": \"/transform\",\n    \"version\": \"HTTP/1.1\",\n    \"name\": \"request\"\n  }\n}\n```\n\n### Log Levels\n\nControl logging verbosity with the `RUST_LOG` environment variable:\n\n```bash\n# Show all logs (default)\nRUST_LOG=info cargo run\n\n# Show only warnings and errors\nRUST_LOG=warn cargo run\n\n# Show only errors\nRUST_LOG=error cargo run\n\n# Show debug logs (verbose)\nRUST_LOG=debug cargo run\n```\n\n### Railway Log Filtering\n\nUse Railway's powerful filtering syntax with the JSON log attributes:\n\n**Filter by log level:**\n- `@level:ERROR` - Show only errors\n- `@level:INFO` - Show info logs\n- `@level:DEBUG` - Show debug logs\n\n**Filter by custom fields:**\n- `@fields.function:leetspeak` - Show logs for specific transformation\n- `@fields.status:400` - Show specific status codes\n- `@fields.error:*` - Show all logs with error field\n- `@span.uri:/transform` - Show logs for specific endpoint\n- `@span.method:POST` - Show POST requests only\n\n**Combine filters:**\n- `@level:ERROR AND @span.uri:/transform` - Show errors on /transform endpoint\n- `@level:INFO AND @fields.function:*` - Show info logs with function field\n- `\"Unknown function\"` - Text search within log messages\n\n**Examples:**\n```\n@level:ERROR                           # All errors\n@fields.function:reverse_string        # Specific function\n@span.uri:/batch                       # Batch endpoint logs\n@level:ERROR AND @span.uri:/transform  # Transform errors only\n```\n\n### What Gets Logged\n\n✅ **Request Start** - Method, URI, HTTP version  \n✅ **Request Processing** - Function name, operation details  \n✅ **Request Completion** - Latency, status code  \n✅ **Transformation Success** - Function name and confirmation  \n✅ **All Errors** - Detailed error messages with context  \n✅ **Batch Operations** - Count of operations processed\n\n## Technology Stack\n\n- **[Axum](https://github.com/tokio-rs/axum)** - Web framework\n- **[Tokio](https://tokio.rs/)** - Async runtime\n- **[Tower](https://github.com/tower-rs/tower)** - Middleware and service abstractions\n- **[Serde](https://serde.rs/)** - JSON serialization/deserialization\n- **[Tracing](https://tracing.rs/)** - Structured logging and diagnostics\n\n## Future Enhancements\n\n- [ ] Configuration file support\n- [x] Environment-based port binding (✅ Supports PORT env var)\n- [ ] Authentication/authorization with JWT\n- [ ] Rate limiting middleware\n- [x] Request logging (✅ Completed with tracing)\n- [ ] Metrics endpoint (Prometheus format)\n- [x] Async I/O (✅ Completed with Tokio)\n- [ ] TLS support\n- [ ] OpenAPI/Swagger documentation\n\n## License\n\nMIT License - See LICENSE file in the repository root.\n\n---\n\n**Important:** This server is designed for authorized security testing only. Users must obtain proper authorization before conducting any security assessments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvid-berndtsson%2Fredstr-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farvid-berndtsson%2Fredstr-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvid-berndtsson%2Fredstr-server/lists"}