1. Access google
2. Access google
What should we prepare for it ?
1. A vps in Sigapore (Ubuntu)
2. A Linux server inside (CentOS)
In Linux Server:
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub -> copy the content to VPS's ~/.ssh/authoirzed_keys
check.php
#!/usr/bin/php
<?php
// 程序使用csp.pl 通过socket proxy 192.168.50.247 9999 检测www.youtube.com是否可以打开
$lineNum=system('perl csp.pl | wc -l');
if ($lineNum==1) {
system('echo `date` 停止运行 >> result');
system("ps aux | grep ssh | grep 9999 | awk '{print $2}' | xargs -i kill -9");
system("nohup ssh -ND 0.0.0.0:9999 root@sigapore.myciscolab.net&");
}
elseif ($lineNum>1000) {
system('echo `date` 正在运行 >> result');
}
else {
system('echo `date` 状态异常 >> result');
}
?>
csp.pl
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(
agent => q{Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.2.0; .NET
CLR 1.1.4322)},
);
$ua->proxy([qw/ http https /] => 'socks://192.168.50.247:9999'); # Tor proxy
$ua->cookie_jar({});
my $rsp = $ua->get('http://www.youtube.com/');
print $rsp->content;
Client:
Tunnel Switch:
Type: Socket5
IP: 192.168.50.247
Port: 9999
没有评论:
发表评论