All Projects → aus → proxyplease

aus / proxyplease

Licence: MIT license
Cross-platform proxy selection with optional native authentication negotiation

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to proxyplease

nsspi
A C# / .Net interface to the Win32 SSPI authentication API
Stars: ✭ 60 (+62.16%)
Mutual labels:  ntlm, kerberos, sspi
go-spnego
Wraps gokrb5 and sspi libraries to provide cross-platform way to make HTTP calls with Kerberos authentication
Stars: ✭ 20 (-45.95%)
Mutual labels:  kerberos, sspi
active-directory-integration2
WordPress plug-in "Next Active Directory Integration"
Stars: ✭ 51 (+37.84%)
Mutual labels:  ntlm, kerberos
NTLM-SSP
本项目是一篇NTLM中高级进阶进阶文章,后续我也会在Github和Gitbook对此文进行持续性的更新NTLM以及常见的协议中高级进阶并计划开源部分协议调试工具,望各位issue勘误。
Stars: ✭ 97 (+162.16%)
Mutual labels:  ntlm, sspi
WatchAD
AD Security Intrusion Detection System
Stars: ✭ 967 (+2513.51%)
Mutual labels:  ntlm, kerberos
GetNTLMChallenge
Obtains a crackable hash for the current user account
Stars: ✭ 23 (-37.84%)
Mutual labels:  ntlm
mail
golang send mail with SSL,TLS and support NTLM,LOGIN,PLAIN AUTH...
Stars: ✭ 29 (-21.62%)
Mutual labels:  ntlm
nginx-ntlm-module
A nginx module to allow proxying requests with NTLM Authentication.
Stars: ✭ 32 (-13.51%)
Mutual labels:  ntlm
boost-wintls
Native Windows TLS stream wrapper for use with boost::asio
Stars: ✭ 24 (-35.14%)
Mutual labels:  sspi
python-krbcontext
A Kerberos context manager
Stars: ✭ 23 (-37.84%)
Mutual labels:  kerberos
omniauth-kerberos
OmniAuth strategy for kerberos authentication.
Stars: ✭ 13 (-64.86%)
Mutual labels:  kerberos
requests auth
Authentication classes to be used with requests
Stars: ✭ 28 (-24.32%)
Mutual labels:  ntlm
docker-kdc
Docker container generator for a Kerberos KDC.
Stars: ✭ 46 (+24.32%)
Mutual labels:  kerberos
vault-plugin-auth-kerberos
[DEPRECATED] Plugin for Hashicorp Vault enabling Kerberos authentication
Stars: ✭ 36 (-2.7%)
Mutual labels:  kerberos
Cheat-Sheet---Active-Directory
This cheat sheet contains common enumeration and attack methods for Windows Active Directory with the use of powershell.
Stars: ✭ 154 (+316.22%)
Mutual labels:  kerberos
kerby
Go wrapper for Kerberos GSSAPI
Stars: ✭ 33 (-10.81%)
Mutual labels:  kerberos
Chromium-Gost
Chromium с поддержкой алгоритмов ГОСТ
Stars: ✭ 286 (+672.97%)
Mutual labels:  sspi
go-http-ntlm
NTLM authenticated http request for Go
Stars: ✭ 43 (+16.22%)
Mutual labels:  ntlm
burp-ntlm-challenge-decoder
Burp extension to decode NTLM SSP headers and extract domain/host information
Stars: ✭ 28 (-24.32%)
Mutual labels:  ntlm
jupyterhub-kdcauthenticator
A Kerberos authenticator module for the JupyterHub platform
Stars: ✭ 22 (-40.54%)
Mutual labels:  kerberos

proxyplease

Ask nicely, and you might get proxied.

proxyplease is a Go package that attempts to establish a valid proxy connection based on available assumptions. It does by using native and third-party libraries. proxyplease returns a DialContext which can be used in an http.Client Transport or other contexts.

Examples

You can assume the complete proxy configuration and authentication from system.

dialContext := proxyplease.NewDialContext(proxyplease.Proxy{})

Or maybe you want to specify a specific SOCKS5 proxy:

u, _ := url.Parse("socks5h://localhost:1080")
dialContext := proxyplease.NewDialContext(proxyplease.Proxy{URL: u})

Let's try a HTTP CONNECT Proxy. This proxy requires NTLM authentication. We don't know the user's credentials so we will assume the credentials from the current user session via SSPI (Windows only).

u, _ := url.Parse("http://proxy.example.com:8888")
dialContext := proxyplease.NewDialContext(proxyplease.Proxy{URL: u})

Or maybe you want to use specific credentials for NTLM authentication. Oh, but you forgot proxy URL. If the system was configured with a proxy URL, you'll still get proxied:

dialContext := proxyplease.NewDialContext(proxyplease.Proxy{Username: "foo", Password: "bar", Domain: "EXAMPLE"})

Oh no! This user's proxy only supported Basic authentication. Don't worry. The above example still covers you if those credentials are valid.

But what if you need a specific user-agent. Easy!

h := &http.Header{}
h.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0")
dialContext := proxyplease.NewDialContext(proxyplease.Proxy{Headers: h})

What if the proxy depends on the target URL and you need to look up via PAC?

t, _ := url.Parse("https://www.google.com")
dialContext := proxyplease.NewDialContext(proxyplease.Proxy{TargetURL: t})

Proxy Support

SOCKS

Protocol URI No Auth User / Pass GSSAPI DNS
SOCKS4 socks4:// ✔️
SOCKS4a socks4a:// ✔️ ✔️
SOCKS5 socks5:// ✔️ ✔️ ✔️
SOCKS5h socks5h:// ✔️ ✔️ ✔️

The golang.org/x/net/proxy will always do remote DNS for socks5://.

HTTP CONNECT

Protocol URI No Auth Basic NTLM Negotiate::Kerberos Negotiate::NTLM Kerberos Digest
HTTP http:// ✔️ ✔️ ✔️ ✔️
HTTPS https:// ✔️ ✔️ ✔️ ✔️

If the proxy iniitally responds with a 407 Proxy Authentication Required, the Proxy-Authenticate header(s) will be inspected for authentication schemes supported by the server. Each authentication scheme will be attempted in order of response until a 200 Connection Established. If no credentials are supplied, proxyplease will attempt to transparently assume the current user's credentials from SSPI (SSPI is supported on Windows only and used for NTLM, Kerberos and Negotiate authentications schemes) or if they are hardcoded in environemt variables. Ex: HTTP_PROXY=http://foo:[email protected]:3128. If proxyplease does not have enough information to attempt the authentication, the attempt will fail and another scheme will be attempted.

Proxy Selection

The proxy URL can be specified by passing a URL type. Example:

u, _ := url.Parse("socks5://localhost:8888")
dialContext := proxyplease.NewDialContext(proxyplease.Proxy{URL: u})

If a proxy URL is not provided, proxyplease will attempt to infer the URL from the system utilizing go-get-proxied. If a proxy cannot be determined, it will be assumed the connection is direct.

The proxy will be selected by the following priority:

Windows

  1. proxyplease.Proxy.URL
  2. Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.
  3. Internet Options: Automatically detect settings (WPAD)
  4. Internet Options: Use automatic configuration script (PAC)
  5. Internet Options: Manual proxy server
  6. WINHTTP: (netsh winhttp)

Linux

  1. proxyplease.Proxy.URL
  2. Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.

MacOS

  1. proxyplease.Proxy.URL
  2. Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.
  3. Network Settings: scutil

Known Issues

  • The Negotiate authentication sequence is supposed to fallback to Negotiate::NTLM if Negotiate::Kerberbos fails. This is currently unsupported.
  • Digest authentication is currently unsupported
  • Pure Kerberos authentication is currently unsupported. (In most environments, Kerberos authentication is usually wrapped as Negotiate::Kerberos, which is supported)
  • Negotiate::Kerberos is currently only supported on Windows
  • No tests
  • No keyring support (example: Windows Credential Manager might have stored credentials to a SOCKS proxy)

References

The code for this project was heavily influenced by the following authors. Many thanks to them.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].