Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rust HTTP client library & CLI tool with Tor proxy integration. Supports all HTTP methods, authentication, headers, and privacy-first web requests.

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
Notifications You must be signed in to change notification settings

acastellainiesta/RustorHTTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ¦€ RustorHTTP

HTTP Client Library and CLI Tool with Tor Proxy Support

RustorHTTP is a powerful HTTP client library and command-line tool written in Rust that routes all requests through Tor, ensuring anonymity and privacy for web requests.

πŸ“‹ Table of Contents


πŸš€ Features

  • βœ… All HTTP Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • βœ… Tor Integration: All requests routed through Tor SOCKS proxy
  • βœ… Authentication: Basic Auth and Bearer Token support
  • βœ… Multiple Body Types: JSON, Form Data, Plain Text, Raw Bytes
  • βœ… Header Management: Custom headers, User-Agent, Content-Type
  • βœ… Cookie Support: Automatic cookie handling
  • βœ… Query Parameters: URL query string parameters
  • βœ… Configurable Timeouts: Custom request timeouts
  • βœ… Verbose Output: Detailed response information
  • βœ… Custom Tor Proxy: Support for custom Tor proxy URLs
  • βœ… Identity Rotation: Fresh Tor identity on startup for enhanced anonymity

πŸ“‹ Requirements

  1. Tor: Must be running on your system

  2. Rust: Latest stable version

πŸ› οΈ Installation

git clone <repository-url>
cd RustorHTTP
cargo build --release

πŸ”§ Usage

Global Options

Option Description Default
--proxy <URL> Custom Tor proxy URL socks5://127.0.0.1:9050
--verbose Enable verbose output false
--timeout <SECONDS> Request timeout 30
--cookies Enable cookie handling false
--rotate-on-startup Fresh Tor identity on startup false
--control-port <ADDRESS:PORT> Tor control port 127.0.0.1:9051
--control-password <PASSWORD> Tor control port password None

Available Commands

  • get - Send GET requests
  • post - Send POST requests
  • put - Send PUT requests
  • delete - Send DELETE requests
  • patch - Send PATCH requests
  • head - Send HEAD requests
  • options - Send OPTIONS requests

πŸ“– Command Reference

GET Requests

Basic GET request:

cargo run get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/ip

GET with custom headers:

cargo run get https://httpbin.org/headers -H "X-Custom-Header:MyValue" -H "Accept:application/json"
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/headers -H "X-Custom-Header:MyValue" -H "Accept:application/json"
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/headers -H "X-Custom-Header:MyValue" -H "Accept:application/json"

GET with User-Agent:

cargo run get https://httpbin.org/user-agent --user-agent "RustorHTTP/1.0"
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/user-agent --user-agent "RustorHTTP/1.0"
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/user-agent --user-agent "RustorHTTP/1.0"

GET with query parameters:

cargo run get https://httpbin.org/get --query "param1=value1" --query "param2=value2"
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/get --query "param1=value1" --query "param2=value2"
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/get --query "param1=value1" --query "param2=value2"

GET with Basic Authentication:

cargo run get https://httpbin.org/basic-auth/user/pass --auth "user:pass"
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/basic-auth/user/pass --auth "user:pass"
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/basic-auth/user/pass --auth "user:pass"

GET with Bearer Token:

cargo run get https://httpbin.org/bearer --token "your-bearer-token-here"
.\RustorHTTP-1.1.0-Windows-x64.exe get https://httpbin.org/bearer --token "your-bearer-token-here"
.\RustorHTTP-1.1.0-Linux-x64 get https://httpbin.org/bearer --token "your-bearer-token-here"

POST Requests

POST with JSON data:

cargo run post https://httpbin.org/post --json '{"name":"John","age":30,"city":"New York"}'
.\RustorHTTP-1.1.0-Windows-x64.exe post https://httpbin.org/post --json '{"name":"John","age":30,"city":"New York"}'
.\RustorHTTP-1.1.0-Linux-x64 post https://httpbin.org/post --json '{"name":"John","age":30,"city":"New York"}'

POST with form data:

cargo run post https://httpbin.org/post --form "name=John" --form "[email protected]" --form "age=30"
.\RustorHTTP-1.1.0-Windows-x64.exe post https://httpbin.org/post --data "This is plain text data"
.\RustorHTTP-1.1.0-Linux-x64 post https://httpbin.org/post --data "This is plain text data"

POST with plain text:

cargo run post https://httpbin.org/post --data "This is plain text data"
.\RustorHTTP-1.1.0-Windows-x64.exe post https://httpbin.org/post --data "This is plain text data"
.\RustorHTTP-1.1.0-Linux-x64 post https://httpbin.org/post --data "This is plain text data"

POST with authentication:

