| Crates.io | redstr-server |
| lib.rs | redstr-server |
| version | 0.2.0 |
| created_at | 2025-11-23 11:30:45.216302+00 |
| updated_at | 2025-11-26 07:41:46.434263+00 |
| description | HTTP API server for redstr string transformations |
| homepage | https://github.com/arvid-berndtsson/redstr-server |
| repository | https://github.com/arvid-berndtsson/redstr-server |
| max_upload_size | |
| id | 1946409 |
| size | 61,919 |
A high-performance HTTP API server for 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.
git clone https://github.com/arvid-berndtsson/redstr-server.git
cd redstr-server
cargo build --release
The binary will be available at target/release/redstr-server.
Start the server:
cargo run --release
Or run the compiled binary:
./target/release/redstr-server
The server will listen on http://127.0.0.1:8080 by default.
Returns server information and available endpoints.
Response:
{
"service": "redstr",
"version": "0.2.0",
"endpoints": ["/transform", "/batch", "/functions", "/health", "/version"]
}
Health check endpoint.
Response:
{
"status": "healthy"
}
Get detailed version information.
Response:
{
"service": "redstr-server",
"version": "0.1.0",
"redstr_version": "0.2.0"
}
List all available transformation functions.
Response:
{
"functions": ["leetspeak", "base64_encode", "url_encode", ...],
"count": 62
}
Transform a string using a redstr function.
Request:
{
"function": "leetspeak",
"input": "Hello World"
}
Response:
{
"output": "H3ll0 W0rld"
}
Error Response:
{
"error": "Unknown function: invalid_function"
}
Transform multiple strings in a single request.
Request:
{
"transforms": [
{"function": "leetspeak", "input": "Hello"},
{"function": "base64_encode", "input": "World"}
]
}
Response:
{
"results": [
{"output": "H3ll0"},
{"output": "V29ybGQ="}
]
}
See the redstr documentation for a complete list of available transformation functions. All redstr functions are available via the API.
# List all available functions
curl http://localhost:8080/functions
# Check server health
curl http://localhost:8080/health
# Get version information
curl http://localhost:8080/version
# Basic transformation
curl -X POST http://localhost:8080/transform \
-H "Content-Type: application/json" \
-d '{"function":"leetspeak","input":"password"}'
# Batch transformations
curl -X POST http://localhost:8080/batch \
-H "Content-Type: application/json" \
-d '{"transforms":[{"function":"leetspeak","input":"hello"},{"function":"base64_encode","input":"world"}]}'
# SQL injection pattern
curl -X POST http://localhost:8080/transform \
-H "Content-Type: application/json" \
-d '{"function":"sql_comment_injection","input":"SELECT * FROM users"}'
# Domain typosquatting
curl -X POST http://localhost:8080/transform \
-H "Content-Type: application/json" \
-d '{"function":"domain_typosquat","input":"example.com"}'
import requests
url = "http://localhost:8080/transform"
payload = {
"function": "xss_tag_variations",
"input": "<script>alert('XSS')</script>"
}
response = requests.post(url, json=payload)
print(response.json()["output"])
fetch('http://localhost:8080/transform', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
function: 'base64_encode',
input: 'Hello World'
})
})
.then(res => res.json())
.then(data => console.log(data.output));
This HTTP server is designed to be used as a bridge between redstr and external security testing tools:
Port already in use:
Error: Address already in use (os error 98)
Solution: Change the port in main.rs or kill the process using port 8080.
Connection refused: Ensure the server is running and accessible at the configured address.
The project includes comprehensive unit and integration tests.
cargo test --bin redstr-server
Integration tests require the server to be running. Start the server in one terminal:
cargo run --release
Then in another terminal, run the integration tests:
cargo test --test integration_tests -- --ignored
The server provides comprehensive structured logging in JSON format using Rust's tracing framework, fully compatible with Railway's log filtering.
All logs are output as JSON objects with structured fields for easy filtering and analysis:
{
"timestamp": "2025-11-25T16:10:22.262009Z",
"level": "ERROR",
"fields": {
"message": "Transformation failed",
"function": "invalid",
"error": "Unknown function: invalid"
},
"target": "redstr_server",
"span": {
"method": "POST",
"uri": "/transform",
"version": "HTTP/1.1",
"name": "request"
}
}
Control logging verbosity with the RUST_LOG environment variable:
# Show all logs (default)
RUST_LOG=info cargo run
# Show only warnings and errors
RUST_LOG=warn cargo run
# Show only errors
RUST_LOG=error cargo run
# Show debug logs (verbose)
RUST_LOG=debug cargo run
Use Railway's powerful filtering syntax with the JSON log attributes:
Filter by log level:
@level:ERROR - Show only errors@level:INFO - Show info logs@level:DEBUG - Show debug logsFilter by custom fields:
@fields.function:leetspeak - Show logs for specific transformation@fields.status:400 - Show specific status codes@fields.error:* - Show all logs with error field@span.uri:/transform - Show logs for specific endpoint@span.method:POST - Show POST requests onlyCombine filters:
@level:ERROR AND @span.uri:/transform - Show errors on /transform endpoint@level:INFO AND @fields.function:* - Show info logs with function field"Unknown function" - Text search within log messagesExamples:
@level:ERROR # All errors
@fields.function:reverse_string # Specific function
@span.uri:/batch # Batch endpoint logs
@level:ERROR AND @span.uri:/transform # Transform errors only
✅ Request Start - Method, URI, HTTP version
✅ Request Processing - Function name, operation details
✅ Request Completion - Latency, status code
✅ Transformation Success - Function name and confirmation
✅ All Errors - Detailed error messages with context
✅ Batch Operations - Count of operations processed
MIT License - See LICENSE file in the repository root.
Important: This server is designed for authorized security testing only. Users must obtain proper authorization before conducting any security assessments.