ผู้เขียน หัวข้อ: Super Proxy Script  (อ่าน 7948 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

doramon

  • บุคคลทั่วไป
Super Proxy Script
« เมื่อ: พฤษภาคม 08, 2007, 01:34:30 AM »
0
โค๊ด: C
  1.  
  2. /*
  3.  *      Super Proxy Script
  4.  *
  5.  *      by  Mr.ood
  6.  *
  7.  *     
  8.  *
  9. 202.12.97.111           1
  10. 202.12.97.118           1
  11. 202.12.97.119           1
  12. 202.12.97.116           1
  13. 202.12.97.100           1
  14. 202.12.97.120           1
  15. 202.12.97.113           1
  16. 202.12.97.114           1
  17. 202.12.97.115           1
  18. */
  19. function FindProxyForURL(url, host)
  20. {
  21.  
  22. /* your original script here */
  23. if( dnsDomainIs( host, "kano.moph.go.th" ) ||
  24.          dnsDomainIs( host, ".kku.net" ) ||
  25.          dnsDomainIs( host, "localhost" ) ||
  26.          isPlainHostName( host ) ||
  27.          isInNet( host, "127.0.0.1", "255.255.255.255" )  ||
  28.          isInNet( host, "202.12.97.0", "255.255.255.0" )  ||
  29.          isInNet( host, "202.28.92.0", "255.255.255.0" )  ||
  30.          isInNet( host, "202.28.93.0", "255.255.255.0" )  ||
  31.          isInNet( host, "202.28.94.0", "255.255.255.0" )  ||
  32.          isInNet( host, "202.28.95.0", "255.255.255.0" )  ||
  33.          isInNet( host, "202.28.116.0", "255.255.255.0" )  ||
  34.          isInNet( host, "202.28.117.0", "255.255.255.0" )  ||
  35.          isInNet( host, "202.28.118.0", "255.255.255.0" )  ||
  36.          isInNet( host, "202.28.119.0", "255.255.255.0" )  ||
  37.          isInNet( host, "10.0.0.0", "255.0.0.0" ) )
  38.          return "DIRECT";
  39.         else if (isPlainHostName(host) || dnsDomainIs(host, ".manager.co.th"))
  40.          return "PROXY 202.12.97.100:8088; PROXY 202.12.97.114:8088";
  41.         else  
  42. /* end of your original script */  
  43.  
  44.          var n = URLhash2(url) % 9;  
  45.         if (n < 1)
  46.                 return "PROXY 202.12.97.111:8088; PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  47.         if (n < 2)
  48.                 return "PROXY 202.12.97.119:8088; PROXY 202.12.97.118:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  49.         if (n < 3)
  50.                 return "PROXY 202.12.97.116:8088; PROXY 202.12.97.111:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  51.         if (n < 4)
  52.                 return "PROXY 202.12.97.118:8088; PROXY 202.12.97.116:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  53.         if (n < 5)
  54.                 return "PROXY 202.12.97.120:8088; PROXY 202.12.97.118:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;DIRECT";
  55.         if (n < 6)
  56.                 return "PROXY 202.12.97.100:8088; PROXY 202.12.97.120:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.118:8088;PROXY 202.12.97.111:8088;DIRECT";
  57.         if (n < 7)
  58.                 return "PROXY 202.12.97.113:8088; PROXY 202.12.97.120:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.118:8088;PROXY 202.12.97.111:8088;DIRECT";
  59.         if (n < 8)
  60.                 return "PROXY 202.12.97.114:8088; PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  61.         if (n < 9)
  62.                 return "PROXY 202.12.97.115:8088; PROXY 202.12.97.111:8088;PROXY 202.12.97.119:8088;PROXY 202.12.97.100:8088;PROXY 202.12.97.120:8088;DIRECT";
  63.  
  64. }
  65.  
  66. /* make check sum of URL string */
  67. /* v1.0 by SHARP Corp     Copyright 1996-1997 */
  68. function URLhash(name)
  69. {
  70. var  cnt=0;
  71.         var str=name.toLowerCase(name);
  72.         if ( str.length ==0) {
  73.                 return cnt;    
  74.         }
  75.         for(var i=0;i < str.length ; i++) {
  76.            var ch= atoi(str.substring(i,i + 1));
  77.                 cnt = cnt + ch;
  78.         }
  79.  
  80.         return cnt ;
  81. }
  82.  
  83. /*
  84.    URLhash2( ) for directory name hash computing version.
  85.    written by SHARP Corp in Feb 1997
  86.    
  87.    Objects in the same directory will be accessed via the same proxy.
  88.    Use URLhash2( ) instead of URLhash( ) if you prefer to use persistent
  89.    connection in HTTP 1.1
  90.  
  91.    http://www.sharp.co.jp/sample/test/img/mebius.gif
  92.    http://www.sharp.co.jp/sample/test/img/zaurus.gif
  93.    http://www.sharp.co.jp/sample/test/img/wiz.gif
  94.    <------------------------------------->
  95.          directory name hashing here
  96.    
  97. */
  98.  
  99. function URLhash2(name)
  100. {
  101. var  cnt=0;
  102. var  dirptr=0;
  103.  
  104.         var str=name.toLowerCase(name);
  105.         if ( str.length ==0) {
  106.                 return cnt;    
  107.         }
  108.  
  109. /* skip filename in directory */
  110.         for(var i=9; i<str.length; i++) {
  111.                 if ( str.substring(i,i +1) == '/' )  {
  112.                         dirptr = i+1 ;
  113.                         break;
  114.                 }
  115.         }
  116.  
  117.         for(var i=0;i < dirptr; i++) {
  118.            var ch= atoi(str.substring(i,i + 1));
  119.                 cnt = cnt + ch;
  120.         }
  121.  
  122.         return cnt ;
  123. }
  124.  
  125.  
  126. function atoi(charstring)
  127. {
  128.  
  129.         if ( charstring == "a" ) return 0x61; if ( charstring == "b" ) return 0x62;
  130.         if ( charstring == "c" ) return 0x63; if ( charstring == "d" ) return 0x64;
  131.         if ( charstring == "e" ) return 0x65; if ( charstring == "f" ) return 0x66;
  132.         if ( charstring == "g" ) return 0x67; if ( charstring == "h" ) return 0x68;
  133.         if ( charstring == "i" ) return 0x69; if ( charstring == "j" ) return 0x6a;
  134.         if ( charstring == "k" ) return 0x6b; if ( charstring == "l" ) return 0x6c;
  135.         if ( charstring == "m" ) return 0x6d; if ( charstring == "n" ) return 0x6e;
  136.         if ( charstring == "o" ) return 0x6f; if ( charstring == "p" ) return 0x70;
  137.         if ( charstring == "q" ) return 0x71; if ( charstring == "r" ) return 0x72;
  138.         if ( charstring == "s" ) return 0x73; if ( charstring == "t" ) return 0x74;
  139.         if ( charstring == "u" ) return 0x75; if ( charstring == "v" ) return 0x76;
  140.         if ( charstring == "w" ) return 0x77; if ( charstring == "x" ) return 0x78;
  141.         if ( charstring == "y" ) return 0x79; if ( charstring == "z" ) return 0x7a;
  142.         if ( charstring == "0" ) return 0x30; if ( charstring == "1" ) return 0x31;
  143.         if ( charstring == "2" ) return 0x32; if ( charstring == "3" ) return 0x33;
  144.         if ( charstring == "4" ) return 0x34; if ( charstring == "5" ) return 0x35;
  145.         if ( charstring == "6" ) return 0x36; if ( charstring == "7" ) return 0x37;
  146.         if ( charstring == "8" ) return 0x38; if ( charstring == "9" ) return 0x39;
  147.         if ( charstring == "." ) return 0x2e;
  148.         return 0x20;
  149. }
  150.  
  151.  
  152.  
  153.