cargo run post https://httpbin.org/post --json '{"message":"Hello"}' --token "your-api-token"
.\RustorHTTP-1.1.0-Windows-x64.exe post https://httpbin.org/post --json '{"message":"Hello"}' --token "your-api-token"
.\RustorHTTP-1.1.0-Linux-x64 post https://httpbin.org/post --json '{"message":"Hello"}' --token "your-api-token"

PUT Requests

PUT with JSON:

cargo run put https://httpbin.org/put --json '{"updated":"data","timestamp":"2024-01-01"}'
.\RustorHTTP-1.1.0-Windows-x64.exe put https://httpbin.org/put --json '{"updated":"data","timestamp":"2024-01-01"}'
.\RustorHTTP-1.1.0-Linux-x64 put https://httpbin.org/put --json '{"updated":"data","timestamp":"2024-01-01"}'

PUT with custom headers:

cargo run put https://httpbin.org/put --data "Updated content" -H "Content-Type:text/plain" -H "X-Update-Source:RustorHTTP"
.\RustorHTTP-1.1.0-Windows-x64.exe put https://httpbin.org/put --data "Updated content" -H "Content-Type:text/plain" -H "X-Update-Source:RustorHTTP"
.\RustorHTTP-1.1.0-Linux-x64 put https://httpbin.org/put --data "Updated content" -H "Content-Type:text/plain" -H "X-Update-Source:RustorHTTP"

DELETE Requests

Basic DELETE:

cargo run delete https://httpbin.org/delete
.\RustorHTTP-1.1.0-Windows-x64.exe delete https://httpbin.org/delete
.\RustorHTTP-1.1.0-Linux-x64 delete https://httpbin.org/delete

DELETE with authentication:

cargo run delete https://httpbin.org/delete --auth "admin:password"
.\RustorHTTP-1.1.0-Windows-x64.exe delete https://httpbin.org/delete --auth "admin:password"
.\RustorHTTP-1.1.0-Linux-x64 delete https://httpbin.org/delete --auth "admin:password"

PATCH Requests

PATCH with JSON:

cargo run patch https://httpbin.org/patch --json '{"field":"new_value"}'
.\RustorHTTP-1.1.0-Windows-x64.exe patch https://httpbin.org/patch --json '{"field":"new_value"}'
.\RustorHTTP-1.1.0-Linux-x64 patch https://httpbin.org/patch --json '{"field":"new_value"}'

HEAD Requests

HEAD request (headers only):

cargo run head https://httpbin.org/
.\RustorHTTP-1.1.0-Windows-x64.exe head https://httpbin.org/
.\RustorHTTP-1.1.0-Linux-x64 head https://httpbin.org/

OPTIONS Requests

OPTIONS request:

cargo run options https://httpbin.org/
.\RustorHTTP-1.1.0-Windows-x64.exe options https://httpbin.org/
.\RustorHTTP-1.1.0-Linux-x64 options https://httpbin.org/

πŸ” Advanced Examples

Verbose Output

Get detailed information about the request and response:

cargo run --verbose get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Windows-x64.exe --verbose get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Linux-x64 --verbose get https://httpbin.org/ip

Custom Tor Proxy

Use a different Tor proxy:

cargo run -- --proxy "socks5://127.0.0.1:9150" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Windows-x64.exe --proxy "socks5://127.0.0.1:9150" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Linux-x64 --proxy "socks5://127.0.0.1:9150" get https://httpbin.org/ip

Cookie Handling

Enable automatic cookie management:

cargo run -- --cookies get https://httpbin.org/cookies/set/session/abc123
.\RustorHTTP-1.1.0-Windows-x64.exe --cookies get https://httpbin.org/cookies/set/session/abc123
.\RustorHTTP-1.1.0-Linux-x64 --cookies get https://httpbin.org/cookies/set/session/abc123

cargo run -- --cookies get https://httpbin.org/cookies
.\RustorHTTP-1.1.0-Windows-x64.exe --cookies get https://httpbin.org/cookies
.\RustorHTTP-1.1.0-Linux-x64 --cookies get https://httpbin.org/cookies

Custom Timeout

Set a custom timeout (10 seconds):

cargo run -- --timeout 10 get https://httpbin.org/delay/5
.\RustorHTTP-1.1.0-Windows-x64.exe --timeout 10 get https://httpbin.org/delay/5
.\RustorHTTP-1.1.0-Linux-x64 --timeout 10 get https://httpbin.org/delay/5

Complex POST with Multiple Options

cargo run --verbose -- --cookies post https://httpbin.org/post --json '{"user":"john","action":"login"}' -H "X-API-Version:v1" -H "X-Client:RustorHTTP" --user-agent "MyApp/1.0" --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

