#! /bin/bash
temfile="$HOME/temp.$$"
tmp_proxy_file="$HOME/tmp_proxy.$$"
proxyfile="$HOME/proxy.txt"
proxyurl='http://www.textproxylists.com/proxy.php?allproxy'
trap "rm -f $temfile $tmp_proxy_file ; exit 1" 1 2
if [ -f "$proxyfile" ]
then
echo -n "Would you like to keep old $proxyfile? [y|n] "
read
case "$REPLY" in
Y|y) savedfile="$HOME/proxy-$(date +%Y%m%d).txt"
mv -f "$proxyfile" "$savedfile"
;;
*) rm -f "$proxyfile"
;;
esac
fi
echo ""
echo "We are going to download proxies, this may be take a long time."
echo "Please wait.., press Ctrl-C to terminate."
echo ""
if curl -s "$proxyurl" > "$temfile"
then
grep -E '[0-9\.]+:[0-9]+' "$temfile" > "$tmp_proxy_file"
else
echo "Could not found $temfile."
exit 1
fi
i=0 ; x=0
pattern='^[Cc]ountry:[ \t]+[Hh][Kk]|[Cc][Nn]|[Mm][Oo]'
while read line ; do
proxy=$(echo "$line" | cut -d: -f1)
search=$(whois "$proxy")
sleep 1
if echo "$search" | grep -E "$pattern" &> /dev/null
then
((x++))
continue
fi
if ! echo "$search" | grep -E '^[Cc]ountry:' &> /dev/null
then
((x++))
continue
fi
echo "$line" >> "$proxyfile" && ((i++))
done < "$tmp_proxy_file"
echo "$proxyfile is created. $i proxies,"
echo "$x proxies are deleted,located at Hong Kong, China, Macau or unknown"
echo "pls import file to Multiproxy."
rm -f "$temfile" "$tmp_proxy_file"
exit 0
#! /bin/bash
temfile="$HOME/temp.$$"
tmp_proxy_file="$HOME/tmp_proxy.$$"
proxyfile="$HOME/proxy.txt"
proxyurl='http://www.textproxylists.com/proxy.php?allproxy'
trap "rm -f $temfile $tmp_proxy_file ; exit 1" 1 2
if [ -f "$proxyfile" ]
then
echo -n "Would you like to keep old $proxyfile? [y|n] "
read
case "$REPLY" in
Y|y) savedfile="$HOME/proxy-$(date +%Y%m%d).txt"
mv -f "$proxyfile" "$savedfile"
;;
*) rm -f "$proxyfile"
;;
esac
fi
echo ""
echo "We are going to download proxies, this may be take a long time."
echo "Please wait.., press Ctrl-C to terminate."
echo ""
if curl -s "$proxyurl" > "$temfile"
then
grep -E '[0-9\.]+:[0-9]+' "$temfile" > "$tmp_proxy_file"
else
echo "Could not found $temfile."
exit 1
fi
i=0 ; x=0
while read line ; do
proxy=$(echo "$line" | cut -d: -f1)
search=$(whois "$proxy")
sleep 1
if echo "$search" | grep -E '^[Cc]ountry:[ \t]+[Hh][Kk]' &> /dev/null
then
((x++))
continue
fi
if echo "$search" | grep -E '^[Cc]ountry:[ \t]+[Cc][Nn]' &> /dev/null
then
((x++))
continue
fi
if echo "$search" | grep -E '^[Cc]ountry:[ \t]+[Mm][Oo]' &> /dev/null
then
((x++))
continue
fi
if ! echo "$search" | grep -E '^[Cc]ountry:' &> /dev/null
then
((x++))
continue
fi
echo "$line" >> "$proxyfile" && ((i++))
done < "$tmp_proxy_file"
echo "$proxyfile is created. $i proxies,"
echo "$x proxies are deleted,located at Hong Kong, China, Macau or unknown"
echo "pls import file to Multiproxy."
rm -f "$temfile" "$tmp_proxy_file"
exit 0
#! /bin/bash
# this script must be worked together with another perl script, geoip
# public domain
temfile="$HOME/temp.$$"
tmp_proxy_file="$HOME/tmp_proxy.$$"
proxyfile="$HOME/proxy.txt"
proxyurl='http://www.textproxylists.com/proxy.php?allproxy'
trap "rm -f $temfile $tmp_proxy_file ; exit 1" 1 2
if [ -f "$proxyfile" ]
then
echo -n "Would you like to keep old $proxyfile? [y|n] "
read
case "$REPLY" in
Y|y) savedfile="$HOME/proxy-$(date +%Y%m%d).txt"
mv -f "$proxyfile" "$savedfile"
;;
*) rm -f "$proxyfile"
;;
esac
fi
echo ""
echo "We are going to download proxies, this may be take a long time."
echo "Please wait.., press Ctrl-C to terminate."
echo ""
if curl -s "$proxyurl" > "$temfile"
then
grep -E '[0-9\.]+:[0-9]+' "$temfile" > "$tmp_proxy_file"
else
echo "Could not found $temfile."
exit 1
fi
i=0
while read line ; do
proxy=$(echo "$line" | cut -d: -f1)
search=$(geoip "$proxy") # calling perl script, geoip
sleep 1
if echo "$search" | grep -i 'hong kong' ; then
continue
fi
if echo "$search" | grep -i 'China' ; then
continue
fi
if echo "$search" | grep -i 'macau' ; then
continue
fi
if echo "$search" | grep -i 'unknown' ; then
continue
fi
echo "$line" >> "$proxyfile" && ((i++))
done < "$tmp_proxy_file"
echo "$proxyfile is created. $i proxies, pls import to Multiproxy1.2a."
rm -f "$temfile" "$tmp_proxy_file"
exit 0
#! /usr/bin/perl
# usage: geoip [given ip] , public domain
# perl version: 5.10.X
use strict;
use warnings;
use LWP::Simple;
use File::Basename;
my $name = basename($0);
my $usage = "Usage:\t $name ip";
my $ip = $ARGV[0] || die "$usage\n";
my $url = "http://www.geody.com/geoip.php?ip=${ip}";
my $search = get($url) or die "Could not open $url: $!\n";
my @search = split /\n/, $search;
my @city = grep /^IP:/, @search;
my $city = join " ", @city;
$city =~ s/<[^>]+>//g;
print "$city\n";
在 0.047 秒内创建了带有 18 查询的页面。