XPost: alt.comp.os.windows-11, alt.msdos.batch
From:
marionf@fact.com
Below is a working Windows custom proxy client I built over the past month.
If you use the same paths & freeware that I'm using, then I see no reason
it wouldn't work for you, out of the box, after you install these tools:
Psiphon freeware: (encrypted socks5 proxy server to bypass censorship)
<
https://psiphon.ca/>
Name: psiphon3.exe
Size: 10402576 bytes (10158 KiB)
SHA256: DB1BAF76F0333F4743919A86F35037559F9E7DA7DF14982DFC16FB8DC0BE6BE2
Mongoose freeware: (single-binary lightweight local http/https server)
<
https://mongoose.ws/binary/>
Name: mongoose.exe
Size: 110592 bytes (108 KiB)
SHA256: 7F0BE618842767D9C83D9607139334F454447FDF822A5404DC9AC7EDFCAB856B
Specifically only these external freeware executables are currently used:
psiphon3.exe (acts as the SOCKS5 proxy engine)
mongoose.vbs (serves the proxy.pac file via HTTP)
While these built-in Windows tools & commands are used in the script:
curl.exe (verifies the custom PAC file is available)
cscript.exe (runs the mongoose setup & launching VBScript)
net session ( checks if the script is running with admin rights)
powershell.exe -Verb RunAs (requests UAC elevation if needed)
netsh.exe (imports & syncs proxy settings from WinINet into WinHTTP)
reg.exe (writes registry values for AutoConfigURL and AutoDetect)
Tutorial:
Build a one-click Windows custom SOCKS5 proxy client using freeware
I've been building a privacy-focused proxy client for about a month which
has been a sudden deep dive into areas I hadn't touched in decades.
I hadn't seriously looked at proxies since around 2001, back when tools
like Proxifier were used to route traffic through TOR manually,
long before the Tor Browser bundled everything into a single click.
Back then, you'd launch TOR as a background service, configure Proxifier to redirect specific apps through a local SOCKS port and hope nothing leaked outside the tunnel.
Fast-forward to now and proxy configuration in Windows has become a multi-headed beast, with multiple API & networking stacks to deal with.
Modern Windows environments don't rely on a single unified proxy setting. Instead, they use multiple proxy stacks, each serving different types of applications and services. That means if you want consistent behavior
across browsers, system services, and modern apps, you can't just set a
proxy once and expect it to work everywhere.
Unfortunately, if you want it to be a single push-button (which is how I do everything, even clicking browser cookie-delete buttons automatically), you need scripts that interact with the registry, manipulate system settings,
and coordinate across stacks to make proxy setup a one-click operation.
On my Windows 10 Pro box, typical proxy settings live in places like:
a. Win+I > Settings > Network & Internet > Proxy
b. Win+R > control > Internet Options > Connections > LAN Settings
c. And Group Policy or registry edits for deeper control
Windows doesn't use a single unified proxy configuration. Instead, it has multiple proxy stacks, each used by different types of applications.
1. WinINet Stack
2. WinHTTP Stack
3. WPAD + PAC Files (used for auto-discovery and dynamic proxy logic)
4. Modern App Stack (Windows Runtime / UWP)
5. Custom Proxy Clients (scripts that can also bypass Windows stacks)
Examples of how these stacks are used:
a. WinINet is used by Internet Explorer and Chrome
b. WinHTTP is what Windows Update relies on
c. WPAD and PAC files are used by WinINet apps like Chrome & Firefox
d. UWP apps like Microsoft Store & Mail use the Modern App Stack
e. Tools like Proxifier, SocksCap, FreeCap, WideCap, ProxyCap,
SocksEscort, ShadowSocks, Psiphon, or in my case, a custom batch
script can act as freeware custom proxy clients on Windows 10.
For this tutorial, a custom proxy client can be any tool or script that:
A. Launches or manages a proxy service
B. Configures system or app-level proxy settings
C. Handles traffic & proxy logic independently of Windows' built-in stacks
Below is an example of my own script-driven proxy client which...
A. Bridges Psiphon with Windows proxy stacks,
B. Serves & applies PAC logic (with CoPilot, GMail & Amazon Vine bypass),
C. Syncs across WinINet & WinHTTP proxy stacks,
D. and handles Admin elevation (e.g., for regedits) & status logging.
These are a half dozen actions that the custom proxy client does...
1. Launches a freeware SOCKS5 proxy engine (Psiphon in SOCKS mode)
2. Serves a custom PAC file over HTTP/HTTPS before launching Psiphon
3. Applies proxy logic once Psiphon is running
4. Syncs proxy settings across stacks (WinINet > WinHTTP)
5. Handles elevation & logging if not already running as admin
6. Keeps the shell open so we can see what happened
Specifically, in my Windows 10 environment, the script below...
1. Starts psiphon3.exe in SOCKS mode which provides a local SOCKS5
proxy tunnel, which apps can use to route traffic through
Psiphon's encrypted network.
2. Runs mongoose.vbs to serve a proxy.pac file over HTTP at
http://127.0.0.1/proxy.pac. It waits a couple seconds,
then uses curl to verify the PAC file is actually available
before continuing.
3. Calls pac.cmd, which sets up the system to use the PAC file.
It also directly sets the PAC URL and enables Auto-Detect
in the registry under:
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
4. Runs "netsh winhttp import proxy source=ie" which copies the
static proxy settings from WinINet into WinHTTP
Note: It smartly avoids transferring SOCKS or PAC logic
to WinHTTP, since WinHTTP doesn't support those.
5. Relaunches itself with UAC elevation & logs activity to proxy.log,
including timestamps when PAC logic is triggered.
6. Pauses at the end so you can see what happened.
I'm sure there will be improvements, but here's the current status after
using it for about a month (ever since Epic Privacy Browser went bust).
::START: You type Win+R -> psiphon
:: |
:: v
::psiphon.bat
:: - Check if running as admin
:: - If not, request UAC elevation and restart
:: - Launch mongoose.vbs to serve proxy.pac (moved earlier in v1.8)
:: - Wait 2 seconds for Mongoose to initialize (added in v1.8)
:: - Echo "waiting for mongoose..." during delay (added in v1.9)
:: - Verify PAC file is accessible via curl (added in v1.8)
:: - Launch psiphon3.exe in SOCKS mode
:: - Wait 5 seconds for Psiphon to initialize
:: - Log that pac.cmd is being run
:: - Call pac.cmd /silent
:: |
:: v
:: pac.cmd
:: - Log run
:: - Run proxy.cmd /sync to align WinINET -> WinHTTP
:: - Capture current PAC URL and Auto-Detect status
:: - If missing or wrong, call proxy.cmd with PAC URL
:: - Force set PAC URL and Auto-Detect in registry
:: - Re-capture status so final display is accurate
:: - Show final PAC and Auto-Detect status
:: - Return to psiphon.bat
:: - Force set PAC URL and Auto-Detect again (double guarantee)
:: - Pause for user to see output
:: - Exit without closing parent shell
::END
Here's my main custom proxy client script, verbatim, using my own paths, so please realize this is a working script that I use every day to perform the actions above on my Windows 10 Pro Pc. Note that I will necessarily need to send the companion scripts separately since this is already a long post.
@echo off
REM C:\data\sys\batch\psiphon.bat version 1.0 20250819
REM This is psiphon.bat version 2.1 (118 lines)
REM Runs "C:\app\network\psiphon\psiphon3.exe" -mode=socks
REM This method leaves windows open.
REM %comspec% /k C:\app\network\psiphon\psiphon3.exe -mode=socks
REM This method closes windows.
REM psiphon.bat version 1.1 20250916
REM Added automatic PAC sync/apply after Psiphon launch
REM psiphon.bat version 1.2 20250916
REM Added logging to proxy.log when PAC is triggered from psiphon
REM psiphon.bat version 1.3 20250916
REM Added optional pause for viewing output before closing
REM psiphon.bat version 1.4 20250916
REM Changed to never close parent cmd window and always pause at end
REM psiphon.bat version 1.5 20250916
REM Added self-elevation to request UAC if not already admin
REM psiphon.bat version 1.6 20250916
REM Added final PAC URL + Auto-Detect set to ensure persistence
REM after Psiphon/proxy changes
REM psiphon.bat version 1.7 20250917
REM Added launch of mongoose.vbs to serve proxy.pac before PAC logic
REM psiphon.bat version 1.8 20250917
REM Reordered launch sequence: Mongoose now starts BEFORE Psiphon
REM Added PAC availability check using curl
REM Added 2-second wait after Mongoose launch to ensure readiness
REM psiphon.bat version 1.9 20250917
REM Error: PAC file not available. Aborting. Press any key to continue
REM Increased delay from 2 to 4 to give Mongoose more time to bind & serve
REM psiphon.bat version 2.0 20250917 (111 lines)
REM Decreased delay back to 2 as it didn't make a difference
REM Added echo message during Mongoose wait to indicate progress
REM psiphon.bat version 2.1 20250917 (118 lines)
REM Expanded Psiphon˘s reach to WinHTTP apps without compromising WinINET
apps
REM By adding Automatic Sync of WinINET to WinHTTP (e.g., for Windows
Update)
REM Transfers only the Psiphon-injected static HTTP/HTTPS proxy address
REM Does not transfer PAC logic and SOCKS settings from WinInet to WinHTTP
:: --- Elevate to admin if not already ---
nul 2>&1 net session
if %errorlevel% neq 0 (
echo Requesting administrative privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
REM Launch Mongoose silently to serve proxy.pac
cscript //nologo "C:\data\sys\batch\launchmongoose.vbs"
REM Wait for Mongoose to initialize (added in v1.8)
echo waiting for mongoose... (added in v2.0)
timeout /t 2 /nobreak >nul
REM Verify PAC file is available before proceeding (added in v1.8)
curl --silent --fail
http://127.0.0.1/proxy.pac >nul || (
echo PAC file not available. Aborting.
pause
exit /b
)
REM Launch Psiphon in SOCKS mode
start "" /D "C:\app\network\psiphon" psiphon3.exe -mode=socks
REM Wait a few seconds for Psiphon to initialize
timeout /t 5 /nobreak >nul
REM Log that PAC is being run from psiphon
echo [%DATE% %TIME%] pac.cmd triggered from psiphon.bat >> C:\data\sys\log\proxy.log
REM Apply PAC logic automatically (silent mode)
call "C:\data\sys\batch\pac.cmd" /silent
REM Force PAC URL and Auto-Detect to desired values at the very end
REM This ensures Psiphon or proxy sync cannot leave them unset
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v AutoConfigURL /t REG_SZ /d
http://127.0.0.1/proxy.pac /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v AutoDetect /t REG_DWORD /d 1 /f >nul
REM Sync WinINET proxy settings into WinHTTP (added in v2.1)
netsh winhttp import proxy source=ie
REM Always pause so you can see output if run from a console
echo.
echo Press any key to close...
pause >nul
REM End batch without killing the shell
exit /b
Note that I will post working companion scripts following this overview.
--
Kindly donated to the Usenet community, as always, for others to benefit.
--- SoupGate-Linux v1.05
* Origin: Dragon's Lair ---:- FidoNet<>Usenet Gateway -:--- (3:633/10)