redstr
Red team string transformation library for offensive security operations, penetration testing, and evasion techniques.
A comprehensive Rust library providing 30+ string obfuscation and transformation functions for red team operations, blue team defense testing, and purple team collaboration. Perfect for security professionals building tools like Caido, Burp Suite extensions, phishing frameworks (EvilJinx), WAF bypass testing, XSS detection, SQL injection testing, and bot detection evasion.
π― Use Cases
Red Team / Offensive Security:
- WAF (Web Application Firewall) bypass techniques
- XSS (Cross-Site Scripting) payload obfuscation
- SQL injection evasion patterns
- Phishing domain generation (typosquatting, homoglyphs)
- Command injection testing
- Path traversal attacks
- Bot detection evasion
- Payload encoding and obfuscation
Blue Team / Defensive Security:
- Security control testing
- Filter and detection validation
- Input sanitization testing
- Threat intelligence enrichment
- Malicious content detection
- Log analysis and normalization
Purple Team / Security Testing:
- Collaborative red/blue exercises
- Baseline security testing
- Security awareness training
- Vulnerability assessment
- Penetration testing automation
π Features
Production-ready library for security professionals and tool developers:
- Minimal dependencies - Core library uses only Rust's standard library (optional serde for serialization)
- 30+ transformation functions - Encoding, obfuscation, injection testing, and web-focused transformations
- Builder pattern API - Chain multiple transformations fluently with
TransformBuilder - Serialization support - Optional serde integration for web APIs and tool integration
- Performance optimized - Efficient string operations for high-throughput scenarios
- Security-focused - Designed for red/blue/purple team workflows and bot detection testing
- Well-documented - Complete API documentation with real-world integration examples
- CLI tool included - Optional command-line interface for quick testing
See Performance Documentation for detailed benchmarks and methodology.
π€ Why redstr?
For Security Tool Developers:
- Integrate into Caido, Burp Suite, or custom security proxies
- Build phishing frameworks and social engineering tools
- Create WAF testing and bypass automation
- Develop bot detection evasion systems
- Build URL scanners and malware analysis tools
For Penetration Testers:
- Generate payload variations for manual testing
- Bypass security controls and filters
- Test input validation and encoding
- Create phishing campaigns with typosquatting
- Obfuscate attack payloads
For Security Researchers:
- Test detection engines and security controls
- Research evasion techniques
- Validate security implementations
- Create proof-of-concept exploits
- Analyze filter bypass methods
Compared to alternatives:
- Native Rust performance - No Python or JavaScript overhead
- Type-safe API - Compile-time guarantees
- Minimal dependencies - Core library has no required dependencies
- Comprehensive coverage - 30+ functions in one library
- Active development - Modern security techniques
π¦ Installation
Basic Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
With Serde Support (for web tools)
[]
= { = "0.1.0", = ["serde"] }
Quick Start
Basic Usage
use ;
Builder Pattern (New!)
Chain multiple transformations fluently:
use TransformBuilder;
Integration Examples
Caido / Web Security Testing Tools
use ;
// Randomize requests to avoid fingerprinting
let headers = vec!;
// Test XSS payloads with variations
let payload = "<script>alert(1)</script>";
let variations = vec!;
EvilJinx / Phishing Frameworks
use ;
// Generate phishing domains
let target = "paypal.com";
let typosquat = domain_typosquat;
let homoglyph = homoglyph_substitution;
// Obfuscate phishing page content
let link = "https://secure.paypal.com/login";
let obfuscated = html_entity_encode;
Bot Detection Testing
use ;
// Simulate various bot evasion techniques
let user_agent = random_user_agent;
let obfuscated_js = js_string_concat;
let normalized = unicode_normalize_variants;
URL Scanner / Web Crawler Integration
use ;
// Encode URLs for safe storage/transmission
let suspicious_url = "http://example.com/path?param=<script>";
let safe_url = url_encode;
// Create encoded payloads for analysis
let payload = new
.base64
.url_encode
.build;
See the examples directory for more detailed usage examples.
Optional Command-Line Tool
An optional CLI binary is available for quick testing and experimentation.
Installation
To install with the CLI tool:
Or build from source with the CLI feature:
The binary will be available at target/release/redstr.
CLI Usage
If no mode is specified, random capitalization is used by default.
Library API
All transformation functions accept a &str and return a String. Here are the available functions:
Basic Transformations
randomize_capitalization(input: &str) -> String- Random capitalizationalternate_case(input: &str) -> String- Alternate upper/lower caseinverse_case(input: &str) -> String- Invert case of each letterreverse_string(input: &str) -> String- Reverse the string
Case Conversion
to_camel_case(input: &str) -> String- Convert to camelCaseto_snake_case(input: &str) -> String- Convert to snake_caseto_kebab_case(input: &str) -> String- Convert to kebab-case
Security Testing Functions
leetspeak(input: &str) -> String- Convert to leetspeakhomoglyph_substitution(input: &str) -> String- Substitute with lookalike charactersunicode_variations(input: &str) -> String- Random unicode variationszalgo_text(input: &str) -> String- Add zalgo combining charactersrot13(input: &str) -> String- Apply ROT13 ciphervowel_swap(input: &str) -> String- Swap vowels randomlydouble_characters(input: &str) -> String- Double random charactersspace_variants(input: &str) -> String- Use various space charactersmixed_encoding(input: &str) -> String- Mix character encodings
Encoding and Obfuscation Functions
base64_encode(input: &str) -> String- Encode to Base64url_encode(input: &str) -> String- URL/percent encodinghex_encode(input: &str) -> String- Encode to hexadecimalhex_encode_mixed(input: &str) -> String- Mixed hex formats (\x, %, 0x, &#x)
Injection Testing Functions
sql_comment_injection(input: &str) -> String- Insert SQL comment patternsxss_tag_variations(input: &str) -> String- Generate XSS tag variationscase_swap(input: &str) -> String- Random case swapping for WAF bypassnull_byte_injection(input: &str) -> String- Insert null byte representationspath_traversal(input: &str) -> String- Generate path traversal patternscommand_injection(input: &str) -> String- Insert command injection separators
Web Security Functions (NEW!)
random_user_agent() -> String- Generate random browser user-agent stringsdomain_typosquat(domain: &str) -> String- Create typosquatting variations for phishinghtml_entity_encode(input: &str) -> String- Encode using HTML entitiesjs_string_concat(input: &str) -> String- JavaScript string concatenation obfuscationunicode_normalize_variants(input: &str) -> String- Unicode normalization variationswhitespace_padding(input: &str) -> String- Add random whitespace for filter bypass
Builder API (NEW!)
TransformBuilder::new(input: &str)- Create a transformation chain.leetspeak()- Apply leetspeak.base64()- Apply base64 encoding.url_encode()- Apply URL encoding.redstrs()- Apply random capitalization.homoglyphs()- Apply homoglyph substitution.case_swap()- Apply case swapping.hex_encode()- Apply hex encoding.rot13()- Apply ROT13.build()- Get the final result
See the library documentation for detailed API documentation.
CLI Transformation Modes
Basic Transformations
-
random, r - Random capitalization (default)
- Example:
redstr "Hello World"βHeLlO wOrLd
- Example:
-
alternate, a - Alternate upper/lower case
- Example:
redstr alternate "Hello World"βHeLlO wOrLd
- Example:
-
inverse, i - Invert the case of each letter
- Example:
redstr inverse "Hello World"βhELLO wORLD
- Example:
-
reverse, rv - Reverse the string
- Example:
redstr reverse "Hello World"βdlroW olleH
- Example:
Case Conversion
-
camel, c - Convert to camelCase
- Example:
redstr camel "hello world test"βhelloWorldTest
- Example:
-
snake, s - Convert to snake_case
- Example:
redstr snake "HelloWorldTest"βhello_world_test
- Example:
-
kebab, k - Convert to kebab-case
- Example:
redstr kebab "HelloWorldTest"βhello-world-test
- Example:
Security Testing Modes
-
leetspeak, l - Convert to leetspeak
- Useful for testing password filters and content detection
- Example:
redstr leetspeak "password123"βp@55w0rd123
-
homoglyph, h - Substitute with similar-looking characters
- Useful for testing homograph attacks and IDN spoofing
- Example:
redstr homoglyph "admin@example.com"βΠ°dmΡn@Π΅xΠ°mple.com
-
unicode, u - Random unicode variations
- Useful for testing Unicode handling and normalization
- Example:
redstr unicode "administrator"βΓ‘dmΓ―nΓ―Ε‘trΓ’tΓΆr
-
zalgo, z - Add zalgo combining characters
- Useful for testing display issues and Unicode handling
- Example:
redstr zalgo "test"βtΜΜeΜΜsΜΜtΜΜ
-
rot13 - Apply ROT13 cipher
- Classic cipher transformation
- Example:
redstr rot13 "Hello World"βUryyb Jbeyq
-
vowel-swap, vs - Swap vowels randomly
- Useful for testing pattern matching and filters
- Example:
redstr vowel-swap "testing"βtistong
-
double, d - Double random characters
- Useful for testing input validation
- Example:
redstr double "test"βtteesstt
-
space-variants, sv - Use various space characters
- Useful for testing whitespace handling (uses various Unicode spaces)
- Example:
redstr space-variants "hello world"
-
mixed-encoding, me - Mix character encodings
- Useful for testing encoding vulnerabilities and XSS
- Example:
redstr mixed-encoding "test"β Mix of HTML entities and Unicode escapes
Encoding and Obfuscation Modes
-
base64, b64 - Encode to Base64
- Useful for red team payload obfuscation
- Example:
redstr base64 "hello"βaGVsbG8=
-
url-encode, url - URL/percent encoding
- Useful for web security testing
- Example:
redstr url-encode "test @example.com"βtest%20%40example.com
-
hex-encode, hex - Encode to hexadecimal
- Useful for encoding obfuscation
- Example:
redstr hex-encode "test"β74657374
-
hex-mixed, hm - Mixed hex formats (\x, %, 0x, &#x)
- Useful for testing encoding detection
- Example:
redstr hex-mixed "ab"β\x61%62(varies)
Injection Testing Modes
-
sql-comment, sql - Insert SQL comment patterns
- Useful for red team SQL injection testing
- Example:
redstr sql-comment "SELECT * FROM users"βSELECT --* FROM users
-
xss-tags, xss - Generate XSS tag variations
- Useful for testing XSS filters
- Example:
redstr xss-tags "<script>alert(1)</script>"β Encoded variations
-
case-swap, cs - Random case swapping
- Useful for WAF/filter bypass testing
- Example:
redstr case-swap "SELECT"βSeLeCt
-
null-byte, nb - Insert null byte representations
- Useful for testing null byte vulnerabilities
- Example:
redstr null-byte "test.txt"βtest%00.txt(varies)
-
path-traversal, pt - Generate path traversal patterns
- Useful for directory traversal testing
- Example:
redstr path-traversal "/etc/passwd"β../etc/../passwd(varies)
-
command-injection, ci - Insert command injection separators
- Useful for OS command injection testing
- Example:
redstr command-injection "ping example.com"βping;example.com(varies)
Security Testing Use Cases
Red Team Activities
Phishing and Social Engineering
- Domain spoofing: Use
homoglyph_substitutionto create convincing lookalike domainspaypal.comβpΠ°ypΠ°l.com(using Cyrillic characters)
- Email obfuscation: Combine unicode variations with case swapping to evade email filters
Filter and WAF Evasion
- Content filter bypass: Use
leetspeak,unicode_variations, orcase_swapto bypass content filtersmalwareβm@1w@r3ormAlWaRe
- SQL injection: Use
sql_comment_injectionto insert SQL comments and evade WAF detectionSELECT * FROM usersβSELECT --* FROM /**/users
- XSS filter evasion: Use
xss_tag_variationsto bypass XSS filters<script>β<sCrIpT>
- Command injection: Use
command_injectionto test command separator filtering
Payload Obfuscation
- Encoding obfuscation: Use
base64_encode,url_encode,hex_encode, orhex_encode_mixed - Mixed encoding: Combine
mixed_encodingwith other transformations to evade detection systems - Path traversal: Use
path_traversalto test directory traversal vulnerabilities/etc/passwdβ../etc/../passwd
- Null byte injection: Use
null_byte_injectionto test null byte vulnerabilitiesfile.txtβfile%00.txt
Blue Team Activities
Detection and Validation Testing
- Filter testing: Test if your content filters catch variations like leetspeak or homoglyphs
- Generate test cases for blocked words using multiple transformations
- XSS detection: Verify your XSS filters catch obfuscated payloads
- SQL injection detection: Test if your WAF detects SQL injection patterns with comments
- Input validation: Verify systems handle Unicode properly and reject malformed input
- Encoding detection: Test if your systems properly detect and decode various encoding schemes
Security Control Testing
- URL encoding validation: Use
url_encodeto test URL parsers and validators - Path validation: Use
path_traversalto test path sanitization functions - Command validation: Use
command_injectionto test command sanitization - Null byte handling: Use
null_byte_injectionto verify proper null byte handling
Monitoring and Logging
- Log analysis: Test logging systems with various character encodings to ensure proper logging
- Alert generation: Verify security monitoring systems trigger on obfuscated attacks
- Normalization testing: Test if logs properly normalize Unicode and encoded strings
Purple Team Activities
Collaborative Testing
- Shared test cases: Use transformations to create consistent test payloads for both teams
- Baseline establishment: Generate standard test cases for security controls
- Detection validation: Red team uses transformations, blue team validates detection
Training and Documentation
- Security awareness: Generate examples for security training programs
- Show how phishing domains can be spoofed with homoglyphs
- Demonstrate filter evasion techniques
- Playbook development: Create standard attack patterns and detection rules
- Tool validation: Test security tools against various obfuscation techniques
Continuous Improvement
- Coverage testing: Ensure security controls cover all transformation variations
- Gap analysis: Identify missing detection rules using transformation permutations
- Effectiveness metrics: Measure detection rates across different obfuscation techniques
Dependencies
The core library has no required dependencies and uses only Rust's standard library, making it lightweight and easy to audit.
Optional dependencies:
serde- For serialization support when using theserdefeature flag
Development dependencies:
cc-check- For conventional commit checking in CI/CD
Building
To build the library:
To build with the optional CLI tool:
Running Tests
π Complete Function Reference
Encoding & Obfuscation
- base64_encode - Base64 encoding for payload obfuscation
- url_encode - RFC 3986 URL/percent encoding with UTF-8 support
- hex_encode - Hexadecimal encoding (lowercase)
- hex_encode_mixed - Mixed hex formats (
\x,%,0x,&#x) - html_entity_encode - HTML entity encoding for XSS testing
- mixed_encoding - Mixed character encodings (HTML entities + Unicode)
String Transformation
- randomize_capitalization - Random case for each character
- alternate_case - Alternating upper/lowercase
- inverse_case - Invert case of all characters
- case_swap - Random case mutation for WAF bypass
- leetspeak - Convert to 1337speak for filter evasion
- rot13 - ROT13 cipher transformation
- reverse_string - Reverse string order
Unicode & Homoglyphs
- homoglyph_substitution - Lookalike character substitution for phishing
- unicode_variations - Random Unicode character variations
- unicode_normalize_variants - Unicode normalization testing
- zalgo_text - Combining characters for display corruption
Case Conversion
- to_camel_case - Convert to camelCase
- to_snake_case - Convert to snake_case
- to_kebab_case - Convert to kebab-case
Injection Testing
- sql_comment_injection - SQL comment patterns (
--,/**/,#) - xss_tag_variations - XSS tag obfuscation and encoding
- command_injection - OS command separators (
;,|,&&) - path_traversal - Directory traversal patterns (
../,..\\) - null_byte_injection - Null byte representations (
%00,\0)
Web Security
- random_user_agent - Generate random browser user-agents
- domain_typosquat - Typosquatting variations for phishing
- js_string_concat - JavaScript string concatenation obfuscation
- whitespace_padding - Random whitespace for filter bypass
Utility Functions
- vowel_swap - Swap vowels for pattern matching tests
- double_characters - Random character doubling
- space_variants - Various Unicode space characters
Builder Pattern
- TransformBuilder - Fluent API for chaining transformations
π SEO Keywords
Security Testing: WAF bypass, XSS evasion, SQL injection, phishing detection, bot detection, security automation, penetration testing tools, red team tools, blue team defense, purple team testing
Techniques: String obfuscation, payload encoding, filter bypass, evasion techniques, homoglyph attacks, typosquatting, domain spoofing, Unicode normalization, character encoding
Tool Integration: Caido integration, Burp Suite, EvilJinx, urlscan.io, Cloudflare bypass, security proxies, phishing frameworks, malware analysis
Technologies: Rust security library, minimal-dependency Rust, type-safe security, polymorphic strings, transformation library
π Building Integrations
Official Integrations
redstr has several official integrations available as separate repositories:
- redstr-server - HTTP API server for redstr transformations
- redstr-burp - Burp Suite extension
- redstr-caido - Caido plugin
- redstr-eviljinx - EvilJinx integration scripts
- redstr-owasp-zap - OWASP ZAP add-on
Want to integrate redstr with your security tool?
For tool-specific add-ons/extensions (Burp Suite, OWASP ZAP, Caido, etc.):
- Create a separate repository for your integration
- See our Integration Guidelines for detailed guidance
- We'll help promote your integration!
For code examples and library enhancements:
- Contribute to this repository
- Add examples to
examples/directory - Submit documentation to
docs/
Common questions:
-
Q: Should I build an OWASP ZAP add-on in another repo?
A: Yes! ZAP add-ons should be separate repos. See why β -
Q: What about Burp Suite extensions?
A: Also separate repos. Learn more β
π Read the full Integration Guidelines for complete details.
π€ Contributing
Contributions are welcome! This library is designed for the security community. Whether you're adding new transformation functions, improving documentation, or reporting issues, your input helps make security testing more effective.
See CONTRIBUTING.md for development guidelines and docs/INTEGRATION_GUIDELINES.md for integration guidance.
π Learn More
- Documentation: docs.rs/redstr
- Repository: GitHub
- Examples: See the
examples/directory for comprehensive integration patterns - Integration Guidelines: docs/INTEGRATION_GUIDELINES.md
- Blog Posts: Check for community blog posts and integration guides (coming soon)
β οΈ Responsible Use
This library is intended for authorized security testing, research, and defensive security purposes only. Users are responsible for ensuring they have proper authorization before using these techniques on systems they do not own or have explicit permission to test.
License
This project is licensed under the MIT License. See the LICENSE file for details.