Bagi yang penasaran aja...
Manipulasi speedtest (speed, IP, ISP)-squid 3.x TPROXY mode Feat Apache2 dalam 1 mesin
===url:
http://www.speedtest.net/
http://speedtest.telin.co.id/
http://speedtest.cbn.net.id/
===sample url yg direwrite:
--speedtest >> unt yg ini uda pada jago
http://nms-bdg.neuviz.net.id/speedtest/speedtest/latency.txt?x=1458959070078
http://nms-bdg.neuviz.net.id/speedtest/speedtest/random350x350.jpg?x=1458959071250&y=1
http://nms-bdg.neuviz.net.id/speedtest/speedtest/upload.php?x=0.17716197622939944
--IP/ISP
http://www.speedtest.net/id/speedtest-config.php?x=1439780380789
http://api.ookla.com/ipaddress.php
=======script rewriter.pl======
#!/usr/bin/perl
# @ http://www2.fh-lausitz.de/launic/comp/misc/squid/projekt_youtube/
# referensi dan terimakasih khususnya pada MikroTiker N SquidLover-Ces Pun-Syaifudin JW aka Ucok Karnadi
#### var
use IO::File;
$|=1;
STDOUT->autoflush(1);
$debug=0; ## recommended:0
$bypassallrules=0; ## recommended:0
$sucks=""; ## unused
$sucks="sucks" if ($debug>=1);
$timenow="";
$printtimenow=1; ## print timenow: 0|1
my $logfile = '/tmp/rewrite-ruwet.log';
open my $logfh, '>>', $logfile
or die "Couldn't open $logfile for appending: $!\n" if $debug;
$logfh->autoflush(1) if $debug;
while (<>) {
$timenow=time()." " if ($printtimenow);
#print $logfh "$timenow"."in : $_" if ($debug>=1);
#print $logfh "in : $_" if ($debug>=1);
chop; ## strip eol
my $urlku = $_;
#@X = split;
@X = split(" ",$urlku);
$a = $X[0]; ## chanel
$b = $X[1]; ## url
$c = $X[2]; ## ip
$u = $b; ## url
print $logfh "in : $_\n" if ($debug>=1);
if ($bypassallrules){
$out="$u"; ## map 1:1
} elsif ($u=~ m/^http:\/\/.*\/(speedtest\/.*)/) {
$out="OK rewrite-url=http://192.168.4.1:8081/$1";
} elsif ($u=~ m/^http:\/\/.*speedtest\.net\/id\/(.*)/) {
$out="OK rewrite-url=http://192.168.4.1:8081/speedtest/$1";
} elsif ($u=~ m/^http:\/\/.*api\.ookla\.com\/(.*)/) {
$out="OK rewrite-url=http://192.168.4.1:8081/speedtest/$1";
} else {
$out="ERR";
}
print $logfh "out: $a $out\n" if ($debug>=1);
print "$a $out\n";
}
close $logfh if ($debug);
===edit squid.conf
acl speedtest url_regex \/speedtest\/.*\.(jpg|png|txt|php).*
acl speedtest2 url_regex ^http:\/\/.*speedtest\.net\/id\/.*\.php.*
acl speedtest3 url_regex ^http:\/\/.*api\.ookla\.com\/.*\.php
url_rewrite_access allow speedtest
url_rewrite_access allow speedtest2
url_rewrite_access allow speedtest3
url_rewrite_access deny all
url_rewrite_program /etc/squid/rewrite-ruwet.pl
redirector_bypass on
cache_peer 192.168.4.1 parent 8081 0 no-digest no-tproxy
dead_peer_timeout 5 seconds
cache_peer_access 192.168.4.1 allow speedtest
cache_peer_access 192.168.4.1 allow speedtest2
cache_peer_access 192.168.4.1 allow speedtest3
cache_peer_access 192.168.4.1 deny all
url_rewrite_children 32 startup=10 idle=1 concurrency=50
Reff tambahan yg msh gagal:
http://www.squid-cache.org/Doc/config/always_direct/
http://www.squid-cache.org/Doc/config/never_direct/
0 comments:
Post a Comment