Crates.io | proxyconf |
lib.rs | proxyconf |
version | 0.2.1 |
source | src |
created_at | 2018-05-28 20:16:40.65247 |
updated_at | 2019-05-05 18:51:14.698442 |
description | Windows proxy configuration from the command line. |
homepage | https://github.com/vbfox/proxyconf |
repository | https://github.com/vbfox/proxyconf |
max_upload_size | |
id | 67506 |
size | 55,576 |
A small command line tool to set proxy configuration on Windows.
Using command-line only windows version (Core or Nano) behind a proxy can be problematic: some windows applications use IE settings but there is no good way to set them, other use WinHTTP settings that netsh winhttp
can configure but it's not available on latest nano server images.
proxyconf
aim to be a simple command line tool that can do this configuration and is suitable to use in containers (Docker).
FROM microsoft/nanoserver:1803
COPY proxyconf.exe .
RUN proxyconf set proxy 10.0.0.1:8080 "*.my-company;<local>" \
&& proxyconf winhttp proxy 10.0.0.1:8080 "*.my-company;<local>"
proxyconf show
Show the current proxy configurationproxyconf set
Set the current user proxy configuration. One of theses must be specified:
no-proxy
No proxy should be used.auto-detect
Automatically detect settings. Windows will use the Web Proxy Autodiscovery Protocol or fallback to direct connectionproxy <ADDRESS:PORT> [BYPASS_LIST]
Use an hardcoded proxy (or proxies, see below) with an optional bypass list.setup-script <URL>
Use Proxy auto-config (PAC) from the specified URL.proxyconf winhttp
Set the system-wide winhttp proxy configuration. One of theses must be specified:
no-proxy
No proxy should be used.proxy <ADDRESS:PORT> [BYPASS_LIST]
Use an hardcoded proxy (or proxies, see below) with an optional bypass list.Common values:
ADDRESS:PORT
The proxy server and optional port to use.protocol=address:port
separated by semicolons (;
). The protocols are http
, https
, ftp
and socks
. BYPASS_LIST
Optional list of addresses that bypass the proxy separated by semicolons (;
).<local>
to bypass all short name hosts.<local>
if not specified.Per-user settings (by default, there is a registry flag to have system ones) used by Internet Explorer initially and now by most applications.
They can be edited in the GUI from Internet Explorer settings or on recent versions of Windows directly from the control panel.
A binary key storing settings for applications using the WinHTTP programming interface. It doesn't support much more than a static proxy but it's supported by services like windows update.
This tool set some specific keys in the registry, with the following format:
Stored as a REG_BINARY value.
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
with the default one for LAN under DefaultConnectionSettings
.HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
key ProxySettingsPerUser
is 1
(DWORD) the same location is used in HKEY_LOCAL_MACHINE
instead and the settings are global.WinHttpSettings
under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
I know of 3 versions:
netsh winhttp
The (undocumented) format is (With all values in little endian):
version: u32
Version numbercounter: u32
An incremential counter used to detect changes.configuration_bits: u32
A bit field with the following bits:
1
Always set2
Use manual proxy3
Use setup script (version >= 0x3C)4
Automatically detect settings (version >= 0x3C)proxy_address_len: u32
Length of the proxy address string.proxy_addres: Vec<u8>
Proxy address (ASCII).bypass_list_len: u32
Length of the bypass list string.bypass_list: Vec<u8>
Bypass list (ASCII).setup_script_len: u32
Length of the setup script url string. (version >= 0x3C)setup_script: Vec<u8>
Setup script url (ASCII). (version >= 0x3C)They aren't used anymore but are kept for applications that might access them directly, the GUI set them when a change is done but doesn't read it.
They are stored in the registry key HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
.