Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
update readme
Sourav Kalal6c54b7bd02ba
diff --git a/README.md b/README.mdindex 9d50e96..ce450e2 100644--- a/README.md+++ b/README.md@@ -151,16 +151,26 @@ ProxyBridge_CLI -hProxyBridge_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=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 "chrome.exe=block"+ProxyBridge_CLI --rule "malware.exe:*:*:BOTH:BLOCK"# Route specific apps through proxy, block everything else-ProxyBridge_CLI --rule "chrome.exe=proxy;firefox.exe=proxy;*=block"+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 "*=proxy;BurpSuiteCommunity.exe=direct"+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"+```@@ -216,19 +226,29 @@ Commands:```-#### Rule Examples+#### Rule Format++**Format:** `process:hosts:ports:protocol:action`++- **process** - Process name(s): `chrome.exe`, `chrome.exe;firefox.exe`, `steam*.exe`, or `*`+- **hosts** - Target IP/hostname(s): `*`, `192.168.1.1`, `192.168.*.*`, `10.10.1.1-10.10.255.255`, or `192.168.1.1;10.10.10.10`+- **ports** - Target port(s): `*`, `443`, `80;443;8080`, `80-8000`, or `80;443;8000-9000`+- **protocol** - `TCP`, `UDP`, or `BOTH`+- **action** - `PROXY`, `DIRECT`, or `BLOCK`++**Examples:**```powershell-# Single process rule---rule "chrome.exe=proxy"+# Single process to proxy+--rule "chrome.exe:*:*:TCP:PROXY"-# Multiple processes with different actions---rule "chrome.exe=proxy;firefox.exe=direct;malware.exe=block"+# Multiple processes in one rule+--rule "chrome.exe;firefox.exe;steam*.exe:*:*:TCP:PROXY"-# Default action for all unmatched processes---rule "chrome.exe=proxy;*=direct"+# Target specific IPs and ports+--rule "chrome.exe:192.168.*;10.10.*.*:80;443;8080:TCP:PROXY"-# Whitelist approach (block everything except specific apps)---rule "chrome.exe=proxy;firefox.exe=proxy;*=block"+# Allow direct connection (bypass proxy)+--rule "BurpSuiteCommunity.exe:*:*:TCP:DIRECT"```**Notes:**diff --git a/cli/Program.cs b/cli/Program.csindex 5702d25..975e661 100644--- a/cli/Program.cs+++ b/cli/Program.cs@@ -25,15 +25,16 @@ class Programname: "--rule",description: "Traffic routing rule (multiple values supported, can repeat)\n" +"Format: process:hosts:ports:protocol:action\n" +- " process - Process name(s): chrome.exe, chr*.exe, *.exe, or *\n" +- " hosts - IP/host(s): *, google.com, 192.168.*.*, or multiple comma-separated\n" +- " ports - Port(s): *, 443, 80,443, 80-100, or multiple comma-separated\n" ++ " process - Process name(s): chrome.exe, chr*.exe, *.exe, or * (use ; for multiple: chrome.exe;firefox.exe)\n" ++ " hosts - IP/host(s): *, google.com, 192.168.*.*, or multiple separated by ; or ,\n" ++ " ports - Port(s): *, 443, 80;8080, 80-100, or multiple separated by ; or ,\n" +" protocol - TCP, UDP, or BOTH\n" +" action - PROXY, DIRECT, or BLOCK\n" +"Examples:\n" +" chrome.exe:*:*:TCP:PROXY\n" ++ " chrome.exe;firefox.exe:*:*:TCP:PROXY\n" +" *:*:53:UDP:PROXY\n" +- " firefox.exe:*:80,443:TCP:DIRECT")+ " firefox.exe:*:80;443:TCP:DIRECT"){AllowMultipleArgumentsPerToken = false,Arity = ArgumentArity.ZeroOrMore@@ -245,18 +246,25 @@ class Programforeach (var rule in rules){+ // Split by colon, but limit to 5 parts to allow colons in other fields if neededvar parts = rule.Split(':', 5);if (parts.Length != 5){throw new ArgumentException($"Invalid rule format: {rule}\nExpected format: process:hosts:ports:protocol:action");}+ // Don't trim semicolons - they are valid separators for multiple valuesvar processName = parts[0].Trim();var targetHosts = parts[1].Trim();var targetPorts = parts[2].Trim();var protocolStr = parts[3].Trim().ToUpper();var actionStr = parts[4].Trim().ToUpper();+ // Handle empty fields - use "*" as default+ if (string.IsNullOrWhiteSpace(processName)) processName = "*";+ if (string.IsNullOrWhiteSpace(targetHosts)) targetHosts = "*";+ if (string.IsNullOrWhiteSpace(targetPorts)) targetPorts = "*";+var protocol = protocolStr switch{"TCP" => ProxyBridgeNative.RuleProtocol.TCP,