org.owasp.webscarab.util
Class W32WinInet

java.lang.Object
  extended by org.owasp.webscarab.util.W32WinInet

public class W32WinInet
extends java.lang.Object

Provides a method of interacting with the Windows WinInet utility DLL. This is obviously only interesting on a MS Windows platform. Most usefully, it provides JNI methods of getting and setting the Internet Explorer proxy settings, in such a way that the changes affect all existing running instances of Internet Explorer immediately, and the user does NOT need to exit the browser for the changes to be effective.


Field Summary
static int PROXY_TYPE_AUTO_DETECT
          Specifies that the browser will auto detect the proxy, according to the MS auto-detect methodology
static int PROXY_TYPE_AUTO_PROXY_URL
          Not sure exactly what this one does.
static int PROXY_TYPE_DIRECT
          Specifies that some connections may be made directly to the server, bypassing the proxy
static int PROXY_TYPE_PROXY
          Specifies that some connections may go via a proxy
 
Constructor Summary
W32WinInet()
           
 
Method Summary
static int getHttpProxyPort()
          gets the port of the original WinInet HTTP proxy server, regardless of any intercepts that may have been made.
static java.lang.String getHttpProxyServer()
          gets the name or address of the original WinInet HTTP proxy server, regardless of any intercepts that may have been made.
static int getHttpsProxyPort()
          gets the port of the original WinInet HTTPS proxy server, regardless of any intercepts that may have been made.
static java.lang.String getHttpsProxyServer()
          gets the name or address of the original WinInet HTTPS proxy server, regardless of any intercepts that may have been made.
static java.lang.String getNoProxy()
          returns the original WinInet list of hosts or addresses that should be connected to directly, rather than using the proxy.
static boolean interceptProxy(java.lang.String server, int port)
          Causes the existing WinInet proxy settings to be saved, and the new proxy settings supplied to be configured This sets the proxy for ALL services, and ensures that ALL connections go through the supplied proxy, including connections to local servers.
static boolean isAvailable()
          Allows the caller to test whether the native library was successfully loaded.
static void main(java.lang.String[] args)
           
static void revertProxy()
          resets the WinInet proxy settings to their original values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_TYPE_DIRECT

public static int PROXY_TYPE_DIRECT
Specifies that some connections may be made directly to the server, bypassing the proxy


PROXY_TYPE_PROXY

public static int PROXY_TYPE_PROXY
Specifies that some connections may go via a proxy


PROXY_TYPE_AUTO_PROXY_URL

public static int PROXY_TYPE_AUTO_PROXY_URL
Not sure exactly what this one does. Maybe that a .pac file is active?


PROXY_TYPE_AUTO_DETECT

public static int PROXY_TYPE_AUTO_DETECT
Specifies that the browser will auto detect the proxy, according to the MS auto-detect methodology

Constructor Detail

W32WinInet

public W32WinInet()
Method Detail

isAvailable

public static boolean isAvailable()
Allows the caller to test whether the native library was successfully loaded.

Returns:
true if the native library was successfully loaded, false otherwise

interceptProxy

public static boolean interceptProxy(java.lang.String server,
                                     int port)
Causes the existing WinInet proxy settings to be saved, and the new proxy settings supplied to be configured This sets the proxy for ALL services, and ensures that ALL connections go through the supplied proxy, including connections to local servers.

Parameters:
server - the name or address of the proxy server
port - the port of the proxy server
Returns:
true if the settings were successfully replaced, false otherwise

revertProxy

public static void revertProxy()
resets the WinInet proxy settings to their original values


getHttpProxyServer

public static java.lang.String getHttpProxyServer()
gets the name or address of the original WinInet HTTP proxy server, regardless of any intercepts that may have been made.

Returns:
the name or address of the WinInet proxy server

getHttpProxyPort

public static int getHttpProxyPort()
gets the port of the original WinInet HTTP proxy server, regardless of any intercepts that may have been made.

Returns:
the port of the WinInet proxy server, or -1 if none is configured or there is an error parsing the port number

getHttpsProxyServer

public static java.lang.String getHttpsProxyServer()
gets the name or address of the original WinInet HTTPS proxy server, regardless of any intercepts that may have been made.

Returns:
the name or address of the WinInet proxy server

getHttpsProxyPort

public static int getHttpsProxyPort()
gets the port of the original WinInet HTTPS proxy server, regardless of any intercepts that may have been made.

Returns:
the port of the WinInet proxy server, or -1 if none is configured or there is an error parsing the port number

getNoProxy

public static java.lang.String getNoProxy()
returns the original WinInet list of hosts or addresses that should be connected to directly, rather than using the proxy.

Returns:
a semi-colon separated list of hosts or addresses

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception