// See http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html /* This is a sample proxy configuration script, which works in both Internet Explorer and FireFox. It allows a penetration tester using a proxy intercept tool such as Exodus or WebScarab to test a web site using their primary browser, as well as doing whatever research is necessary, without cluttering up the intercept tool's logs unnecessarily. This can be useful if you need to test with more than one UserAgent, as well as doing research. It saves the tester from having to reconfigure their proxy configuration whenever they need to access other Internet sites. In order to use this script, you need to edit an "if" statement further down, so that it recognises the site that you are testing. */ // ========================================================== // // remember to reload this script, if you change anything // // ========================================================== // /* The logic in this script goes as follows: * Check if the site matches those that we wish to test using WebScarab/whatever * do not use a proxy for localhost or RFC1918 addresses * list the specific proxies to use depending on where we are (our current IP) */ function FindProxyForURL(url, host) { // The alert can be useful to check if the script is being executed // It is Internet Explorer specific, and silently BREAKS Mozilla/Netscape, etc // alert("Checking " + url); // this makes it possible to use the same browser for testing // as you do for research and general browsing, without mixing // the conversations. // // NOTE!!! you can miss conversations generated by the site under // test if they go to sites that don't match the function // below. For safety, the function below should always // return true. However, for convenience, adjust it the // way you want to! ;-) // if the destination is the site under test, route via WebScarab /* if (shExpMatch(url,"http*://testsite.example/*")) { return "PROXY localhost:8008"; } // */ // we assume that there are no proxies required to get to RFC1918 addresses if (isRFC1918(host) || isRFC1918(dnsResolve(host))) { return "DIRECT"; } if (isPlainHostName(host)) { return "DIRECT"; } if (isException(host,"*.local.example;*.local2.example")) { return "DIRECT"; } return "PROXY myproxy.example:3128"; } function isRFC1918(host) { if (isInNet(dnsResolve(host), "127.0.0.0", "255.0.0.0.0") || // localhost is local isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0.0") || // RFC1918 must be local isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0.0") || // RFC1918 must be local isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0.0")) { // RFC1918 must be local return true; } else { return false; } } function isException(host, exceptions) { arr=exceptions.split(";"); for (i=0; i