.\RustorHTTP-1.1.0-Windows-x64.exe --verbose --cookies post https://httpbin.org/post --json '{"user":"john","action":"login"}' -H "X-API-Version:v1" -H "X-Client:RustorHTTP" --user-agent "MyApp/1.0" --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

.\RustorHTTP-1.1.0-Linux-x64 --verbose --cookies post https://httpbin.org/post --json '{"user":"john","action":"login"}' -H "X-API-Version:v1" -H "X-Client:RustorHTTP" --user-agent "MyApp/1.0" --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

API Testing Examples

Test REST API:

# GET all users
cargo run get https://jsonplaceholder.typicode.com/users
.\RustorHTTP-1.1.0-Windows-x64.exe get https://jsonplaceholder.typicode.com/users
.\RustorHTTP-1.1.0-Linux-x64 get https://jsonplaceholder.typicode.com/users

# GET specific user
cargo run get https://jsonplaceholder.typicode.com/users/1
.\RustorHTTP-1.1.0-Windows-x64.exe get https://jsonplaceholder.typicode.com/users/1
.\RustorHTTP-1.1.0-Linux-x64 get https://jsonplaceholder.typicode.com/users/1

# CREATE new post
cargo run post https://jsonplaceholder.typicode.com/posts --json '{"title":"My Post","body":"This is the content","userId":1}'
.\RustorHTTP-1.1.0-Windows-x64.exe post https://jsonplaceholder.typicode.com/posts --json '{"title":"My Post","body":"This is the content","userId":1}'
.\RustorHTTP-1.1.0-Linux-x64 post https://jsonplaceholder.typicode.com/posts --json '{"title":"My Post","body":"This is the content","userId":1}'

# UPDATE post
cargo run put https://jsonplaceholder.typicode.com/posts/1 --json '{"id":1,"title":"Updated Title","body":"Updated content","userId":1}'
.\RustorHTTP-1.1.0-Windows-x64.exe put https://jsonplaceholder.typicode.com/posts/1 --json '{"id":1,"title":"Updated Title","body":"Updated content","userId":1}'
.\RustorHTTP-1.1.0-Linux-x64 put https://jsonplaceholder.typicode.com/posts/1 --json '{"id":1,"title":"Updated Title","body":"Updated content","userId":1}'

# PATCH post
cargo run patch https://jsonplaceholder.typicode.com/posts/1 --json '{"title":"Partially Updated Title"}'
.\RustorHTTP-1.1.0-Windows-x64.exe patch https://jsonplaceholder.typicode.com/posts/1 --json '{"title":"Partially Updated Title"}'
.\RustorHTTP-1.1.0-Linux-x64 patch https://jsonplaceholder.typicode.com/posts/1 --json '{"title":"Partially Updated Title"}'

# DELETE post
cargo run delete https://jsonplaceholder.typicode.com/posts/1
.\RustorHTTP-1.1.0-Windows-x64.exe delete https://jsonplaceholder.typicode.com/posts/1
.\RustorHTTP-1.1.0-Linux-x64 delete https://jsonplaceholder.typicode.com/posts/1

πŸ” Security Features

Tor Integration

All requests are automatically routed through Tor:

  • Anonymity: Your real IP address is hidden
  • Privacy: Traffic is encrypted through multiple relays
  • Censorship Bypass: Access blocked websites

Authentication Support

  • Basic Auth: Username and password authentication
  • Bearer Tokens: JWT and API token support
  • Custom Headers: Full control over request headers

πŸ”„ Identity Rotation (v1.1.0)

✨ Fresh Identity on Startup

RustorHTTP can automatically change your Tor identity before each command execution, ensuring maximum anonymity by getting a new IP address and Tor circuit path.

πŸ› οΈ Windows Tor Configuration

⚠️ Important: Windows requires custom torrc file because Tor Browser doesn't enable control port by default.

Step 1: Create Custom torrc

Location: C:\tor\torrc

# Required configuration
SocksPort 9050
ControlPort 9051
HashedControlPassword 16:4EC4431892AF1C6460463622FA381E9F6A679100029A59DAFB228E6A35
DataDirectory C:\tor\data
DisableNetwork 0

Step 2: Generate Password Hash

# Generate hash for "MyPassword123"
tor --hash-password MyPassword123
# Output: 16:4EC4431892AF1C6460463622FA381E9F6A679100029A59DAFB228E6A35

Step 3: Restart Tor Browser

πŸš€ Identity Rotation Examples

Fresh Identity Per Command

# Each command gets a new Tor identity and IP
cargo run -- --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Windows-x64.exe --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Linux-x64 --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip

With Custom Control Port

cargo run -- --control-port "127.0.0.1:9051" --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Windows-x64.exe --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip
.\RustorHTTP-1.1.0-Linux-x64 --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip

πŸ“Š Identity Rotation Flow

