Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
Update ProxyBridge version to 3.2.0 and add auto-deploy script for Linux
Sourav Kalalac9d1af73d50
diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.ymlnew file mode 100644index 0000000..4e2f9b6--- /dev/null+++ b/.github/workflows/release-linux.yml@@ -0,0 +1,129 @@+name: Release ProxyBridge Linux++on:+ release:+ types: [published, created]+ workflow_dispatch:++jobs:+ build-and-release:+ runs-on: ubuntu-latest+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.actor == github.repository_owner)++ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Install build dependencies+ run: |+ sudo apt-get update+ sudo apt-get install -y \+ build-essential \+ gcc \+ make \+ libnetfilter-queue-dev \+ libnfnetlink-dev \+ libgtk-3-dev \+ pkg-config+ shell: bash++ - name: Build project+ run: |+ cd Linux+ chmod +x build.sh+ ./build.sh+ shell: bash++ - name: Copy setup script to output+ run: |+ echo "Copying setup.sh to output directory..."+ cp Linux/setup.sh Linux/output/+ chmod +x Linux/output/setup.sh+ echo "✓ Setup script copied"+ shell: bash++ - name: Verify build output+ run: |+ echo "=== Build Output ==="+ ls -lh Linux/output/+ echo ""+ if [ -f "Linux/output/libproxybridge.so" ]; then+ echo "✓ Library built successfully"+ file Linux/output/libproxybridge.so+ else+ echo "✗ Library build failed"+ exit 1+ fi+ echo ""+ if [ -f "Linux/output/ProxyBridge" ]; then+ echo "✓ CLI built successfully"+ file Linux/output/ProxyBridge+ else+ echo "✗ CLI build failed"+ exit 1+ fi+ echo ""+ if [ -f "Linux/output/setup.sh" ]; then+ echo "✓ Setup script copied"+ else+ echo "✗ Setup script missing"+ exit 1+ fi+ shell: bash++ - name: Extract version from tag+ id: version+ run: |+ if [ "${{ github.event_name }}" == "release" ]; then+ VERSION="${{ github.event.release.tag_name }}"+ else+ VERSION="dev-$(date +%Y%m%d-%H%M%S)"+ fi+ # Remove 'v' prefix if present+ VERSION="${VERSION#v}"+ echo "version=$VERSION" >> $GITHUB_OUTPUT+ echo "Version: $VERSION"+ shell: bash++ - name: Create release archive+ run: |+ VERSION="${{ steps.version.outputs.version }}"+ ARCHIVE_NAME="ProxyBridge-Linux-v${VERSION}.tar.gz"++ echo "Creating archive: $ARCHIVE_NAME"+ cd Linux/output+ tar -czf "../$ARCHIVE_NAME" ./*++ echo ""+ echo "Archive created successfully:"+ ls -lh "../$ARCHIVE_NAME"++ # Move archive to root for upload+ mv "../$ARCHIVE_NAME" "../../$ARCHIVE_NAME"+ shell: bash++ - name: List release files+ run: |+ echo ""+ echo "==================================="+ echo "Release Files:"+ echo "==================================="+ ls -lh ProxyBridge-Linux-*.tar.gz++ echo ""+ echo "Archive contents:"+ tar -tzf ProxyBridge-Linux-*.tar.gz+ shell: bash++ - name: Upload archive to release+ if: github.event_name == 'release'+ uses: softprops/action-gh-release@v1+ with:+ files: ProxyBridge-Linux-v*.tar.gz++ - name: Upload build artifacts+ uses: actions/upload-artifact@v4+ with:+ name: ProxyBridge-Linux-Release-${{ steps.version.outputs.version }}+ path: ProxyBridge-Linux-*.tar.gz+ retention-days: 90diff --git a/Linux/deploy.sh b/Linux/deploy.shnew file mode 100644index 0000000..d9dd929--- /dev/null+++ b/Linux/deploy.sh@@ -0,0 +1,346 @@+#!/bin/bash++set -e++GITHUB_REPO="InterceptSuite/ProxyBridge"+GITHUB_API="https://api.github.com/repos/$GITHUB_REPO/releases/latest"+TEMP_DIR="/tmp/proxybridge-install-$$"++echo ""+echo "==================================="+echo "ProxyBridge Auto-Deploy Script"+echo "==================================="+echo ""++# Check if running as root+if [ "$EUID" -ne 0 ]; then+ echo "ERROR: This script must be run as root"+ echo "Please run: sudo bash deploy.sh"+ exit 1+fi++# Check for required tools+check_requirements() {+ echo "Checking required tools..."++ local missing_tools=()++ if ! command -v curl &> /dev/null; then+ missing_tools+=("curl")+ fi++ if ! command -v tar &> /dev/null; then+ missing_tools+=("tar")+ fi++ if ! command -v jq &> /dev/null; then+ echo "WARNING: jq not found. Attempting to parse JSON manually."+ fi++ if [ ${#missing_tools[@]} -gt 0 ]; then+ echo "ERROR: Missing required tools: ${missing_tools[*]}"+ echo ""+ echo "Please install them first:"+ echo " Debian/Ubuntu: sudo apt install curl tar jq"+ echo " Fedora: sudo dnf install curl tar jq"+ echo " Arch: sudo pacman -S curl tar jq"+ exit 1+ fi++ echo "All required tools available"+}++# Download latest release+download_latest_release() {+ echo ""+ echo "Fetching latest release information..."++ # Create temp directory+ mkdir -p "$TEMP_DIR"+ cd "$TEMP_DIR"++ # Get release info from GitHub API+ local api_response+ api_response=$(curl -sL "$GITHUB_API")++ if [ -z "$api_response" ]; then+ echo "ERROR: Failed to fetch release information from GitHub"+ exit 1+ fi++ # Extract download URL for Linux tar.gz+ local download_url+ if command -v jq &> /dev/null; then+ download_url=$(echo "$api_response" | jq -r '.assets[] | select(.name | test("ProxyBridge-Linux-.*\\.tar\\.gz$")) | .browser_download_url' | head -1)+ else+ # Fallback: manual parsing+ download_url=$(echo "$api_response" | grep -o '"browser_download_url": *"[^"]*ProxyBridge-Linux-[^"]*\.tar\.gz"' | head -1 | sed 's/.*"browser_download_url": *"\([^"]*\)".*/\1/')+ fi++ if [ -z "$download_url" ]; then+ echo "ERROR: Could not find Linux release archive in latest release"+ echo ""+ echo "Please check if a Linux release is available at:"+ echo " https://github.com/$GITHUB_REPO/releases/latest"+ exit 1+ fi++ # Extract version from URL+ local filename+ filename=$(basename "$download_url")+ echo "Found release: $filename"+ echo "Download URL: $download_url"++ echo ""+ echo "Downloading $filename..."+ if ! curl -L -o "$filename" "$download_url"; then+ echo "ERROR: Failed to download release archive"+ exit 1+ fi++ echo "Download complete"++ # Extract archive+ echo ""+ echo "Extracting archive..."+ if ! tar -xzf "$filename"; then+ echo "ERROR: Failed to extract archive"+ exit 1+ fi++ echo "Extraction complete"+ echo "Files extracted to: $TEMP_DIR"+ ls -lh+}++# Detect Linux distribution+detect_distro() {+ if [ -f /etc/os-release ]; then+ . /etc/os-release+ DISTRO=$ID+ DISTRO_LIKE=$ID_LIKE+ elif [ -f /etc/lsb-release ]; then+ . /etc/lsb-release+ DISTRO=$DISTRIB_ID+ else+ DISTRO=$(uname -s)+ fi+ echo ""+ echo "Detected distribution: $DISTRO"+}++# Install dependencies based on distribution+install_dependencies() {+ echo ""+ echo "Checking and installing dependencies..."++ # Normalize distro name using ID_LIKE fallback+ local distro_family="$DISTRO"+ if [ -n "$DISTRO_LIKE" ]; then+ case "$DISTRO_LIKE" in+ *ubuntu*|*debian*) distro_family="debian" ;;+ *fedora*) distro_family="fedora" ;;+ *rhel*|*centos*) distro_family="rhel" ;;+ *arch*) distro_family="arch" ;;+ *suse*) distro_family="opensuse" ;;+ esac+ fi++ case "$distro_family" in+ ubuntu|debian|linuxmint|pop|elementary|zorin|kali|raspbian|mx|antix|deepin|lmde)+ echo "Using apt package manager..."+ apt-get update -qq+ apt-get install -y libnetfilter-queue1 libnfnetlink0 iptables libgtk-3-0+ ;;+ fedora)+ echo "Using dnf package manager..."+ dnf install -y libnetfilter_queue libnfnetlink iptables gtk3+ ;;+ rhel|centos|rocky|almalinux)+ echo "Using yum package manager..."+ yum install -y libnetfilter_queue libnfnetlink iptables gtk3+ ;;+ arch|manjaro|endeavouros|garuda)+ echo "Using pacman package manager..."+ pacman -Sy --noconfirm libnetfilter_queue libnfnetlink iptables gtk3+ ;;+ opensuse*|sles)+ echo "Using zypper package manager..."+ zypper install -y libnetfilter_queue1 libnfnetlink0 iptables gtk3+ ;;+ void)+ echo "Using xbps package manager..."+ xbps-install -Sy libnetfilter_queue libnfnetlink iptables gtk3+ ;;+ *)+ echo "WARNING: Unknown distribution '$DISTRO' (family: '$DISTRO_LIKE')"+ echo ""+ echo "Please manually install the following packages:"+ echo " Debian/Ubuntu: sudo apt install libnetfilter-queue1 libnfnetlink0 iptables libgtk-3-0"+ echo " Fedora: sudo dnf install libnetfilter_queue libnfnetlink iptables gtk3"+ echo " Arch: sudo pacman -S libnetfilter_queue libnfnetlink iptables gtk3"+ echo ""+ read -p "Continue anyway? (y/n) " -n 1 -r+ echo+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then+ exit 1+ fi+ ;;+ esac++ echo "Dependencies installed"+}++# Use /usr/local/lib (matches RPATH in binary)+detect_lib_path() {+ LIB_PATH="/usr/local/lib"+ echo "Library installation path: $LIB_PATH"+}++# Check if files exist in extracted directory+check_files() {+ echo ""+ echo "Checking for required files..."++ if [ ! -f "$TEMP_DIR/libproxybridge.so" ]; then+ echo "ERROR: libproxybridge.so not found in extracted archive"+ exit 1+ fi++ if [ ! -f "$TEMP_DIR/ProxyBridge" ]; then+ echo "ERROR: ProxyBridge binary not found in extracted archive"+ exit 1+ fi++ if [ ! -f "$TEMP_DIR/ProxyBridgeGUI" ]; then+ echo "WARNING: ProxyBridgeGUI binary not found - GUI will not be installed"+ fi++ echo "All required files present"+}++# Install files+install_files() {+ echo ""+ echo "Installing ProxyBridge..."++ # Create directories if they don't exist+ mkdir -p "$LIB_PATH" /usr/local/bin /etc/proxybridge+ chmod 755 /etc/proxybridge++ # Copy library+ echo "Installing libproxybridge.so to $LIB_PATH..."+ cp "$TEMP_DIR/libproxybridge.so" "$LIB_PATH/"+ chmod 755 "$LIB_PATH/libproxybridge.so"++ # Copy binary+ echo "Installing ProxyBridge to /usr/local/bin..."+ cp "$TEMP_DIR/ProxyBridge" /usr/local/bin/+ chmod 755 /usr/local/bin/ProxyBridge++ if [ -f "$TEMP_DIR/ProxyBridgeGUI" ]; then+ echo "Installing ProxyBridgeGUI to /usr/local/bin..."+ cp "$TEMP_DIR/ProxyBridgeGUI" /usr/local/bin/+ chmod 755 /usr/local/bin/ProxyBridgeGUI+ fi++ echo "Files installed"+}++# Update library cache+update_ldconfig() {+ echo ""+ echo "Updating library cache..."++ # Add /usr/local/lib to ld.so.conf if not already there+ if [ -d /etc/ld.so.conf.d ]; then+ if ! grep -q "^/usr/local/lib" /etc/ld.so.conf.d/* 2>/dev/null; then+ echo "/usr/local/lib" > /etc/ld.so.conf.d/proxybridge.conf+ if [ "$LIB_PATH" = "/usr/local/lib64" ]; then+ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/proxybridge.conf+ fi+ fi+ fi++ # Run ldconfig+ if command -v ldconfig &> /dev/null; then+ ldconfig 2>/dev/null || true+ ldconfig -v 2>/dev/null | grep -q proxybridge || true+ echo "Library cache updated"+ else+ echo "WARNING: ldconfig not found. You may need to reboot."+ fi+}++# Verify installation+verify_installation() {+ echo ""+ echo "Verifying installation..."++ # Check if binary is in PATH+ if command -v ProxyBridge &> /dev/null; then+ echo "ProxyBridge binary found in PATH"+ else+ echo "ProxyBridge binary not found in PATH"+ echo " You may need to add /usr/local/bin to your PATH"+ fi++ # Check if library is loadable+ if ldd /usr/local/bin/ProxyBridge 2>/dev/null | grep -q "libproxybridge.so"; then+ if ldd /usr/local/bin/ProxyBridge 2>/dev/null | grep "libproxybridge.so" | grep -q "not found"; then+ echo "libproxybridge.so not loadable"+ else+ echo "libproxybridge.so is loadable"+ fi+ fi++ # Final test - try to run --help+ if /usr/local/bin/ProxyBridge --help &>/dev/null; then+ echo "ProxyBridge executable is working"+ else+ echo "⚠ ProxyBridge may have issues - try: sudo ldconfig"+ fi+}++# Cleanup temp directory+cleanup() {+ echo ""+ echo "Cleaning up temporary files..."+ rm -rf "$TEMP_DIR"+ echo "Cleanup complete"+}++# Main deployment+main() {+ check_requirements+ download_latest_release+ detect_distro+ check_files+ install_dependencies+ detect_lib_path+ install_files+ update_ldconfig+ verify_installation+ cleanup++ echo ""+ echo "==================================="+ echo "Installation Complete!"+ echo "==================================="+ echo ""+ echo "You can now run ProxyBridge from anywhere:"+ echo " sudo ProxyBridge --help"+ if [ -f /usr/local/bin/ProxyBridgeGUI ]; then+ echo " sudo ProxyBridgeGUI (Graphical Interface)"+ fi+ echo " sudo ProxyBridge --proxy socks5://IP:PORT --rule \"app:*:*:TCP:PROXY\""+ echo ""+ echo "For cleanup after crash:"+ echo " sudo ProxyBridge --cleanup"+ echo ""+}++# Trap errors and cleanup+trap 'echo ""; echo "ERROR: Installation failed. Cleaning up..."; rm -rf "$TEMP_DIR"; exit 1' ERR++maindiff --git a/Linux/src/ProxyBridge.h b/Linux/src/ProxyBridge.hindex 023493e..bd80583 100644--- a/Linux/src/ProxyBridge.h+++ b/Linux/src/ProxyBridge.h@@ -1,7 +1,7 @@#ifndef PROXYBRIDGE_H#define PROXYBRIDGE_H-#define PROXYBRIDGE_VERSION "4.1.0-Beta"+#define PROXYBRIDGE_VERSION "3.2.0"#include <stdint.h>#include <stdbool.h>diff --git a/Windows/README.md b/Windows/README.mdindex c0ad17a..60a2ebe 100644--- a/Windows/README.md+++ b/Windows/README.md@@ -223,21 +223,22 @@ Usage:ProxyBridge_CLI [command] [options]Options:- --proxy <proxy> Proxy server URL with optional authentication- Format: type://ip:port or type://ip:port:username:password- Examples: socks5://127.0.0.1:1080- http://proxy.com:8080:myuser:mypass [default: socks5://127.0.0.1:4444]- --rule <rule> Traffic routing rule (multiple values supported, can repeat)- Format: process:hosts:ports:protocol:action- process - Process name(s): chrome.exe, chr*.exe, *.exe, or *- hosts - IP/host(s): *, google.com, 192.168.*.*, or multiple comma-separated- ports - Port(s): *, 443, 80,443, 80-100, or multiple comma-separated- protocol - TCP, UDP, or BOTH- action - PROXY, DIRECT, or BLOCK- Examples:- chrome.exe:*:*:TCP:PROXY- *:*:53:UDP:PROXY- firefox.exe:*:80,443:TCP:DIRECT+ --proxy <proxy> Proxy server URL with optional authentication+ Format: type://ip:port or type://ip:port:username:password+ Examples: socks5://127.0.0.1:1080+ http://proxy.com:8080:myuser:mypass [default: socks5://127.0.0.1:4444]+ --rule <rule> Traffic routing rule (multiple values supported, can repeat)+ Format: process:hosts:ports:protocol:action+ process - Process name(s): chrome.exe, chr*.exe, *.exe, or * (use ; for multiple: chrome.exe;firefox.exe)+ hosts - IP/host(s): *, google.com, 192.168.*.*, or multiple separated by ; or ,+ ports - Port(s): *, 443, 80;8080, 80-100, or multiple separated by ; or ,+ protocol - TCP, UDP, or BOTH+ action - PROXY, DIRECT, or BLOCK+ Examples:+ chrome.exe:*:*:TCP:PROXY+ chrome.exe;firefox.exe:*:*:TCP:PROXY+ *:*:53:UDP:PROXY+ firefox.exe:*:80;443:TCP:DIRECT--rule-file <rule-file> Path to JSON file containing proxy rulesJSON format (same as GUI export):[{@@ -249,14 +250,16 @@ Options:"enabled": true}]Example: --rule-file C:\\rules.json []- --dns-via-proxy Route DNS queries through proxy (default: true) [default: True]- --verbose <verbose> Logging verbosity level- 0 - No logs (default)- 1 - Show log messages only- 2 - Show connection events only- 3 - Show both logs and connections [default: 0]- --version Show version information- -?, -h, --help Show help and usage information+ --dns-via-proxy Route DNS queries through proxy (default: true) [default: True]+ --localhost-via-proxy Route localhost traffic through proxy (default: false, most proxies block localhost for SSRF prevention, local traffic to remote proxy will cause issues)+ [default: False]+ --verbose <verbose> Logging verbosity level+ 0 - No logs (default)+ 1 - Show log messages only+ 2 - Show connection events only+ 3 - Show both logs and connections [default: 0]+ --version Show version information+ -?, -h, --help Show help and usage informationCommands:--update Check for updates and download latest version from GitHub@@ -314,14 +317,42 @@ Commands:- **DNS Traffic Handling**: DNS traffic on TCP and UDP port 53 is handled separately from proxy rules. Even if you configure rules for port 53, they will be ignored. Instead, DNS routing is controlled by the **DNS via Proxy** option in the Proxy menu (enabled by default). When enabled, all DNS queries are routed through the proxy; when disabled, DNS queries use direct connection.+- **Localhost Traffic Handling**: Localhost traffic (127.0.0.0/8) requires special handling and is controlled by the **Localhost via Proxy** option in the Proxy menu (disabled by default):++ **Default Behavior (Localhost via Proxy = Disabled):**+ - ALL localhost traffic automatically uses direct connection+ - Proxy rules matching 127.x.x.x addresses are automatically overridden to DIRECT+ - This is the recommended setting for most users++ **Why localhost should stay local:**+ - **Security**: Most proxy servers reject localhost traffic to prevent SSRF (Server-Side Request Forgery) attacks+ - **Compatibility**: Many applications run local services that must stay on your machine:+ - NVIDIA GeForce Experience (local API servers)+ - Chrome/Edge DevTools (127.0.0.1:9222 debugging protocol)+ - Development servers (localhost web/database servers)+ - Inter-process communication (IPC) using TCP/UDP on 127.0.0.1+ - **Routing Issues**: When localhost traffic goes to a remote proxy:+ - The proxy server cannot reach services running on YOUR machine+ - Applications expecting local responses will timeout or fail+ - Example: `curl http://127.0.0.1:8080` via remote proxy asks the proxy's localhost, not yours++ **When to Enable Localhost via Proxy:**+ - ✅ Proxy server is running on the same machine (127.0.0.1:1080)+ - ✅ Security testing: Intercepting localhost traffic in Burp Suite/InterceptSuite+ - ✅ Your proxy is configured to handle localhost requests properly+ - ❌ Do NOT enable if proxy is on a different machine/IP address++ **CLI/GUI Options:**+ - GUI: **Proxy** menu → **Localhost via Proxy** (checkbox)+ - CLI: `--localhost-via-proxy` flag+- **Automatic Direct Routing**: Certain IP addresses and ports automatically use direct connection regardless of proxy rules, though you can still create rules with **DIRECT** (default) or **BLOCK** actions for them:- - **Localhost addresses** (127.0.0.0/8) - Loopback traffic- **Broadcast addresses** (255.255.255.255 and x.x.x.255) - Network broadcast- **Multicast addresses** (224.0.0.0 - 239.255.255.255) - Group communication- **APIPA addresses** (169.254.0.0/16) - Automatic Private IP Addressing (link-local)- **DHCP ports** (UDP 67, 68) - Dynamic Host Configuration Protocol- These addresses and ports are used by system components, network discovery, and essential Windows services. While proxy rules are automatically overridden to DIRECT for these targets, you can still define rules with DIRECT or BLOCK actions to explicitly control or block this traffic. Note that Windows loopback traffic (127.x.x.x) uses a method that bypasses the network interface card (NIC), which currently doesn't support proxy routing due to technical limitations with WinDivert at the network layer.+ These addresses and ports are used by system components, network discovery, and essential Windows services. While proxy rules are automatically overridden to DIRECT for these targets, you can still define rules with DIRECT or BLOCK actions to explicitly control or block this traffic.- **UDP Proxy Requirements**: UDP traffic only works when a SOCKS5 proxy is configured. If an HTTP proxy server is configured, ProxyBridge will ignore UDP proxy rules and route UDP traffic as direct connection instead. This limitation does not affect UDP rules with BLOCK or DIRECT actions.