Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #187789

Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware

From Marion <marionf@fact.com>
Newsgroups alt.comp.os.windows-10, alt.comp.os.windows-11, alt.msdos.batch
Subject Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware
Date 2025-09-28 06:10 +0000
Organization BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID <10bajgs$4bl$1@nnrp.usenet.blueworldhosting.com> (permalink)
References (10 earlier) <10ai8ss$25rr$1@nnrp.usenet.blueworldhosting.com> <10anv94$2pu8$1@nnrp.usenet.blueworldhosting.com> <10asbmp$2ep2$1@nnrp.usenet.blueworldhosting.com> <10asca9$3oc$1@nnrp.usenet.blueworldhosting.com> <10aul08$j93$1@nnrp.usenet.blueworldhosting.com>

Cross-posted to 3 groups.

Show all headers | View raw


UPDATE

To test Freegate HTTP proxy against Psiphon free HTTP/SOCKS proxy, I've 
been alternating them each day, where both run all day without complaint.

However, when I started testing Freegate HTTP proxy every other day with 
Psiphon HTTP/SOCKS proxy, I needed to update my start/stop/check scripts
to incorporate the different ports used as variables for the two proxies.

To that end, the checkproxy.bat script was updated to include both proxies.


  @echo off
  REM C:\data\sys\batch\checkproxy.bat 20250916 
  REM This is version 2.2
  REM Custom unified Windows proxy diagnostic tool
  REM v1.0 lists WinINET manual proxy, WinHTTP proxy, PAC/AutoDetect
  REM v1.1 replaces echo. with echo( to avoid command misinterpretation
  REM v1.2 adds PAC file existence check and SHA256 hash logging (114 lines)
  REM v1.3 (152 lines) adds debugging (section 9)
  REM v1.4 (161 lines) adds more debugging (section 10)
  REM v1.5 (182 lines) adds more debugging (section 11)
  REM v1.6 (204 lines) adds command reference (section 12)
  REM v1.7 (205 lines) Added example.com which is reserved for demos/tests.
  REM v1.8 (217 lines) Added check for freegate proxy in addition to psiphon
  REM v1.9 (231 lines) Added output in final report to add freegate logging
  REM v2.0 (271 lines) adds timestamped log (checkproxyYYYYMMDD_HHMMSS.log)
  REM v2.1 (285 lines) parameterized HTTP port for freegate 8580 & psiphon 3736
  REM v2.2 (299 lines) parameterized all the proxy ports throughout
  REM Comment linelength limit =================================================  REM 567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 12
  :: Normally the pac file is served by a web server.
  :: This script doesn't rely on Windows successfully fetching the PAC file 
  :: via HTTP. Instead, it Sets the registry key to point to the PAC URL
  :: It assumes the PAC logic is known & trusted.
  :: It uses proxy.cmd to apply proxy settings directly, 
  :: bypassing the need for Windows to interpret the PAC file
  :: So even if http://127.0.0.1/proxy.pac isn¢t actually being served 
  :: by a web server, the system still behaves as if it is because the 
  :: tooling here enforces the logic manually.
  :: This is the where Windows typically looks for the PAC script URL.
  :: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\
  :: AutoConfigURL = http://127.0.0.1/proxy.pac
  :: That tells Windows to fetch the PAC file from your own machine via HTTP
  :: http://127.0.0.1/proxy.pac
  :: C:\data\sys\batch\proxy.pac
  :: curl http://127.0.0.1/proxy.pac
  :: 
  :: You could point to the actual pac file but that's less universal
  :: AutoConfigURL = file:///C:/data/sys/batch/proxy.pac
  ::
  :: C:\app\network\psiphon\psiphon3.exe -mode=socks
  :: Win+I > Settings > Network & Internet > Proxy > Manual proxy setup = on
  ::  Automatic proxy setup
  ::   Automatically detect settings = on
  ::   Use setup script = on
  ::   Script address = http://127.0.0.1/proxy.pac
  ::  Manual proxy setup
  ::   Use a proxy server = on
  ::   Address http7.0.0.1:3736;https7.0.0.1:3736;socks7.0.0.1:1080
  ::   Port = <blank>
  ::   Use the proxy server except for addresses that start with the following entries. Use semicolons (;) to separate entries.
  ::   10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*;169.254.*;[fc*];[fd*];[fe8*];[fe9*];[fea*];[feb*]
  ::  [x]Don't use the proxy server for local (intranet) addresses
  :: 
  :: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL
  :: AutoConfigURL = http://127.0.0.1/proxy.pac
  :: 
  :: C:\data\sys\batch\proxy.pac
  :: 
  :: Final Result
  :: WinINET: Enabled and pointing to Psiphon
  :: WinHTTP: Synced to match WinINET
  :: PAC: Registry keys set, logic assumed, Auto-Detect enabled
  :: The system is now fully aligned across all proxy layers.
  ::
  REM BELOW is the log wrapper (console output saved to a timestamped file) v2p0
  set "LOGDIR=C:\data\sys\log"
  
  if "%1"=="__LOGGING__" goto :run_script
  
  for /f "tokens=1-4 delims=/ " %%a in ("%DATE%") do (
    set DOW=%%a
    set MM=%%b
    set DD=%%c
    set YYYY=%%d
  )
  for /f "tokens=1-3 delims=:." %%a in ("%TIME%") do (
    set HH=%%a
    set Min=%%b
    set Sec=%%c
  )
  if "%HH:~0,1%"==" " set HH=0%HH:~1,1%
  
  set LOGSTAMP=%YYYY%%MM%%DD%_%HH%%Min%%Sec%
  set "LOGFILE=%LOGDIR%\checkproxy%LOGSTAMP%.log"
  set "TMPTXT=%LOGDIR%\checkproxy%LOGSTAMP%.tmp"
  
  if not exist "%LOGDIR%" md "%LOGDIR%" 2>nul
  
  powershell -NoProfile -Command ^
    " & { & cmd /c '\"%~f0\" __LOGGING__' 2>&1 | Tee-Object -FilePath '%TMPTXT%' }"
  
  powershell -NoProfile -Command ^
    " [System.IO.File]::WriteAllText('%LOGFILE%', (Get-Content -Raw -LiteralPath '%TMPTXT%'), (New-Object System.Text.UTF8Encoding($false))); Remove-Item -LiteralPath '%TMPTXT%' -ErrorAction SilentlyContinue"
  
  echo(
  echo Log created at %LOGFILE%
  echo(
  pause
  exit /b
  
  :run_script
  REM ABOVE is the log wrapper (console output saved to a timestamped file) v2p0
  
  set FREEGATE_HTTP_PORT…80
  set FREEGATE_HTTP_PORT_ALT…81
  set PSIPHON_HTTP_PORT736
  set PSIPHON_SOCKS_PORT80
  
  echo [%DATE% %TIME%] Starting proxy check...
  
  setlocal
  
  set KEY="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
  set PACFILE=C:\data\sys\batch\proxy.pac
  REM v2.0 Replace the HTTP proxy port with a parameterized port 
  echo =============================================  echo   WINDOWS PROXY CONFIGURATION CHECK
  echo =============================================  
  REM --- PAC file existence check ---
  if not exist "%PACFILE%" (
      echo WARNING: PAC file not found at %PACFILE%
  ) else (
      echo PAC file found at %PACFILE%
      echo PAC file SHA256 hash:
      certutil -hashfile "%PACFILE%" SHA256
  )
  
  REM --- WinINET (manual proxy) ---
  echo(
  echo [1] WinINET / Internet Settings
  for /f "tokens=2,* skip=2" %%A in ('reg query %KEY% /v ProxyEnable 2^>nul') do set ProxyEnable=%%B
  for /f "tokens=2,* skip=2" %%A in ('reg query %KEY% /v ProxyServer 2^>nul') do set ProxyServer=%%B
  if "%ProxyEnable%"=="0x1" (
      echo Proxy is ENABLED
      echo Proxy server: %ProxyServer%
  ) else (
      echo Proxy is DISABLED
  )
  
  REM --- WinHTTP proxy ---
  echo(
  echo [2] WinHTTP proxy (system/background services)
  netsh winhttp show proxy
  
  REM --- PAC (Proxy Auto-Config) & AutoDetect ---
  echo(
  echo [3] PAC / AutoDetect
  for /f "tokens=2,* skip=2" %%A in ('reg query %KEY% /v AutoConfigURL 2^>nul') do set PACurl=%%B
  for /f "tokens=2,* skip=2" %%A in ('reg query %KEY% /v AutoDetect 2^>nul') do set AutoDetect=%%B
  
  if defined PACurl (
      echo PAC script set: %PACurl%
  ) else (
      echo No PAC script URL found.
  )
  
  if "%AutoDetect%"=="0x1" (
      echo Auto-detect is ENABLED
  ) else (
      echo Auto-detect is DISABLED
  )
  
  
  REM Added these debugging commands (v1p3)
  echo(
  echo [4] Psiphon and Mongoose process check
  echo tasklist | findstr /i "psiphon3.exe mongoose.exe"
  tasklist | findstr /i "psiphon3.exe mongoose.exe"
  
  :: Added this insert to check for freegate proxy (v1p8)
  echo(
  echo [4b] Freegate process check
  tasklist | findstr /i "fg790p.exe"
  
  echo(
  echo [5b] Freegate port binding check
  REM netstat -ano | findstr :8580
  netstat -ano | findstr :%FREEGATE_HTTP_PORT%
  REM netstat -ano | findstr :8581
  netstat -ano | findstr :%FREEGATE_HTTP_PORT_ALT%
  :: END INSERT to check for freegate proxy (v1p8)
  
  echo(
  echo [5] Port binding check (Mongoose/Proxy)
  echo netstat -ano | findstr :8080
  netstat -ano | findstr :8080
  
  echo(
  echo [6] DNS resolution test
  echo nslookup example.com
  REM nslookup example.com
  REM v2.1 suppressed stderr
  nslookup example.com 2>nul
  
  echo(
  echo [7] Internet connectivity test
  echo ping 8.8.8.8
  ping 8.8.8.8
  
  REM Using %PROXY_PORT% set to Freegate (8580) & then to Psiphon (3736) 
  echo(
  echo [8] Proxy test via curl (Freegate and Psiphon)
  
  REM --- Freegate test (8580) ---
  REM set PROXY_PORT…80
  set PROXY_PORT=%FREEGATE_HTTP_PORT%
  echo -- Freegate on port %PROXY_PORT% --
  echo curl -x http://127.0.0.1:%PROXY_PORT% http://example.com --max-time 5
  curl -x http://127.0.0.1:%PROXY_PORT% http://example.com --max-time 5
  
  REM --- Psiphon test (3736) ---
  REM set PROXY_PORT736
  set PROXY_PORT=%PSIPHON_HTTP_PORT%
  REM echo -- Psiphon on port %PROXY_PORT% --
  echo curl -x http://127.0.0.1:%PROXY_PORT% http://example.com --max-time 5
  curl -x http://127.0.0.1:%PROXY_PORT% http://example.com --max-time 5
  
  echo(
  echo [9] .NET proxy settings (PowerShell)
  echo powershell -Command "[System.Net.WebRequest]::DefaultWebProxy"
  powershell -Command "[System.Net.WebRequest]::DefaultWebProxy"
  
  echo(
  echo [10] Network adapter configuration
  echo ipconfig /all
  ipconfig /all
  
  echo(
  echo [11] Network interface and routing diagnostics
  
  echo netsh interface show interface
  netsh interface show interface
  
  echo(
  echo route print
  route print
  
  echo(
  echo curl --verbose http://example.com
  curl --verbose http://example.com
  
  REM Optional deeper trace (creates trace.txt in current folder)
  echo(
  echo curl --trace trace.txt http://example.com
  curl --trace trace.txt http://example.com
  
  
  echo(
  echo Summary:
  echo Proxy Enabled: %ProxyEnable%
  echo Proxy Server: %ProxyServer%
  echo PAC URL: %PACurl%
  echo AutoDetect: %AutoDetect%
  
  echo(
  echo =============================================  echo Check complete.
  echo =============================================  
  echo(
  echo [12] Command Reference (manual run options)
  echo certutil -hashfile "C:\data\sys\batch\proxy.pac" SHA256
  echo reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable
  echo reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer
  echo netsh winhttp show proxy
  echo reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL
  echo reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoDetect
  echo tasklist | findstr /i "psiphon3.exe mongoose.exe"
  echo netstat -ano | findstr :8080
  echo nslookup example.com
  echo ping 8.8.8.8
  REM echo curl -x http://127.0.0.1:3736 http://example.com --max-time 5
  echo psiphon http port
  echo curl -x http://127.0.0.1:%PSIPHON_HTTP_PORT% http://example.com --max-time 5
  echo freegate http port
  echo curl -x http://127.0.0.1:%FREEGATE_HTTP_PORT% http://example.com --max-time 5
  echo powershell -Command "[System.Net.WebRequest]::DefaultWebProxy"
  echo ipconfig /all
  echo netsh interface show interface
  echo route print
  echo curl --verbose http://example.com
  echo curl --trace trace.txt http://example.com
  echo(
  echo Freegate process check:
  tasklist | findstr /i "fg790p.exe" || echo No Freegate process found.
  echo(
  echo Freegate port check:
  REM netstat -ano | findstr :8580 || echo No listener on 8580
  REM netstat -ano | findstr :8581 || echo No listener on 8581
  netstat -ano | findstr :%FREEGATE_HTTP_PORT% || echo No listener on %FREEGATE_HTTP_PORT%
  netstat -ano | findstr :%FREEGATE_HTTP_PORT_ALT% || echo No listener on %FREEGATE_HTTP_PORT_ALT%
  REM Sometimes Freegate sets ProxyServer to 127.0.0.1:8590 in 
  REM Internet Options while actually listening on 8580 so check for that
  echo(
  echo ProxyServer registry value: %ProxyServer%
  REM echo Expected Freegate listener: 127.0.0.1:8580
  echo Expected Psiphon listener: 127.0.0.1:%PSIPHON_HTTP_PORT%
  echo Expected Freegate listener: 127.0.0.1:%FREEGATE_HTTP_PORT%
  endlocal
  
-- 

Back to alt.comp.os.windows-10 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 07:30 +0000
  Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 07:53 +0000
    Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 08:15 +0000
      Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 08:46 +0000
        Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 09:59 +0000
          Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 10:11 +0000
            Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 10:51 +0000
              Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 11:09 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-18 11:53 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware "R.Wieser" <address@is.invalid> - 2025-09-18 15:06 +0200
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-19 00:42 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-21 04:34 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-22 20:31 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-22 20:41 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-23 17:22 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-09-28 06:10 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-10-17 05:40 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <marionf@fact.com> - 2025-10-17 05:44 +0000
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-10-29 11:55 -0600
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-10-29 11:58 -0600
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-10-30 00:56 -0600
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-11-02 20:45 -0700
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-11-02 20:58 -0700
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marion <mariond@facts.com> - 2025-11-03 10:41 -0700
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marian <marianjones@helpfulpeople.com> - 2025-12-01 15:38 -0700
                Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marian <marianjones@helpfulpeople.com> - 2025-12-02 01:11 -0700
  Re: Tutorial: Build a one-click Windows custom SOCKS5 proxy client using freeware Marian <marianjones@helpfulpeople.com> - 2025-12-02 09:19 -0700

csiph-web