flowchart TD
    A["πŸš€ Start"] --> B{"πŸ”„ --rotate-on-startup?"}
    B -->|No| D["πŸ“‘ HTTP Request"]
    B -->|Yes| C["πŸ”— Connect Control Port"]
    C --> E{"βœ… Connected?"}
    E -->|No| F["⚠️ Continue without rotation"]
    E -->|Yes| G["πŸ”„ SIGNAL NEWNYM"]
    G --> H["βœ… New Identity"]
    H --> I["⏳ Wait 3s"]
    I --> D
    F --> D
    D --> J["πŸ“¨ Response"]
    J --> K["🏁 End"]
Loading

Expected Output (-v is required for verbose output. Otherwise, the identity rotation output is not displayed.)

πŸ” Testing Tor control connection to 127.0.0.1:9051...
βœ… Tor control connection successful!
Identity rotation enabled:
  - Control port: 127.0.0.1:9051
πŸ”„ Rotating identity on startup...
βœ… Identity rotation successful!
Sending GET request to: https://httpbin.org/ip
Status: 200 OK
Response Body:
{
  "origin": "185.220.101.32"
}

πŸ’‘ Use Cases

  • Web Scraping: Fresh IP for each scraping session
  • API Testing: Different identity per test
  • Privacy Research: Guaranteed fresh circuits
  • Automated Tasks: Simple, reliable anonymity

πŸ› Troubleshooting Common Issues

[Linux Build] OpenSSL compilation error

error: failed to run custom build command for `openssl-sys v0.9.109`
warning: [email protected]: Could not find directory of OpenSSL installation
  • Problem: Missing OpenSSL development libraries when building for Linux targets
  • Root Cause: The openssl-sys crate requires OpenSSL headers and pkg-config to compile
  • Solution for Ubuntu (Same for Debian dnf):
    # Update package list
    sudo apt update
    
    # Install required development packages
    sudo apt install pkg-config libssl-dev
    
    # Add Linux target (if cross-compiling)
    rustup target add x86_64-unknown-linux-gnu
    
    # Build for Linux
    cargo build --release --target x86_64-unknown-linux-gnu

[Identity Rotation] Troubleshooting Issues

Could not connect to control port

  • Problem: ❌ Warning: Could not connect to Tor control port at 127.0.0.1:9051
  • Solution:
    • Enable ControlPort 9051 in torrc
    • Restart Tor Browser
    • Verify Tor is running: Windows: netstat -an | findstr :9051 Linux: netstat -an | grep :9051

Authentication failed

  • Problem: Authentication failed: 515 Bad authentication
  • Solution:
    • Verify control password is correct
    • Regenerate hash: tor --hash-password YourPassword
    • Update HashedControlPassword in torrc

Same IP on multiple commands

  • Problem: IP doesn't change between --rotate-on-startup commands
  • Solution:
    • Verify --rotate-on-startup flag is used
    • Check --control-password parameter
    • Ensure DisableNetwork 0 in torrc (not DisableNetwork 1)

DisableNetwork error

  • Problem: Tor Browser resets DisableNetwork 1 on restart
  • Solution: Always set DisableNetwork 0 in custom torrc file

Cargo argument passing issues

  • Problem: error: unexpected argument '--rotate-on-startup' found
  • Solution: Use -- to separate cargo flags from application flags:
    cargo run -- --rotate-on-startup --control-password "MyPassword123" get https://httpbin.org/ip

🚧 Future Features (Roadmap)

πŸ”„ Advanced Tor Identity Management

  • Exit Node Selection: Choose specific exit nodes for requests

⚑ Performance & Concurrency

  • Multi-threading Support: Concurrent HTTP requests with thread pool
  • Async Request Batching: Send multiple requests simultaneously
  • Connection Pooling: Reuse connections for better performance
  • Request Queue Management: Priority-based request handling

πŸ”§ Advanced Configuration

  • Bridge Support: Tor bridges for enhanced censorship resistance
  • Proxy Chains: Multiple proxy layers (Tor + VPN)
  • Traffic Obfuscation: Additional layers for traffic analysis resistance

πŸ“Š Monitoring & Logging

  • Tor Network Status: Monitor circuit health and performance
  • Export Formats: JSON, CSV output for request logs
  • Performance Metrics: Detailed timing and network statistics

πŸ›‘οΈ Enhanced Security

  • Certificate Pinning: Pin specific SSL certificates
  • Request Fingerprinting Protection: Randomize headers and timing
  • Anti-Detection Features: Mimic different browsers and clients

Note: These features are planned for future releases. Contributions and feature requests are welcome!

About

Rust HTTP client library & CLI tool with Tor proxy integration. Supports all HTTP methods, authentication, headers, and privacy-first web requests.

Topics

Resources

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages