Wifi через прокси при помощи wpad.dat
Описание проблемы:
На работе интернет работает через прокси. Конфигурация происходит через wpad.dat. На стационарных компах просто указываю под галочкой "использовать скрипт автоматической настройки" адрес к этому файлу и всё работает. Но недавно приобрёл планшетный ПК, под управлением Android. Ни в одной проге для работы с прокси не нашёл возможности использовать wpad.
По сути, wpad.dat содержит адреса прокси, верно? Значит можно их найти и ввести вручную.
Вот содержание файла:
читать дальше »
//Copyright (c) 1997-2006 Microsoft Corporation
BackupRoute="DIRECT";
UseDirectForLocal=true;
ConvertUrlToLowerCase=false;
function MakeIPs(){
this[0]= new IpSubnet("127.0.0.0", "255.0.0.0", "127.0.0.0/8");
this[1]= new IpSubnet("1.1.1.1", "255.255.255.255", "1.1.1.1/32");
this[2]= new IpSubnet("10.0.0.0", "255.0.0.0", "10.0.0.0/8");
this[3]= new IpSubnet("172.16.0.0", "255.240.0.0", "172.16.0.0/12");
this[4]= new IpSubnet("188.93.61.14", "255.255.255.255", "188.93.61.14/32");
this[5]= new IpSubnet("192.168.0.0", "255.255.0.0", "192.168.0.0/16");
this[6]= new IpSubnet("85.233.69.160", "255.255.255.240", "85.233.69.160/28");
this[7]= new IpSubnet("85.233.69.128", "255.255.255.224", "85.233.69.128/27");
this[8]= new IpSubnet("85.233.69.0", "255.255.255.128", "85.233.69.0/25");
this[9]= new IpSubnet("85.233.68.0", "255.255.255.0", "85.233.68.0/24");
this[10]= new IpSubnet("85.233.64.0", "255.255.252.0", "85.233.64.0/22");
this[11]= new IpSubnet("85.233.69.192", "255.255.255.192", "85.233.69.192/26");
this[12]= new IpSubnet("85.233.70.0", "255.255.254.0", "85.233.70.0/23");
this[13]= new IpSubnet("85.233.72.0", "255.255.248.0", "85.233.72.0/21");
}
DirectIPs=new MakeIPs();
cDirectIPs=14;
function MakeCARPExceptions(){
this[0]="*.windowsupdate.com";
this[1]="windowsupdate.microsoft.com";
this[2]="*.windowsupdate.microsoft.com";
this[3]="*.update.microsoft.com";
this[4]="download.windowsupdate.com";
this[5]="download.microsoft.com";
this[6]="*.download.windowsupdate.com";
this[7]="wustat.windows.com";
this[8]="ntservicepack.microsoft.com";
this[9]="forefrontdl.microsoft.com";
}
CARPExceptions=new MakeCARPExceptions();
cCARPExceptions=10;
function MakeNames(){
this[0]="edu.tatar.ru";
this[1]="wifiauth.tatar.ru";
this[2]="tatar.mail.ru";
this[3]="127.0.0.1";
this[4]="drweb.edu.tatar.ru";
}
DirectNames=new MakeNames();
cDirectNames=5;
HttpPort="8080";
cNodes=1;
function MakeProxies(){
this[0]=new Node("85.233.69.182",1526611700,1.000000);
}
Proxies = new MakeProxies();
function Node(name, hash, load){
this.name = name;
this.hash = hash;
this.load = load;
this.score = 0;
return this;
}
function IpSubnet(ip, mask, prefix){
this.ip = ip;
this.mask = mask;
this.prefix = prefix;
var isIpV4Addr = /^(\d+.){3}\d+$/;
this.isIpv6 = !isIpV4Addr.test(ip);
return this;
}
var pfDnsResolve, pfMyIpAddress, pfIsInNet;
function DnsResolve(name){
return dnsResolve(name);
}
function DnsResolveEx(name){
return dnsResolveEx(name);
}
function IsInNet(ip, subnet){
var isIpV4Addr = /^(\d+.){3}\d+$/;
if(subnet.isIpv6 || !isIpV4Addr.test(ip)){
return false;
}
return isInNet(ip, subnet.ip, subnet.mask);
}
function IsInNetEx(ip, subnet) {
return isInNetEx(ip, subnet.prefix);
}
function MyIpAddress(){
return myIpAddress();
}
function MyIpAddressEx(){
return myIpAddressEx();
}
function ExpMatch(str, exp){
if (ConvertUrlToLowerCase)
{
str = str.toLowerCase();
}
return shExpMatch(str, exp);
}
function FindProxyForURL(url, host){
pfDnsResolve = DnsResolve;
pfMyIpAddress = MyIpAddress;
pfIsInNet = IsInNet;
return ImplementFindProxyForURL(url, host);
}
function FindProxyForURLEx(url, host){
pfDnsResolve = DnsResolveEx;
pfMyIpAddress = MyIpAddressEx;
pfIsInNet = IsInNetEx;
return ImplementFindProxyForURL(url, host);
}
function ImplementFindProxyForURL(url, host){
var hash=0, urllower, i, fIp=false, ip, iparray, nocarp=false, skiphost=false;
var list="", pl, j, score, ibest, bestscore;
urllower = url.toLowerCase();
if((urllower.substring(0,5)=="rtsp:") ||
(urllower.substring(0,6)=="rtspt:") ||
(urllower.substring(0,6)=="rtspu:") ||
(urllower.substring(0,4)=="mms:") ||
(urllower.substring(0,5)=="mmst:") ||
(urllower.substring(0,5)=="mmsu:"))
return "DIRECT";
if(UseDirectForLocal){
if(isPlainHostName(host))
fIp = true;}
for(i=0; i<cDirectNames; i++){
if(ExpMatch(host, DirectNames[i])){
fIp = true;
break;}
if(ExpMatch(url, DirectNames[i]))
return "DIRECT";
}
if(cDirectIPs == 0){
if(fIp)
return "DIRECT";}
else{
ip = host;
if(fIp)
ip = pfDnsResolve(host);
iparray = ip.split(";");
for(j=0; j<iparray.length; j++){
for(i=0; i<cDirectIPs; i++){
if(pfIsInNet(iparray[j], DirectIPs[i]))
return "DIRECT";}}
if(isPlainHostName(host))
return "DIRECT";
}
if(cCARPExceptions > 0){
for(i = 0; i < cCARPExceptions; i++){
if(ExpMatch(host, CARPExceptions[i])){
nocarp = true;}
if(ExpMatch(url, CARPExceptions[i])){
nocarp = true;
skiphost = true;
break;
}}}
if(!skiphost)
hash = HashString(host,hash);
if(nocarp)
hash = HashString(pfMyIpAddress(), hash);
pl = new Array();
for(i = 0; i<cNodes; i++){
Proxies[i].score = Proxies[i].load * Scramble(hash ^ Proxies[i].hash);
pl[i] = i;
}
for(j = 0; j < cNodes; j++){
bestscore = -1;
for(i = 0; i < cNodes-j; i++){
score = Proxies[pl[i]].score;
if(score > bestscore){
bestscore = score;
ibest = i;
}}
list = list + "PROXY " + Proxies[pl[ibest]].name + ":" + HttpPort + "; ";
pl[ibest] = pl[cNodes-j-1];
}
list = list + BackupRoute;
return list;
}
var h_tbl = new Array(0,0x10D01913,0x21A03226,0x31702B35,0x4340644C,0x53907D5F,0x62E0566A,0x72304F
79,0x8680C898,0x9650D18B,0xA720FABE,0xB7F0E3AD,0xC5C0ACD4,0xD510B5C7,0xE4609EF2,
0
xF4B087E1);
function HashString(str, h){
for(var i=0; i<str.length; i++){
var c = str.charAt(i);
if(c ==':' || c == '/') break;
c = CharToAscii(c.toLowerCase());
h = (h >>> 4) ^ h_tbl[(h ^ c) & 15];
h = (h >>> 4) ^ h_tbl[(h ^ (c>>>4)) & 15];
h = MakeInt(h);
}
return h;
}
function Scramble(h){
h += ((h & 0xffff) * 0x1965) + ((((h >> 16) & 0xffff) * 0x1965) << 16) + (((h & 0xffff) * 0x6253) << 16);
h = MakeInt(h);
h += (((h & 0x7ff) << 21) | ((h >> 11) & 0x1fffff));
return MakeInt(h);
}
function CharToAscii(c){
return c.charCodeAt(0);
}
function MakeInt(x){
x %= 4294967296;
if(x < 0)
x += 4294967296;
return x;
}
Сам в коде разобраться не смог, прошу гуру, подскажите, как мне настроить интернет?
ЗЫ В Андроиде настраивается только обычный прокси (адрес,порт,логин, пароль и тп)
|