Skip to content

A bash script that provides an enhanced interface for ProxyChains, making it easier to manage and use proxy configurations

Notifications You must be signed in to change notification settings

DilshanHarshajith/ProxyWrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

ProxyWrap - Advanced ProxyChains Tool

ProxyWrap is a powerful bash script that provides an enhanced interface for ProxyChains, making it easier to manage and use proxy configurations with advanced features like validation, profiles, and interactive selection.

Features

  • Multiple Proxy Support: Add proxies individually or load from files
  • Proxy Validation: Test proxy connectivity before use
  • Profile Management: Save and load proxy configurations
  • Interactive Mode: Select proxies interactively
  • Chain Types: Support for strict and random chain modes
  • Retry Logic: Automatic retry on command failure
  • Export Functionality: Export ProxyChains configurations
  • Dry Run Mode: Preview configurations without execution
  • Verbose Output: Detailed logging and configuration display

Prerequisites

  • proxychains must be installed and available in PATH
  • Bash shell (version 4.0 or higher recommended)
  • Standard Unix utilities (timeout, mktemp, etc.)

Installing ProxyChains

Ubuntu/Debian:

sudo apt-get install proxychains

CentOS/RHEL:

sudo yum install proxychains-ng

macOS:

brew install proxychains-ng

Installation

  1. Clone the repository:
git clone https://github.com/yourrepo/proxywrap.git
cd proxywrap
  1. Make the script executable:
chmod +x ProxyWrap.sh
  1. (Optional) Run from anywhere: Add the directory to your PATH or symlink the script.

Note: ProxyWrap.sh relies on the lib/ directory. Ensure lib/ is in the same directory as the script if you move it, or keep the script in place and symlink it.

sudo ln -s "$(pwd)/ProxyWrap.sh" /usr/local/bin/proxywrap

Directory Structure

ProxyWrap/
├── ProxyWrap.sh      # Main executable
├── lib/              # Modular libraries
│   ├── utils.sh      # Utilities (logging, colors)
│   ├── network.sh    # Network scanning & MAC resolution
│   ├── proxy.sh      # Proxy handling & validation
│   └── profile.sh    # Profile management
└── README.md         # Documentation

Usage

Basic Syntax

./ProxyWrap.sh [options] -- <command>

Options

