### Manual Installation Steps (Bash) Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Steps for manual installation from a downloaded release archive, including extraction and running the setup script. ```bash tar -xzf ProxyBridge-Linux-vX.X.X.tar.gz cd ProxyBridge-Linux-vX.X.X sudo ./setup.sh ``` -------------------------------- ### Install ProxyBridge Binaries Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Installs the compiled ProxyBridge library and applications to system paths using the setup script. Ensures the shared library is accessible and executables are in the PATH. ```bash sudo ./setup.sh ``` -------------------------------- ### Simple Proxy Configuration and Rule Setup (C API) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This C API example illustrates the basic steps for configuring a proxy and setting up routing rules. It's a foundational snippet for developers integrating ProxyBridge into C applications. ```c #include int main() { // Initialize ProxyBridge pb_init(); // Configure a simple HTTP proxy pb_proxy_config_t proxy_cfg = { .type = PB_PROXY_HTTP, .address = "127.0.0.1", .port = 8080 }; pb_add_proxy(&proxy_cfg); // Add a basic routing rule pb_rule_t rule = { .protocol = PB_RULE_TCP, .destination_port = 80, .action = PB_RULE_ROUTE }; pb_add_rule(&rule); // Start ProxyBridge pb_start(); // ... application logic ... // Stop ProxyBridge pb_stop(); pb_shutdown(); return 0; } ``` -------------------------------- ### Example CLI Session Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/cli-reference.md Demonstrates a typical ProxyBridge CLI session, including loading a profile, starting the proxy service, and handling connections. Press Ctrl+C to stop the service gracefully. ```bash C:\> ProxyBridge_CLI.exe --profile config.pbprofile --verbose 2 Loading profile: config.pbprofile Proxy configs : 2 Rules : 5 Loading ProxyBridgeCore.dll... DLL loaded. Proxy configurations: [1] HTTP proxy.example.com:8080 (id=1) [2] SOCKS5 socks.example.com:1080 (id=2) Rules: [1] chrome.exe *.google.com 443 TCP PROXY [2] firefox.exe * * BOTH BLOCK [3] * 127.0.0.1 * BOTH DIRECT [4] python.exe example.com 80,443,8000-9000 TCP PROXY [5] notepad.exe 192.168.1.1 * BOTH DIRECT [disabled] 5 added, 0 failed Starting ProxyBridge... ProxyBridge is running. Press Ctrl+C to stop. [CONN] chrome.exe (PID:8192) -> 142.251.41.14:443 via 192.168.1.1:8080 HTTP [CONN] python.exe (PID:5432) -> 93.184.216.34:443 via socks.example.com:1080 SOCKS5 ^C Stopping ProxyBridge... ProxyBridge stopped. ``` -------------------------------- ### C API: Add Proxy and Rule, Start ProxyBridge Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md This C code example demonstrates programmatic integration with ProxyBridge. It shows how to add an HTTP proxy configuration and a routing rule using the C API, then starts and stops the ProxyBridge service. Ensure ProxyBridgeCore.dll is accessible and link against it during compilation. ```c #include #include "ProxyBridge.h" int main(void) { // Add HTTP proxy UINT32 proxy_id = ProxyBridge_AddProxyConfig( PROXY_TYPE_HTTP, "proxy.example.com", 8080, "username", "password" ); if (proxy_id == 0) { printf("Failed to add proxy\n"); return 1; } printf("Added proxy with ID: %u\n", proxy_id); // Add rule: route chrome HTTPS through proxy UINT32 rule_id = ProxyBridge_AddRule( "chrome.exe", "*", "443", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY, proxy_id ); if (rule_id == 0) { printf("Failed to add rule\n"); return 1; } printf("Added rule with ID: %u\n", rule_id); // Start ProxyBridge if (!ProxyBridge_Start()) { printf("Failed to start ProxyBridge\n"); return 1; } printf("ProxyBridge started. Press Enter to stop...\n"); getchar(); // Stop ProxyBridge_Stop(); printf("ProxyBridge stopped\n"); return 0; } ``` ```bash gcc example.c -o example.exe -lProxyBridgeCore ``` -------------------------------- ### Linux Integration Example (C API) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This C API example provides a basic setup for integrating ProxyBridge on Linux using Netfilter NFQUEUE. It highlights platform-specific considerations for Linux environments. ```c #include int main() { pb_init(); // Linux specific configuration might be needed here, // e.g., setting up NFQUEUE binding if not done via iptables. // For simplicity, assuming iptables is pre-configured. pb_proxy_config_t proxy_cfg = { .type = PB_PROXY_HTTP, .address = "127.0.0.1", .port = 3128 }; pb_add_proxy(&proxy_cfg); pb_rule_t rule = { .protocol = PB_RULE_TCP, .destination_port = 80, .action = PB_RULE_ROUTE }; pb_add_rule(&rule); pb_start(); // ... application logic ... pb_stop(); pb_shutdown(); return 0; } ``` -------------------------------- ### Localhost HTTP Proxy Configuration Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md Example of a local HTTP proxy configuration. ```json { "Id": 3, "Type": "HTTP", "Host": "localhost", "Port": "3128", "Username": "", "Password": "" } ``` -------------------------------- ### Manual Installation of ProxyBridge Binaries Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Manually copies the compiled ProxyBridge library and executables to standard system locations and updates the dynamic linker cache. Use if the setup script is not preferred. ```bash sudo cp output/libproxybridge.so /usr/local/lib/ sudo cp output/ProxyBridge /usr/local/bin/ sudo cp output/ProxyBridgeGUI /usr/local/bin/ # If GUI was built sudo ldconfig ``` -------------------------------- ### Proxy Rule Configuration Examples Source: https://github.com/interceptsuite/proxybridge/blob/master/MacOS/README.md Examples of rule definitions for blocking, proxying, or allowing direct connections based on package names and protocols. ```text Package Name: com.example.app IP/Hostname: (empty) Port: (empty) Protocol: Both Action: BLOCK ``` ```text Package Name: com.google.Chrome IP/Hostname: (empty) Port: (empty) Protocol: TCP Action: PROXY ``` ```text Package Name: (empty) IP/Hostname: trusted.example.com Port: 443 Protocol: TCP Action: DIRECT ``` ```text Package Name: com.example.voipapp IP/Hostname: (ignored for UDP) Port: (ignored for UDP) Protocol: UDP Action: PROXY ``` -------------------------------- ### Linux ProxyBridge Integration Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md Demonstrates how to set up ProxyBridge on Linux, including proxy configuration, DNS settings, callbacks, and rule management. This example requires root privileges to run. ```c #include #include #include #include #include "ProxyBridge.h" static volatile bool running = true; void signal_handler(int sig) { running = false; } void log_handler(const char* message) { fprintf(stderr, "[LOG] %s\n", message); } void connection_handler( const char* process_name, uint32_t pid, const char* dest_ip, uint16_t dest_port, const char* proxy_info ) { printf("[CONN] %s (PID:%u) -> %s:%u via %s\n", process_name, pid, dest_ip, (unsigned)dest_port, proxy_info); fflush(stdout); } int main(void) { signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); // Set single proxy (Linux mode) if (!ProxyBridge_SetProxyConfig( PROXY_TYPE_SOCKS5, "127.0.0.1", 1080, "", "" )) { fprintf(stderr, "Failed to set proxy\n"); return 1; } // Enable DNS through proxy ProxyBridge_SetDnsViaProxy(true); // Set callbacks ProxyBridge_SetLogCallback(log_handler); ProxyBridge_SetConnectionCallback(connection_handler); // Add rules uint32_t rule1 = ProxyBridge_AddRule( "curl", "*", "80,443", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY ); uint32_t rule2 = ProxyBridge_AddRule( "*", "127.0.0.1", "*", RULE_PROTOCOL_BOTH, RULE_ACTION_DIRECT ); if (!ProxyBridge_Start()) { fprintf(stderr, "Failed to start ProxyBridge\n"); return 1; } printf("ProxyBridge running on Linux (PID:%d)\n", getpid()); printf("Press Ctrl+C to stop...\n"); while (running) { sleep(1); } printf("\nStopping ProxyBridge...\n"); ProxyBridge_Stop(); return 0; } ``` ```bash gcc -o example example.c -lproxybridge sudo ./example ``` -------------------------------- ### Create PKG Installer Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Executes the build.sh script to create a PKG installer from the exported ProxyBridge.app. Ensure the .app is in the output directory first. ```bash ./build.sh ``` -------------------------------- ### HTTP Proxy Configuration Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md Example of an HTTP proxy configuration, including domain-escaped username and password. ```json { "Id": 1, "Type": "HTTP", "Host": "proxy.corp.example.com", "Port": "8080", "Username": "domain\user", "Password": "secure_password" } ``` -------------------------------- ### SOCKS5 Proxy Configuration Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md Example of a SOCKS5 proxy configuration with no username or password. ```json { "Id": 2, "Type": "SOCKS5", "Host": "192.168.1.100", "Port": "1080", "Username": "", "Password": "" } ``` -------------------------------- ### Clone and Setup macOS Repository Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Clone the development branch of the repository and navigate to the macOS project directory. ```bash # Clone the repository (dev branch) git clone -b dev https://github.com/InterceptSuite/ProxyBridge.git cd ProxyBridge/MacOS/ProxyBridge ``` -------------------------------- ### ProxyBridge CLI Usage Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/types.md Example command for running the ProxyBridge CLI with a specified profile and verbosity level. This demonstrates how to apply a configuration profile to the command-line tool. ```bash ProxyBridge_CLI.exe --profile config.pbprofile --verbose 3 ``` -------------------------------- ### Start ProxyBridge Engine Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/api-proxy-bridge-core.md Starts the proxy routing engine. Ensure all configurations are set before calling. Requires administrator/root privileges and the kernel driver to be available. Returns TRUE on success, FALSE on failure. ```c BOOL ProxyBridge_Start(void); ``` ```c if (ProxyBridge_Start()) { printf("ProxyBridge started successfully\n"); } else { printf("Failed to start ProxyBridge\n"); return 1; } ``` -------------------------------- ### Install ProxyBridge with One Command (Bash) Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Use this command to automatically download, install dependencies, and set up ProxyBridge on supported Linux distributions. ```bash curl -Lo deploy.sh https://raw.githubusercontent.com/InterceptSuite/ProxyBridge/refs/heads/master/Linux/deploy.sh && sudo bash deploy.sh ``` -------------------------------- ### Configure Multiple Proxies Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md Illustrates how to set up and use multiple proxy configurations simultaneously. This example defines an HTTP and a SOCKS5 proxy, then routes traffic from different applications to their respective proxies, and blocks another application. ```c #include #include "ProxyBridge.h" int main(void) { // Add multiple proxy configurations UINT32 http_proxy = ProxyBridge_AddProxyConfig( PROXY_TYPE_HTTP, "proxy-http.example.com", 8080, "", "" ); UINT32 socks5_proxy = ProxyBridge_AddProxyConfig( PROXY_TYPE_SOCKS5, "proxy-socks.example.com", 1080, "user", "pass" ); if (http_proxy == 0 || socks5_proxy == 0) { printf("Failed to add proxies\n"); return 1; } // Route different apps to different proxies UINT32 rule1 = ProxyBridge_AddRule( "chrome.exe", "*", "443", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY, http_proxy ); UINT32 rule2 = ProxyBridge_AddRule( "python.exe", "*", "*", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY, socks5_proxy ); UINT32 rule3 = ProxyBridge_AddRule( "notepad.exe", "*", "*", RULE_PROTOCOL_BOTH, RULE_ACTION_BLOCK, 0 ); ProxyBridge_Start(); printf("Running with multiple proxies:\n"); printf(" chrome.exe -> HTTP proxy (%u)\n", http_proxy); printf(" python.exe -> SOCKS5 proxy (%u)\n", socks5_proxy); printf(" notepad.exe -> BLOCKED\n"); printf("Press Enter to stop...\n"); getchar(); ProxyBridge_Stop(); return 0; } ``` -------------------------------- ### Rule Format: Wildcard Process Names Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example rule using a wildcard to proxy TCP traffic from any process name starting with 'fire' (e.g., 'firefox', 'firebird'). ```bash --rule "fire*:*:*:TCP:PROXY" ``` -------------------------------- ### Connection Handler Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/types.md An example implementation of a connection handler function that prints connection details. This function can be registered using ProxyBridge_SetConnectionCallback(). ```c void connection_handler(const char* proc, DWORD pid, const char* ip, UINT16 port, const char* proxy_info) { printf("[%s:%u] %s -> %s:%u via %s\n", proc, (unsigned)pid, "connection", ip, (unsigned)port, proxy_info); } ProxyBridge_SetConnectionCallback(connection_handler); ``` -------------------------------- ### Install ProxyBridge CLI Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/cli-reference.md Installs ProxyBridge using a one-command script or by extracting a TAR.GZ release. Requires root privileges for deployment. ```bash curl -Lo deploy.sh https://raw.githubusercontent.com/InterceptSuite/ProxyBridge/refs/heads/master/Linux/deploy.sh && sudo bash deploy.sh ``` ```bash tar xzf ProxyBridge-linux.tar.gz cd ProxyBridge sudo ./deploy.sh ``` -------------------------------- ### Implement ProxySettingsViewModel in C# Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Example of C# code following .NET naming conventions and asynchronous patterns. ```csharp // Follow .NET naming conventions public class ProxySettingsViewModel : ViewModelBase { private string _proxyHost = "127.0.0.1"; // Properties use PascalCase public string ProxyHost { get => _proxyHost; set => this.RaiseAndSetIfChanged(ref _proxyHost, value); } // Methods use PascalCase public async Task SaveSettingsAsync() { // Use meaningful names var settings = new ProxySettings { ProxyHost = ProxyHost, ProxyPort = ProxyPort }; await _configManager.SaveAsync(settings); } } ``` -------------------------------- ### Windows Multi-Proxy Support Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/platform-implementations.md Demonstrates how to add multiple proxy configurations and assign rules to specific proxies in the Windows implementation. It also touches upon the fallback behavior when a proxy ID of 0 is used. ```APIDOC ## Windows Multi-Proxy Support ### Description This section illustrates the capability to manage multiple proxy configurations simultaneously on Windows and how to direct traffic through them using rules. It also explains the fallback mechanism for proxy selection. ### Usage - Supports up to 16 simultaneous proxy configurations. - Rules can be associated with specific proxy configurations by their ID. - Using a `proxy_config_id` of 0 allows for fallback to the first available proxy. ### Code Example ```c // Add multiple proxies UINT32 http_config = ProxyBridge_AddProxyConfig(2, "proxy1.com", 8080, "", ""); // PROXY_TYPE_HTTP UINT32 socks5_config = ProxyBridge_AddProxyConfig(3, "proxy2.com", 1080, "", ""); // PROXY_TYPE_SOCKS5 // Route rules to different proxies // Assuming RULE_ACTION_PROXY is defined UINT32 rule1 = ProxyBridge_AddRule("chrome.exe", "*", "443", 1, 1, http_config); // RULE_PROTOCOL_TCP, RULE_ACTION_PROXY UINT32 rule2 = ProxyBridge_AddRule("firefox.exe", "*", "80,443", 1, 1, socks5_config); // RULE_PROTOCOL_TCP, RULE_ACTION_PROXY // Example of fallback behavior (using proxy_config_id = 0) // UINT32 rule3 = ProxyBridge_AddRule("other.exe", "*", "*", 0, 1, 0); // Use first available proxy ``` ### Proxy Fallback - When `proxy_config_id` is 0, the system attempts to use the first available proxy configuration. - This behavior is useful for establishing a default proxy without needing to know its specific ID. - Rules can be edited to use this fallback mechanism, simplifying management. ``` -------------------------------- ### Manage Rules Dynamically Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md Demonstrates how to dynamically manage network rules. This example shows adding an initial rule, disabling it, re-enabling it, and then editing it to block all traffic. ```c #include #include #include "ProxyBridge.h" int main(void) { // Add proxy UINT32 proxy_id = ProxyBridge_AddProxyConfig( PROXY_TYPE_HTTP, "proxy.example.com", 8080, "", "" ); // Add initial rule UINT32 rule_id = ProxyBridge_AddRule( "chrome.exe", "*", "80,443", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY, proxy_id ); ProxyBridge_Start(); printf("Rule #1 enabled. Press Enter to disable...\n"); getchar(); // Disable rule temporarily ProxyBridge_DisableRule(rule_id); printf("Rule #1 disabled. Press Enter to enable...\n"); getchar(); // Re-enable rule ProxyBridge_EnableRule(rule_id); printf("Rule #1 enabled. Press Enter to edit...\n"); getchar(); // Edit rule: change action to BLOCK ProxyBridge_EditRule( rule_id, "chrome.exe", "*", "*", RULE_PROTOCOL_BOTH, RULE_ACTION_BLOCK, 0 ); printf("Rule #1 changed to BLOCK all traffic. Press Enter to stop...\n"); getchar(); ProxyBridge_Stop(); ProxyBridge_DeleteRule(rule_id); ProxyBridge_DeleteProxyConfig(proxy_id); return 0; } ``` -------------------------------- ### Configure a Single Proxy Server (Linux) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/api-proxy-bridge-core.md Sets up a single proxy server configuration. Use this for basic proxy setup on Linux. Authentication details are optional. ```c bool ProxyBridge_SetProxyConfig( ProxyType type, const char* proxy_ip, uint16_t proxy_port, const char* username, const char* password ); ``` -------------------------------- ### Route Chrome Through HTTP Proxy (Windows CLI) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example demonstrates how to configure ProxyBridge via the command-line interface on Windows to route Chrome's traffic through an HTTP proxy. It's useful for quick setup and testing proxy functionality for specific applications. ```bash proxybridge.exe --config proxy.json --profile chrome.json ``` -------------------------------- ### Logging and Connection Tracking with Callbacks (C API) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This C API example demonstrates how to set up logging and connection tracking using callback functions. It's essential for monitoring traffic and debugging integration issues. ```c #include #include void log_callback(const char* message) { printf("[ProxyBridge Log] %s\n", message); } void connection_callback(pb_connection_info_t* info) { printf("Connection established: %s:%d -> %s:%d\n", info->client_ip, info->client_port, info->proxy_address, info->proxy_port); } int main() { pb_init(); // Set callback functions pb_set_log_callback(log_callback); pb_set_connection_callback(connection_callback); // ... configure proxies and rules ... pb_start(); // ... pb_stop(); pb_shutdown(); return 0; } ``` -------------------------------- ### Linux API Example: Add Rule Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/platform-implementations.md Demonstrates adding a TCP rule for Chrome to proxy all traffic on port 443. This example assumes a single proxy mode and returns a rule ID. ```c // Linux API signature uint32_t ProxyBridge_AddRule( const char* process_name, const char* target_hosts, const char* target_ports, RuleProtocol protocol, RuleAction action ); // No proxy_config_id (single proxy mode) // Return value: uint32_t rule_id (0 = failure) uint32_t rule_id = ProxyBridge_AddRule( "chrome", "*", "443", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY ); ``` -------------------------------- ### Install Debian/Ubuntu Build Dependencies Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Installs essential packages for building ProxyBridge on Debian-based systems like Ubuntu and Mint. Includes compiler, build tools, and Netfilter/NFQUEUE development libraries. ```bash sudo apt-get update sudo apt-get install build-essential gcc make \ libnetfilter-queue-dev libnfnetlink-dev \ libgtk-3-dev pkg-config ``` -------------------------------- ### Install Fedora Build Dependencies Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Installs necessary packages for building ProxyBridge on Fedora. Includes compiler, build tools, and Netfilter/NFQUEUE development libraries. ```bash sudo dnf install gcc make \ libnetfilter_queue-devel libnfnetlink-devel \ gtk3-devel pkg-config ``` -------------------------------- ### Rule Format: Allow Direct Connection Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example rule to allow direct, non-proxied TCP connections for the 'burpsuite' process. ```bash --rule "burpsuite:*:*:TCP:DIRECT" ``` -------------------------------- ### Start ProxyBridge CLI on Windows Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/README.md Launch the ProxyBridge command-line interface on Windows with a specified profile and verbosity level. ```bash ProxyBridge_CLI.exe --profile config.pbprofile --verbose 2 ``` -------------------------------- ### Implement Proxy Rules in C/C++ Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Example of C code following Windows Core standards, including consistent formatting and null checks. ```c // Use clear, descriptive names static bool check_proxy_rules(const char *process, uint32_t dest_ip, uint16_t dest_port, uint8_t proto) { // Comments for complex logic if (!process || !dest_ip) return false; // Use consistent formatting for (int i = 0; i < rule_count; i++) { if (match_rule(&rules[i], process, dest_ip, dest_port, proto)) { return rules[i].action; } } return ACTION_DIRECT; } ``` -------------------------------- ### Launch ProxyBridge GUI (Bash) Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Command to launch the graphical user interface for ProxyBridge. Requires GTK3 to be installed. ```bash sudo ProxyBridgeGUI ``` -------------------------------- ### Example Rule: Block All Network Access Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md This rule blocks all network access originating from 'game.exe'. ```json { "ProcessName": "game.exe", "TargetHosts": "*", "TargetPorts": "*", "Protocol": "BOTH", "Action": "BLOCK", "ProxyConfigId": 0, "IsEnabled": true } ``` -------------------------------- ### Start ProxyBridge CLI on Linux Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/README.md Execute the ProxyBridge command-line interface on Linux using a configuration profile. ```bash sudo proxybridge_cli --config config.pbprofile ``` -------------------------------- ### Install Arch/Manjaro Build Dependencies Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Installs required packages for building ProxyBridge on Arch Linux and Manjaro. Includes base development tools and Netfilter/NFQUEUE libraries. ```bash sudo pacman -S base-devel gcc make \ libnetfilter_queue libnfnetlink \ gtk3 pkg-config ``` -------------------------------- ### Proxy Rule JSON Format Example Source: https://github.com/interceptsuite/proxybridge/blob/master/Windows/README.md Example structure for a JSON file used with the --rule-file option, defining process names, target hosts, ports, protocol, and action. ```json [{ "processNames": "chrome.exe", "targetHosts": "*", "targetPorts": "*", "protocol": "TCP", "action": "PROXY", "enabled": true }] ``` -------------------------------- ### Rule Format: Multiple Processes Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example rule to proxy all TCP traffic from 'curl', 'wget', and 'firefox' processes. ```bash --rule "curl;wget;firefox:*:*:TCP:PROXY" ``` -------------------------------- ### Example Valid Proxy Configuration Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/errors-diagnostics.md Demonstrates the structure of a correctly formatted JSON object for a proxy configuration. Ensure all fields like Id, Type, Host, and Port are valid. ```json { "Id": 1, "Type": "HTTP", "Host": "proxy.example.com", "Port": "8080", "Username": "", "Password": "" } ``` -------------------------------- ### ProxyBridge_Start Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/MANIFEST.txt Starts the ProxyBridge service. This function initializes the proxy engine and begins processing traffic according to configured rules. ```APIDOC ## ProxyBridge_Start ### Description Starts the ProxyBridge service. This function initializes the proxy engine and begins processing traffic according to configured rules. ### Method Not applicable (C/C++ function) ### Endpoint Not applicable (C/C++ function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c // Start the ProxyBridge service int result = ProxyBridge_Start(); if (result != 0) { // Handle error } ``` ### Response #### Success Response Returns 0 on success. A non-zero value indicates an error. #### Response Example ``` int result // 0 for success ``` ERROR HANDLING: - Returns a non-zero value on failure. Refer to errors-diagnostics.md for specific error codes. ``` -------------------------------- ### Connection Throughput Testing Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example provides guidance on testing the throughput of connections managed by ProxyBridge. It's useful for performance tuning and ensuring the proxy infrastructure can handle the expected load. ```bash # Use tools like iperf or similar to measure bandwidth. # Configure ProxyBridge to route the test traffic and observe results. ``` -------------------------------- ### Example Verbose Logging Output Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/errors-diagnostics.md Sample output from ProxyBridge CLI when running with verbose logging enabled (level 3), showing initialization logs and connection details. ```text [LOG] Initializing proxy engine [LOG] Loading rules into kernel driver [CONN] chrome.exe (PID:1234) -> 142.251.41.14:443 via 192.168.1.1:8080 HTTP [CONN] firefox.exe (PID:5678) -> 1.1.1.1:53 via DIRECT [LOG] Connection established ``` -------------------------------- ### ProxyBridge CLI Usage Examples Source: https://github.com/interceptsuite/proxybridge/blob/master/Windows/README.md Various command-line operations for configuring proxies, defining traffic rules, and managing connection logging. ```powershell # Help menu ProxyBridge_CLI -h # Use custom HTTP proxy ProxyBridge_CLI --proxy http://192.168.1.100:8080 # Route Chrome through socks5 proxy ProxyBridge_CLI --proxy socks5://127.0.0.1:1080 --rule "chrome.exe:*:*:TCP:PROXY" # Route multiple processes in single rule (semicolon-separated) ProxyBridge_CLI --proxy http://127.0.0.1:8080 --rule "chrome.exe;steam*.exe:*:*:TCP:PROXY" # Multiple rules with verbose connection logging ProxyBridge_CLI --proxy http://127.0.0.1:8080 --rule "chrome.exe;steam*.exe:*:*:TCP:PROXY" --rule "firefox.exe:*:*:TCP:PROXY" --verbose 2 # Block specific application from internet access ProxyBridge_CLI --rule "malware.exe:*:*:BOTH:BLOCK" # Route specific apps through proxy, block everything else ProxyBridge_CLI --rule "chrome.exe:*:*:TCP:PROXY" --rule "firefox.exe:*:*:TCP:PROXY" --rule "*:*:*:BOTH:BLOCK" # Route all through proxy except proxy app itself ProxyBridge_CLI --rule "*:*:*:TCP:PROXY" --rule "BurpSuiteCommunity.exe:*:*:TCP:DIRECT" # Target specific IPs and ports ProxyBridge_CLI --rule "chrome.exe:192.168.*.*;10.10.*.*:80;443;8080:TCP:PROXY" # Import rules from JSON file ProxyBridge_CLI --proxy socks5://127.0.0.1:1080 --rule-file C:\rules.json # Combine file-based rules with command-line rules ProxyBridge_CLI --rule-file C:\rules.json --rule "steam.exe:*:*:TCP:PROXY" ``` -------------------------------- ### Multiple Proxy Routing (C API) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This C API example demonstrates configuring and routing traffic through multiple proxies. It's applicable for load balancing, failover, or chaining proxies. ```c #include int main() { pb_init(); // Add first proxy pb_proxy_config_t proxy1 = { .type = PB_PROXY_HTTP, .address = "192.168.1.100", .port = 8080 }; int proxy1_id = pb_add_proxy(&proxy1); // Add second proxy pb_proxy_config_t proxy2 = { .type = PB_PROXY_SOCKS5, .address = "192.168.1.101", .port = 1080 }; int proxy2_id = pb_add_proxy(&proxy2); // Route traffic to proxy1 pb_rule_t rule1 = { .protocol = PB_RULE_TCP, .destination_port = 80, .action = PB_RULE_ROUTE, .proxy_id = proxy1_id }; pb_add_rule(&rule1); // Route different traffic to proxy2 pb_rule_t rule2 = { .protocol = PB_RULE_TCP, .destination_port = 443, .action = PB_RULE_ROUTE, .proxy_id = proxy2_id }; pb_add_rule(&rule2); pb_start(); // ... pb_stop(); pb_shutdown(); return 0; } ``` -------------------------------- ### Windows CLI: Basic Chrome Traffic Routing Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md This example demonstrates basic CLI usage for routing Chrome traffic through a specified HTTP proxy. It requires a profile file created via the GUI. ```bash ProxyBridge_CLI.exe --profile chrome.pbprofile --verbose 2 ``` ```text Loading profile: chrome.pbprofile Proxy configs : 1 Rules : 1 Loading ProxyBridgeCore.dll... DLL loaded. Proxy configurations: [1] HTTP proxy.example.com:8080 (id=1) Rules: [1] chrome.exe * 443 TCP PROXY 1 added, 0 failed Starting ProxyBridge... ProxyBridge is running. Press Ctrl+C to stop. [CONN] chrome.exe (PID:4156) -> 142.251.41.14:443 via 192.168.1.100:8080 HTTP [CONN] chrome.exe (PID:4156) -> 142.251.41.2:443 via 192.168.1.100:8080 HTTP ``` -------------------------------- ### Advanced Multi-Proxy Configuration (Windows CLI) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example shows an advanced Windows CLI configuration for ProxyBridge, enabling multi-proxy routing. It's suitable for scenarios requiring complex traffic management and failover strategies. ```bash proxybridge.exe --config multi_proxy.json --profile advanced.json ``` -------------------------------- ### Example Invalid Rule Output Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/errors-diagnostics.md Shows the console output when a rule fails to be added due to invalid configuration. This includes the rule details and a warning message indicating the failure. ```text [1] chrome.exe *.google.com 443 TCP PROXY [2] WARNING: Failed to add rule (invalid_process.exe) 3 added, 1 failed ``` -------------------------------- ### Monitor Profile Loading for Proxy Addition Failures Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/errors-diagnostics.md Example of console output indicating an error when a proxy configuration fails to be added, typically due to exceeding the maximum configuration limit or connection issues. ```text [1] ERROR: Failed to add HTTP proxy.example.com:8080 ``` -------------------------------- ### Check for and download updates Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/cli-reference.md Use the --update option to check for new versions on GitHub. The CLI will compare the current version with the latest release and prompt to download the installer if an update is available. ```bash ProxyBridge_CLI.exe --update ``` -------------------------------- ### Initialize macOS Configuration Directory Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Create the configuration directory for storing signing credentials. ```bash cd MacOS/ProxyBridge mkdir config ``` -------------------------------- ### Rule Matching Verification Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example details how to verify that ProxyBridge's routing rules are matching traffic as intended. It involves checking logs or using diagnostic tools to confirm which rules are being applied to specific connections. ```bash # Check ProxyBridge logs for rule matching information. # Example log entry might show: "Rule matched: TCP traffic to port 80 routed via proxy X." ``` -------------------------------- ### Verify Proxy Connectivity Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example outlines the steps to verify that ProxyBridge is correctly routing traffic through the configured proxies. It involves checking network connectivity and potentially using tools like `curl` or `ping`. ```bash # Example using curl to test connectivity through the proxy curl --proxy http://127.0.0.1:8080 http://example.com ``` -------------------------------- ### ProxyBridge Help Output Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Displays the available command-line options and usage instructions for ProxyBridge. Requires root privileges to run. ```bash sudo ProxyBridge --help ``` -------------------------------- ### Dynamic Rule Management (Enable/Disable/Edit) (C API) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This C API example shows how to dynamically manage routing rules after ProxyBridge has started, including enabling, disabling, and editing them. This is useful for runtime adjustments to traffic routing policies. ```c #include int main() { pb_init(); // ... configure initial proxies and rules ... pb_start(); // Assume rule_id is obtained from pb_add_rule() int rule_id = 1; // Disable a rule pb_disable_rule(rule_id); // Enable the rule again pb_enable_rule(rule_id); // Edit a rule (e.g., change destination port) pb_rule_t updated_rule = { .id = rule_id, .destination_port = 443 }; pb_edit_rule(&updated_rule); // ... pb_stop(); pb_shutdown(); return 0; } ``` -------------------------------- ### Define Commit Message Examples Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Examples of acceptable and unacceptable commit message styles for the project. ```text Good: ✅ Fix memory leak in connection table cleanup ✅ Add support for wildcard IP matching ✅ Update GUI to show connection count Bad: ❌ fix bug ❌ update ❌ wip ``` -------------------------------- ### ProxyBridge CLI Basic Usage Examples (Bash) Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Demonstrates various command-line options for ProxyBridge, including setting proxies, defining rules, enabling verbose logging, blocking traffic, and routing specific applications. ```bash # Help menu ProxyBridge --help ``` ```bash # Route curl through SOCKS5 proxy sudo ProxyBridge --proxy socks5://127.0.0.1:1080 --rule "curl:*:*:TCP:PROXY" ``` ```bash # Route multiple processes in single rule (semicolon-separated) sudo ProxyBridge --proxy http://127.0.0.1:8080 --rule "curl;wget;firefox:*:*:TCP:PROXY" ``` ```bash # Multiple rules with verbose connection logging sudo ProxyBridge --proxy http://127.0.0.1:8080 \ --rule "curl:*:*:TCP:PROXY" \ --rule "wget:*:*:TCP:PROXY" \ --verbose 2 ``` ```bash # Block specific application from internet access sudo ProxyBridge --rule "malware:*:*:BOTH:BLOCK" ``` ```bash # Route specific apps through proxy, block everything else sudo ProxyBridge --proxy socks5://127.0.0.1:1080 \ --rule "curl:*:*:TCP:PROXY" \ --rule "firefox:*:*:TCP:PROXY" \ --rule "*:*:*:BOTH:BLOCK" ``` ```bash # Route all through proxy except proxy app itself sudo ProxyBridge --proxy socks5://127.0.0.1:1080 \ --rule "*:*:*:TCP:PROXY" \ --rule "burpsuite:*:*:TCP:DIRECT" ``` ```bash # Target specific IPs and ports sudo ProxyBridge --proxy socks5://127.0.0.1:1080 \ --rule "curl:192.168.*.*;10.10.*.*:80;443;8080:TCP:PROXY" ``` ```bash # IP range support sudo ProxyBridge --proxy socks5://192.168.1.4:4444 \ --rule "curl:3.19.110.0-3.19.115.255:*:TCP:PROXY" ``` ```bash # Cleanup after crash (removes iptables rules) sudo ProxyBridge --cleanup ``` -------------------------------- ### Build ProxyBridge from Source Source: https://github.com/interceptsuite/proxybridge/blob/master/MacOS/README.md Commands to clone, open, build, and locate the ProxyBridge application. ```bash git clone https://github.com/InterceptSuite/ProxyBridge.git cd ProxyBridge/MacOS/ProxyBridge ``` ```bash open ProxyBridge.xcodeproj ``` ```bash xcodebuild -project ProxyBridge.xcodeproj -scheme ProxyBridge -configuration Release build ``` ```bash ~/Library/Developer/Xcode/DerivedData/ProxyBridge-*/Build/Products/Release/ProxyBridge.app ``` -------------------------------- ### Load and run a ProxyBridge profile configuration file Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/cli-reference.md Use the --profile option to specify the path to a .pbprofile file. The profile is parsed immediately, and the proxy runs until terminated. ```bash ProxyBridge_CLI.exe --profile C:\Users\user\myconfig.pbprofile ``` ```bash ProxyBridge_CLI.exe --profile ./config.pbprofile ``` -------------------------------- ### ProxyBridge_ClearConnectionLogs Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/MANIFEST.txt Clears all recorded connection logs. This is useful for freeing up memory or starting fresh logs. ```APIDOC ## ProxyBridge_ClearConnectionLogs ### Description Clears all recorded connection logs. This is useful for freeing up memory or starting fresh logs. ### Method Not applicable (C/C++ function) ### Endpoint Not applicable (C/C++ function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c // Clear all connection logs int result = ProxyBridge_ClearConnectionLogs(); if (result != 0) { // Handle error } ``` ### Response #### Success Response Returns 0 on success. A non-zero value indicates an error. #### Response Example ``` int result // 0 for success ``` ERROR HANDLING: - Returns a non-zero value on failure. Refer to errors-diagnostics.md for specific error codes. ``` -------------------------------- ### Open Xcode Project Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Opens the ProxyBridge Xcode project to begin the build process. ```bash open ProxyBridge.xcodeproj ``` -------------------------------- ### Example Rule: Allow All Localhost Traffic Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md This rule allows all traffic to localhost (127.0.0.1, ::1) to bypass the proxy. ```json { "ProcessName": "*", "TargetHosts": "127.0.0.1,::1", "TargetPorts": "*", "Protocol": "BOTH", "Action": "DIRECT", "ProxyConfigId": 0, "IsEnabled": true } ``` -------------------------------- ### Set up Logging and Connection Tracking Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/usage-examples.md Configure ProxyBridge to log messages and track active connections. This example shows how to set callback functions for logging and connection events, add a SOCKS5 proxy, and route all TCP traffic through it. ```c #include #include #include "ProxyBridge.h" // Global variable to track connection count static volatile LONG connection_count = 0; // Log callback function void log_callback(const char* message) { printf("[LOG] %s\n", message); } // Connection callback function void connection_callback( const char* process_name, DWORD pid, const char* dest_ip, UINT16 dest_port, const char* proxy_info ) { InterlockedIncrement(&connection_count); printf("[CONN] #%ld: %s (PID:%lu) -> %s:%u via %s\n", connection_count, process_name, (unsigned long)pid, dest_ip, (unsigned)dest_port, proxy_info); fflush(stdout); } int main(void) { // Set callbacks ProxyBridge_SetLogCallback(log_callback); ProxyBridge_SetConnectionCallback(connection_callback); ProxyBridge_SetTrafficLoggingEnabled(TRUE); // Add proxy UINT32 proxy_id = ProxyBridge_AddProxyConfig( PROXY_TYPE_SOCKS5, "127.0.0.1", 1080, "", "" ); if (proxy_id == 0) { printf("Failed to add proxy\n"); return 1; } // Add rules for all TCP traffic UINT32 rule_id = ProxyBridge_AddRule( "*", "*", "*", RULE_PROTOCOL_TCP, RULE_ACTION_PROXY, proxy_id ); if (!ProxyBridge_Start()) { printf("Failed to start ProxyBridge\n"); return 1; } printf("ProxyBridge running. Press Enter to stop...\n"); getchar(); printf("\nTotal connections tracked: %ld\n", (long)InterlockedCompareExchange(&connection_count, 0, 0)); ProxyBridge_Stop(); ProxyBridge_ClearConnectionLogs(); return 0; } ``` -------------------------------- ### Update WinDivert Path in compile.ps1 Source: https://github.com/interceptsuite/proxybridge/blob/master/CONTRIBUTING.md Modify the `$WinDivertPath` variable in the `compile.ps1` script if WinDivert is installed in a custom location. ```powershell $WinDivertPath = "C:\Your\Custom\Path\WinDivert-2.2.2-A" ``` -------------------------------- ### Display ProxyBridge Help Information Source: https://github.com/interceptsuite/proxybridge/blob/master/Windows/README.md Use the -h or --help flag to display all available command-line options and usage information for ProxyBridge. ```bash ProxyBridge_CLI.exe -h ``` -------------------------------- ### Setting a Log Callback Handler Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/types.md Example of how to implement and set a custom log handler for ProxyBridge. Ensure thread-safe logging implementation. ```c void log_handler(const char* message) { fprintf(stderr, "[ProxyBridge] %s\n", message); fflush(stderr); } ProxyBridge_SetLogCallback(log_handler); ``` -------------------------------- ### Basic ProxyBridge Usage with Rule Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example of basic ProxyBridge usage, routing TCP traffic from the 'curl' process through the default proxy. ```bash sudo ProxyBridge --rule curl:*:*:TCP:PROXY ``` -------------------------------- ### Verify WinDivert Driver Existence Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/errors-diagnostics.md Checks if the WinDivert64.sys kernel driver file is present in the current directory. Required for ProxyBridge to start. ```cmd dir WinDivert64.sys ``` -------------------------------- ### Latency Impact Measurement Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/INDEX.md This example describes how to measure the latency introduced by ProxyBridge. It's important for applications sensitive to network delays and for optimizing performance. ```bash # Use tools like ping or specialized latency testing utilities. # Measure latency with and without ProxyBridge active to quantify the impact. ``` -------------------------------- ### Profile Version Field Example Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md This JSON snippet shows the 'Version' field used to indicate the profile format version. The current version is 1.0. ```json { "Version": "1.0", ... } ``` -------------------------------- ### Example Rule: Route Chrome HTTPS Traffic Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/configuration.md This rule routes HTTPS traffic from Chrome to Google domains through proxy configuration ID 1. ```json { "ProcessName": "chrome.exe", "TargetHosts": "*.google.com,*.youtube.com", "TargetPorts": "443", "Protocol": "TCP", "Action": "PROXY", "ProxyConfigId": 1, "IsEnabled": true } ``` -------------------------------- ### Rule Format: IP Range Matching Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example rule to proxy TCP traffic from 'curl' to a specified range of IP addresses (3.19.110.0 to 3.19.115.255). ```bash --rule "curl:3.19.110.0-3.19.115.255:*:TCP:PROXY" ``` -------------------------------- ### Linux ProxyBridge Add Multiple Proxies (Windows Style) Source: https://github.com/interceptsuite/proxybridge/blob/master/_autodocs/platform-implementations.md Demonstrates how multiple proxy configurations would be added in a multi-proxy environment, contrasting with the single-proxy nature of the Linux implementation. ```c // Add multiple proxies UINT32 config1 = ProxyBridge_AddProxyConfig(...); UINT32 config2 = ProxyBridge_AddProxyConfig(...); ``` -------------------------------- ### Rule Format: Single Process to Proxy Source: https://github.com/interceptsuite/proxybridge/blob/master/Linux/README.md Example rule to proxy all TCP traffic from the 'curl' process. Uses '*' for hosts, ports, and protocol to match any. ```bash --rule "curl:*:*:TCP:PROXY" ```