7
votes

I have an access to a preconfigured Windows XP 32-bit workstation. It's under firewall and to get outside it uses http proxy server. To get proxy settings I need host, port, username and password.

http: // username : password @ server : port

I'm able to find the proxy url and port (from PAC - automatic config file), but I don't know how to get username/password. Is there a way to read it somehow? At least username? I might get the admin rights.

Do you know any tool that can help?

I only found these MS docs about some methods to get proxy config connection, but I don't know how to determinate what's the provided credentials:

WinHttpGetIEProxyConfigForCurrentUser function

WINHTTP_CURRENT_USER_IE_PROXY_CONFIG structure

WinHttpGetProxyForUrl function

I've also found this lib, but it's rather for parsing PAC: http://code.google.com/p/pacparser/

2
I've found the other way to get the proper credentials, but I'm curious if it's possible to determinate it somehow using any tool/in programming way.Robert
I've partially solved the problem by digging into windows registry: support.microsoft.com/en-us/kb/819961 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "MigrateProxy"=dword:00000001 "ProxyEnable"=dword:00000001 "ProxyHttp1.1"=dword:00000000 "ProxyServer"="ProxyServername:80" "ProxyOverride"="<local>"Robert
how can we find the proxy user name and password from the registryunknown

2 Answers

4
votes

In windows you cannot get password. To get connect throw a proxy you have to use SSPI, check libcurl, you can get a connected socket throw proxy, build it with enable-sspi and openssl.

0
votes

Iterating on Fernando Sanchez's answer and Robert's comment, you need to authenticate via SSPI. In my case I've connected using NTLM using this link

With using ntlm :

curl.exe --proxy <proxy_name>:<proxy_port> --proxy-ntlm -U : https://www.google.com

Also to partially answer your question the -U : means from curl man page :

If you use a Windows SSPI-enabled curl binary and do either Negotiate or NTLM authentication then you can tell curl to select the user name and password from your environment by specifying a single colon with this option: "-U :".

You can get the proxy name and port from the windows registry (regedit). Quote from Robert's comment:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]

It can be present either in a manual way using REG_SZ ProxyServer or using an autoconfiguration script using REG_SZ AutoConfigURL = https://<configuration_url>

If the command above fails with Failure when receiving data from the peer maybe you have a release without NTLM, SSPI or OpenSSL. Try with the latest curl release