Option Description
-p <proxy> Add proxy (format: "socks5 127.0.0.1 9050")
-P <file> Load proxies from file
-m <mac> <proto> <port> Add proxy by MAC address resolution
-M <file> Load MAC addresses from file
-r Use random_chain instead of strict_chain
-n Disable proxy_dns
-i Interactive proxy selection
-d Dry-run mode (don't execute command)
--retry <N> Retry the command N times if it fails
--delay <sec> Random delay between proxies
--profile <name> Load/save a proxy profile
--validate Validate proxies before use
--export <file> Export proxychains config to file
--timeout <sec> Connection timeout for validation (default: 5)
--network <range> Network range for MAC scanning (default: auto-detect)
--mac-timeout <sec> Timeout for MAC address resolution (default: 10)
--list-profiles List available profiles
--remove-profile <name> Remove a profile
-v, --verbose Verbose output
-h, --help Show help menu

Proxy Formats

ProxyWrap supports three proxy protocols:

  • socks4 <host> <port>
  • socks5 <host> <port>
  • http <host> <port>

Examples

Basic Usage

Run curl through a single SOCKS5 proxy:

./ProxyWrap.sh -p "socks5 127.0.0.1 9050" -- curl http://ifconfig.me

MAC Address Resolution

Add a proxy by resolving its MAC address to an IP:

./ProxyWrap.sh -m "aa:bb:cc:dd:ee:ff" socks5 1080 -- curl http://ifconfig.me

Multiple Proxies

Use multiple proxies in random chain mode:

./ProxyWrap.sh -r -p "socks5 127.0.0.1 9050" -p "http 192.168.1.100 8080" -- curl http://ifconfig.me

Load Proxies from File

Create a proxy file (proxies.txt):

socks5 127.0.0.1 9050
http 192.168.1.100 8080
socks4 10.0.0.1 1080

Then use it:

./ProxyWrap.sh -P proxies.txt -- curl http://ifconfig.me

Profile Management

Save a proxy configuration as a profile:

./ProxyWrap.sh -p "socks5 127.0.0.1 9050" --profile myvpn -- curl http://ifconfig.me

Load and use a saved profile:

./ProxyWrap.sh --profile myvpn -- firefox

List available profiles:

./ProxyWrap.sh --list-profiles

Proxy Validation

Validate proxies before use:

./ProxyWrap.sh -P proxies.txt --validate --timeout 10 -- curl http://ifconfig.me

Interactive Mode

Select proxies interactively:

./ProxyWrap.sh -P proxies.txt -i -- curl http://ifconfig.me

Advanced Usage

Combine multiple features:

./ProxyWrap.sh --profile myvpn --validate -i --retry 3 --delay 2 -v -- curl http://ifconfig.me

Dry Run

Preview configuration without execution:

./ProxyWrap.sh -p "socks5 127.0.0.1 9050" -d -- curl http://ifconfig.me

Export Configuration

Export ProxyChains configuration to a file:

./ProxyWrap.sh -p "socks5 127.0.0.1 9050" --export /tmp/proxychains.conf

Configuration Files

Profile Storage

Profiles are stored in ~/.proxywrap/ directory as .profile files.

Proxy File Format

Proxy files should contain one proxy per line in the format:

protocol host port

Comments (lines starting with #) and empty lines are ignored.

Example:

# My proxy list
socks5 127.0.0.1 9050
http 192.168.1.100 8080
# Another proxy
socks4 10.0.0.1 1080

Chain Types

Strict Chain (default)

Proxies are used in the exact order specified. If any proxy fails, the connection fails.

Random Chain

A random proxy is selected from the list for each connection.

Usage:

./ProxyWrap.sh -r -P proxies.txt -- curl http://ifconfig.me

Error Handling

ProxyWrap includes comprehensive error handling:

  • Validates proxy formats
  • Checks for required dependencies
  • Provides clear error messages
  • Supports retry logic for failed commands
  • Graceful cleanup of temporary files

Troubleshooting

Common Issues

  1. Command not found: proxychains

    • Install proxychains using your package manager
    • Ensure proxychains is in your PATH
  2. Permission denied

    • Make sure the script is executable: chmod +x ProxyWrap.sh
  3. Proxy connection failed

    • Use --validate to test proxy connectivity
    • Check proxy server status and credentials
    • Verify firewall settings
  4. Profile not found

    • Use --list-profiles to see available profiles
    • Check if profile exists in ~/.proxywrap/
  5. Library not found

    • Ensure the lib/ directory is in the same folder as ProxyWrap.sh

Verbose Mode

Use -v or --verbose for detailed output:

./ProxyWrap.sh -v -p "socks5 127.0.0.1 9050" -- curl http://ifconfig.me

Security Considerations

  • Proxy credentials are not encrypted in profile files
  • Use appropriate file permissions for proxy configuration files
  • Be cautious when using untrusted proxy servers
  • Consider using VPN in addition to proxies for enhanced security

Contributing

Feel free to submit issues, feature requests, or pull requests to improve ProxyWrap.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

Version 1.1.0 (Refactor)

  • Modularization: Codebase split into lib/ modules for better maintainability.
  • Improved Parsing: Enhanced argument parsing logic.
  • Network Module: Dedicated module for resolution logic.
  • Refined UI: Cleaner output and error messages.

Version 1.0.0

  • Initial release
  • Basic proxy management
  • Profile system
  • Validation functionality
  • Interactive mode
  • Export capabilities

About

A bash script that provides an enhanced interface for ProxyChains, making it easier to manage and use proxy configurations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages