text: class GenerateWPAD:
      head = []
      foot = []
      def __init__(self):
          self.head = [
                  '/**\n',
                  'The original template was created by Sam Gleske\n',
                  'This author and license block must stay intact for use even if this script is \n',
                  'modified!\n',
                  '\n',
                  'License:\n',
                  'This file falls under the MIT Licence \n',
                  'http://www.opensource.org/licenses/mit-license.php\n',
                  'Take responsibility for your own actions.\n',
                  '\n',
                  'Generated using Python and predefined proxy lists!\n',
                  'http://sourceforge.net/projects/webtechtools/files/Proxy%20wpad.dat%20Generator/\n',
                  '\n',
                  'You are not authorized to use this proxy configuration for illegal purposes.\n',
                  'This file follows the Netscape WPAD standard.  Please read the documentation\n',
                  'after the configuration options for additional warnings and tips information.\n',
                  '**/\n',
                  '\n',
                  '/*\n',
                   '* Configuration Options\n',
                   '*/\n',
                  '\n',
                  '//Enables console logging (true/false, default true)\n',
                  'var ENABLE_LOGGING=true;\n',
                  '\n',
                  '\n',
                  '//Enable friendly excludes (true/false, default true)\n',
                  '//If a request matches an exclude then it will create a direct connection rather than proxy\n',
                  '//This option must be disabled for user defined excludes to work\n',
                  'var ENABLE_EXCLUDES=true;\n',
                  '\n',
                  '//User defined Protocol excludes (array)\n',
                  'var protocol_excludes=[];\n',
                  '\n',
                  '//User defined IP excludes (array)\n',
                  'var ip_excludes=[];\n',
                  '\n',
                  '//User defined Domain excludes (array)\n',
                  'var domain_excludes=[];\n',
                  '\n',
                  '\n',
                  '//Enable predefined proxy list (true/false, default true)\n',
                  '//This option must be disabled for the user defined proxy list\n',
                  'var ENABLE_PREDEFINED_PROXY_LIST=true;\n',
                  '\n',
                  '//User defined proxy list (array)\n',
                  'var proxylist=[];\n',
                  '\n',
                  '/*\n',
                   '* End of Configuration Options\n',
                   '*/\n',
                  '\n',
                  '\n',
                  '\n',
                  '\n',
                  '\n',
                  '/************************************************************************************\n',
                               'WARNINGS, INFORMATION, AND ADDITIONAL DOCUMENTATION\n',
                  '*************************************************************************************\n',
                  'It is highly recommended that you keep this documentation block if you modify \n',
                  'this file.\n',
                  '\n',
                  'DO NOT, I repeat, DO NOT log into web portals where financial or personal \n',
                  'information is at risk using an anonymous/3rd party proxy. It is possible that \n',
                  'an anonymous proxy is set up to record all traffic and to mine usernames and \n',
                  'passwords for websites. Monitoring insecure authentication or cookies are just a \n',
                  'few of many methods to achieve this. I have set up some rules which will help \n',
                  'minimize the effect of this but it is still recommended to disable this proxy \n',
                  'whenever handling such information. This is not a flaw of this software or \n',
                  'wpad.dat but more the nature of an anonymous proxy.\n',
                  '\n',
                  'Public Proxies and the Law\n',
                  'According to U.S. law, 18 U.S.C. Section 1030 (Fraud and Related Activity in \n',
                  'Connection with Computers) applies only when anyone who knowingly accesses a \n',
                  'computer without authorization or has knowingly exceeds his authorized access on \n',
                  'that computer. Because an opened proxy, by default, allows connections and use of \n',
                  'the service by anyone in the WWW, its administrator has essentially authorized \n',
                  'everyone to use the proxy. Therefore browsing the web, via anonymous proxies, is \n',
                  'not illegal.\n',
                  '\n',
                  '\n',
                  'This software is geared towards advanced end users and security professionals. By \n',
                  'using this software you agree to the MIT license which governs any unlicensed \n',
                  'software or files related to this file.\n',
                  '\n',
                  '\n',
                  'What is wpad.dat?\n',
                  'wpad.dat is a Web Proxy Automatic Detection (WPAD) file. Your browser selects a \n',
                  'proxy based on the pre-defined rules specified in the wpad.dat file. The language \n',
                  'is JavaScript for wpad.dat.\n',
                  '\n',
                  '\n',
                  'Pros/Cons of proxying using my wpad.dat method?\n',
                  'Pros:\n',
                      '* Your IP address is constantly changing from the perspective of the web \n',
                  '\t  server making you impossible to track.\n',
                      '* There are pre-defined rules which help to protect your information if you \n',
                  '\t  accidently forget to turn off this proxy method while browsing websites \n',
                  '\t  where financial or personal information are at risk.\n',
                  '\t* If a website is using an encrypted connection then it does not go through\n',
                  '\t  any anonymous proxy.  PLEASE NOTE if you opt out of my predefined rules\n',
                  '\t  then this is no longer the case.\n',
                  '\n',
                  'Cons:\n',
                      '* Your browsing speed is slightly diminished because you are visiting \n',
                  '\t  websites via a proxy.\n',
                      '* Your browsing habits and information are not guarunteed to be protected \n',
                  '\t  from the anonymous proxy if by some happance this file is misconfigured.\n',
                  '\n',
                  '*************************************************************************************\n',
                                               'End of Documentation\n',
                  '*************************************************************************************/\n',
                  '\n',
                  '\n',
                  '\n',
                  '\n',
                  '\n',
                  '//////////////// No need to edit beyond this point ///////////////\n',
                  '\n',
                  '//Custom defined functions for cleaner processing\n',
                  'function exclude(source,rules)\n',
                  '{\n',
                  '\ttry\n',
                  '\t{\n',
                  '\t\tfor(var i=0;i<rules.length;i++)\n',
                  '\t\t\tif(shExpMatch( source, rules[i]))\n',
                  '\t\t\t\treturn true;\n',
                  '\t\treturn false;\n',
                  '\t}\n',
                  '\tcatch(e)\n',
                  '\t{\n',
                  '\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\talert("An exception has been encountered!\\n" + source + "\\n" + rules);\n',
                  '\t\treturn false;\n',
                  '\t}\n',
                  '}\n',
                  '\n',
                  '//Initialization Function\n',
                  'function FindProxyForURL(url, host) \n',
                  '{\n',
                  '\t//These are my personal excludes just in case I accidently go to a login site with this proxy enabled\n',
                  '\tif(ENABLE_EXCLUDES)\n',
                  '\t{\n',
                  '\t\tip_excludes=[\n',
                  '\t\t\t"10.*", //private address range\n',
                  '\t\t\t"172.*", //private address range\n',
                  '\t\t\t"192.*", //private address range\n',
                  '\t\t\t"127.*", //loopback or localhost\n',
                  '\t\t\t"144.118.*", //Drexel University\n',
                  '\t\t\t"74.125.*", //Google\n',
                  '\t\t\t"67.195.*", //Yahoo Inc\n',
                  '\t\t\t"170.201.*", //PNC Bank\n',
                  '\t\t\t"66.95.*", //United Bank\n',
                  '\t\t\t"12.*", //AT&T WorldNet Services (covers AES and other banking websites)\n',
                  '\t\t\t"164.109.*" //Digex, Incorporated. (Covers PECO and Exelon Corp)\n',
                  '\t\t];\n',
                  '\t\tdomain_excludes=[\n',
                  '\t\t\t"*accuweather.com",\n',
                  '\t\t\t"*mozdev.org",\n',
                  '\t\t\t"*mozilla.org",\n',
                  '\t\t\t"*bankofamerica.com",\n',
                  '\t\t\t"*campusfood.com",\n',
                  '\t\t\t"*chase.com*",\n',
                  '\t\t\t"*clubbleach.org",\n',
                  '\t\t\t"*crunchyroll.com",\n',
                  '\t\t\t"*dccc.edu*",\n',
                  '\t\t\t"*domaintools.com",\n',
                  '\t\t\t"*ea.com",\n',
                  '\t\t\t"*ebay.com",\n',
                  '\t\t\t"*ebayrtm.com",\n',
                  '\t\t\t"*ebaystatic.com",\n',
                  '\t\t\t"*expedia.com",\n',
                  '\t\t\t"*experts-exchange.com",\n',
                  '\t\t\t"*facebook.com",\n',
                  '\t\t\t"*fbcdn.net",\n',
                  '\t\t\t"*flagfox.net",\n',
                  '\t\t\t"*fsdn.com",\n',
                  '\t\t\t"*godaddy.com",\n',
                  '\t\t\t"www.google.*", //Needed for when Google randomly decides to load files from another country like www.google.ca or www.google.com.ph\n',
                  '\t\t\t"*.gov",\n',
                  '\t\t\t"*geotrust.com",\n',
                  '\t\t\t"*ingdirect.com",\n',
                  '\t\t\t"*ittoolbox.com",\n',
                  '\t\t\t"*live.com",\n',
                  '\t\t\t"*logmein.com",\n',
                  '\t\t\t"*mqcdn.com",\n',
                  '\t\t\t"*msn.com",\n',
                  '\t\t\t"*newegg.ca",\n',
                  '\t\t\t"*newegg.com",\n',
                  '\t\t\t"*neweggimages.com",\n',
                  '\t\t\t"*passport.com",\n',
                  '\t\t\t"*passport.net",\n',
                  '\t\t\t"*passportimages.com",\n',
                  '\t\t\t"*paypal.com",\n',
                  '\t\t\t"*paypalobjects.com",\n',
                  '\t\t\t"*register.com",\n',
                  '\t\t\t"*sf.net",\n',
                  '\t\t\t"*sourceforge.net",\n',
                  '\t\t\t"*steampowered.com",\n',
                  '\t\t\t"*thawte.com",\n',
                  '\t\t\t"*verisign.com",\n',
                  '\t\t\t"*yahoo.com",\n',
                  '\t\t\t"*whois.net"\n',
                  '\t\t];\n',
                  '\t\tprotocol_excludes=[\n',
                  '\t\t\t"about:*",\n',
                  '\t\t\t"aim:*",\n',
                  '\t\t\t"chrome:*",\n',
                  '\t\t\t"file:*",\n',
                  '\t\t\t"https:*",\n',
                  '\t\t\t"sftp:*",\n',
                  '\t\t\t"socks:*",\n',
                  '\t\t\t"steam:*",\n',
                  '\t\t\t"telnet:*"\n',
                  '\t\t];\n',
                  '\t};\n',
                  '\t\n',
                  '\t//Run exclude rules for protocols, domain names, and ip addresses\n',
                  '\tif(exclude(url.toLowerCase(),protocol_excludes))\n',
                  '\t{\n',
                  '\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\talert("Exclude rule triggered: protocol\\n" + url);\n',
                  '\t\treturn "DIRECT";\n',
                  '\t};\n',
                  '\tif(exclude(dnsResolve(host),ip_excludes))\n',
                  '\t{\n',
                  '\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\talert("Exclude rule triggered: ip\\n" + dnsResolve(host));\n',
                  '\t\treturn "DIRECT";\n',
                  '\t};\n',
                  '\tif(exclude(host.toLowerCase(),domain_excludes))\n',
                  '\t{\n',
                  '\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\talert("Exclude rule triggered: domain\\n" + dnsResolve(host) + "\\n" + host);\n',
                  '\t\treturn "DIRECT";\n',
                  '\t};\n',
                  '\n',
                  '\t//Pre-defined proxy list\n',
                  '\tif(ENABLE_PREDEFINED_PROXY_LIST)\n',
                  '\t{\n',
                  '\t\tproxylist=[\n',
                  '\t\t\t'
                  ]
          self.foot = [
                  '\n',
                  '\t\t];\n',
                  '\t};\n',
                  '\t\n',
                  '\t//Generate a random index for the proxy list\n',
                  '\ttry\n',
                  '\t{\n',
                  '\t\tvar index=-1;\n',
                  '\t\twhile(index<0)\n',
                  '\t\t\tindex=Math.ceil(proxylist.length*Math.random())-1;\n',
                  '\n',
                  '\t\tif(proxylist.length)\n',
                  '\t\t{\n',
                  '\t\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\t\talert("Rule not triggered!\\n" + dnsResolve(host) + "\\n" + host.toLowerCase() + "\\n" + url.toLowerCase() + "\\nUsing Proxy: " + proxylist[index]);\n',
                  '\t\t\treturn "PROXY "+proxylist[index];\n',
                  '\t\t}\n',
                  '\t\telse\n',
                  '\t\t\treturn "DIRECT";\n',
                  '\t}\n',
                  '\tcatch(e)\n',
                  '\t{\n',
                  '\t\tif(ENABLE_LOGGING)\n',
                  '\t\t\talert("An exception has been encountered!\\n" + proxylist);\n',
                  '\t\treturn "DIRECT";\n',
                  '\t};\n',
                  '}\n'
                  ]