用perl生成代理脚本
时间:2005-11-11 来源:hellwolf
我们学校的免费ip地址列表需要查询https://account.seu.edu.cn/ip/free.html,格式为:
10.0.0.0 0.255.255.255 255.0.0.0
这样的
我用perl写了个自动生成代理脚本的代码:
#!/bin/env perl
use strict;
open(LIST,'elinks --dump http://account.seu.edu.cn/ip/free.html |')
or die "error open freeip webpage";
print <
function FindProxyForURL(url, host){
if(isPlainHostName(host) || dnsDomainIs(host,".ieeexplore.ieee.org")) return "DIRECT";
HEADER
;
while (){
next if ( ! m/d+.d+.d+.d+/);
$_ =~ s/ *(.*) */1/g;
$_ =~ s/ //g;
(my $ip,undef,my $longmask) = split(/[ ]+/);
print " else if(isInNet(host,"$ip","$longmask"))return "DIRECT"; ";
}
print <
else return "PROXY __RPOXYHOST__:__PROXYPORT__";
}
TAIL
相关阅读 更多 +
排行榜 更多 +