(SHARE) MENGATASI ERROR BUKA YOUTUBE
-
Pfsense : 2.0.2-RELEASE (amd64)
STore Url :
#!/usr/bin/perl
$Rev$
by chudy_fernandez@yahoo.com
Youtube updates at http://wiki.squid-cache.org/ConfigExamples/DynamicContent/YouTube/Discussion
$|=1;
while (<>) {
@X = split;$X[1] =~ s/&sig=.*//;
$x = $X[0] . " ";
$_ = $X[1];
$u = $X[1];#photos-X.ak.fbcdn.net where X a-z
if (m/^http://photos-[a-z]?(.ak.fbcdn.net.*)/) {
print $x . "http://photos" . $1 . "\n";#maps.google.com
} elsif (m/^http://(khm|mt)[0-9]?(.google.com.*)/) {
print $x . "http://" . $1 . $2 . "\n";compatibility for old cached get_video?video_id
} elsif (m/^http://([0-9.]{4}|..youtube.com|..googlevideo.com|..video.google.com).?(videoplayback?id=.?|video_id=.?)&(.*?)/) {
$z = $2; $z =~ s/video_id=/get_video?video_id=/;
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $z . "\n";youtube All itag (semua resolusi)
} elsif ($X[1] =~ /(youtube|google).*videoplayback?/){
@itag = m/&?/;
@id = m/&?/;
@range = m/&?/;
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/@itag&@id&@range\n";End youtube All itag (semua resolusi)
} elsif (m/^http://www.google-analytics.com/__utm.gif?.*/) {
print $x . "http://www.google-analytics.com/__utm.gif\n";#Cache High Latency Ads
} elsif (m/^http://([a-z0-9.])(.doubleclick.net|.quantserve.com|.googlesyndication.com|yieldmanager|cpxinteractive)(.)/) {
$y = $3;$z = $2;
for ($y) {
s/pixel;./pixel/;
s/activity;./activity/;
s/(imgad[^&])./\1/;
s/;ord=[?0-9]//;
s/;×tamp=[0-9]//;
s/[&?]correlator=[0-9]//;
s/&cookie=[^&]//;
s/&ga_hid=[^&]//;
s/&ga_vid=[^&]//;
s/&ga_sid=[^&]*//;s/&prev_slotnames=[^&]*//
s/&u_his=[^&]*//;
s/&dt=[^&]//;
s/&dtd=[^&]//;
s/&lmt=[^&]//;
s/(&alternate_ad_url=http%3A%2F%2F[^(%2F)])[^&]/\1/;
s/(&url=http%3A%2F%2F[^(%2F)])[^&]/\1/;
s/(&ref=http%3A%2F%2F[^(%2F)])[^&]/\1/;
s/(&cookie=http%3A%2F%2F[^(%2F)])[^&]/\1/;
s/[;&?]ord=[?0-9]//;
s/[;&]mpvid=[^&;]//;
s/&xpc=[^&]//;yieldmanager
s/?clickTag=[^&]//;
s/&u=[^&]//;
s/&slotname=[^&]//;
s/&page_slots=[^&]//;
}
print $x . "http://" . $1 . $2 . $y . "\n";#cache high latency ads
} elsif (m/^http://(.?)/(ads)?(.?)/) {
print $x . "http://" . $1 . "/" . $2 . "\n";} elsif (m/^http://(www.ziddu.com..[^/]{3,4})/(.?)/) {
print $x . "http://" . $1 . "\n";#cdn, varialble 1st path
} elsif (($u =~ /filehippo/) && (m/^http://(.?).(.?)/(.?)/(.).([a-z0-9]{3,4})(?.*)?/)) {
@y = ($1,$2,$4,$5);
$y[0] =~ s/[a-z0-9]{2,5}/cdn./;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";#rapidshare
} elsif (($u =~ /rapidshare/) && (m/^http://(([A-Za-z]+[0-9-.]+)?)([a-z].[^/]{3}/[a-z]/[0-9])/(.*?)/([^/?&]{4,})$/)) {
print $x . "http://cdn." . $3 . "/SQUIDINTERNAL/" . $5 . "\n";} elsif (($u =~ /maxporn/) && (m/^http://([^/]?)/(.?)/([^/]?)(?.)?$/)) {
print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";#domain/path/./path/filename
} elsif (($u =~ /fucktube/) && (m/^http://(.?)(.[^.-]?[^/]/[^/])/(.)/([^/])/([^/?&]).([^/?&]{3,4})(?.*?)$/)) {
@y = ($1,$2,$4,$5,$6);
$y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^.]cdn[^.])|([^.]cache[^.]))/cdn/;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "/" . $y[3] . "." . $y[4] . "\n";#like porn hub variables url and center part of the path, filename etention 3 or 4 with or without ? at the end
} elsif (($u =~ /tube8|pornhub|xvideos/) && (m/^http://(([A-Za-z]+[0-9-.]+)?(.[a-z])?).([a-z][0-9]?.[^/]{3}/[a-z])(.?)((/[a-z])?(/[^/]){4}.[^/?]{3,4})(?.)?$/)) {
print $x . "http://cdn." . $4 . $6 . "\n";#for yimg.com video
} elsif (m/^http://(.yimg.com)//(.)/([^/?&]/[^/?&].[^/?&]{3,4})(?.*)?$/) {
print $x . "http://cdn.yimg.com//" . $3 . "\n";#for yimg.com doubled
} elsif (m/^http://(.?).yimg.com/(.?).yimg.com/(.?)?(.)/) {
print $x . "http://cdn.yimg.com/" . $3 . "\n";#for yimg.com with &sig=
} elsif (m/^http://([^.]).yimg.com/(.)/) {
@y = ($1,$2);
$y[0] =~ s/[a-z]+([0-9]+)?/cdn/;
$y[1] =~ s/&sig=.*//;
print $x . "http://" . $y[0] . ".yimg.com/" . $y[1] . "\n";#youjizz. We use only domain and filename
} elsif (($u =~ /media[0-9]{1,5}.youjizz/) && (m/^http://(.?)(.[^.-]?.[^/])/(.)/([^/?&]).([^/?&]{3,4})(?.?)$/)) {
@y = ($1,$2,$4,$5);
$y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|([^.]cdn[^.])|([^.]cache[^.]))/cdn/;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";#general purpose for cdn servers. add above your specific servers.
} elsif (m/^http://([0-9.]?)//(.?).(.)?(.?)/) {
print $x . "http://squid-cdn-url//" . $2 . "." . $3 . "\n";spicific extention
} elsif (m/^http://(.?).(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|wmv|3gp|mp(4|3)|exe|msi|zip|on2|mar|swf).?/) {
@y = ($1,$2);
$y[0] =~ s/((cache|cdn)[-\d])|([a-zA-A]+-?[0-9]+(-[a-zA-Z])?)/cdn/;
print $x . "http://" . $y[0] . "." . $y[1] . "\n";
#generic http://variable.domain.com/path/filename."ex", "ext" or "exte"
#http://cdn1-28.projectplaylist.com
#http://s1sdlod041.bcst.cdn.s1s.yimg.com
} elsif (m/^http://(.?)(.[^.-]?..?)/([^?&=]).([\w\d]{2,4})??.$/) {
@y = ($1,$2,$3,$4);
$y[0] =~ s/([a-z][0-9][a-z]dlod[\d]{3})|((cache|cdn)[-\d])|([a-zA-A]+-?[0-9]+(-[a-zA-Z]*)?)/cdn/;
print $x . "storeurl://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";all that ends with ;
} elsif (m/^http://(.?)/(.?);(.*)/) {
print $x . "http://" . $1 . "/" . $2 . "\n";} else {
print $x . $_ . "\n";
}
}include Conf :
Custom Option Caching Video
acl videocache_allow_url url_regex -i .youtube.com/get_video?
acl videocache_allow_url url_regex -i .youtube.com/videoplayback .youtube.com/videoplay .youtube.com/get_video?
acl videocache_allow_url url_regex -i .youtube.[a-z][a-z]/videoplayback .youtube.[a-z][a-z]/videoplay .youtube.[a-z][a-z]/get_video?
acl videocache_allow_url url_regex -i .googlevideo.com/videoplayback .googlevideo.com/videoplay .googlevideo.com/get_video?
acl videocache_allow_url url_regex -i .google.com/videoplayback .google.com/videoplay .google.com/get_video?
acl videocache_allow_url url_regex -i .google.[a-z][a-z]/videoplayback .google.[a-z][a-z]/videoplay .google.[a-z][a-z]/get_video?
acl videocache_allow_url url_regex -i proxy[a-z0-9-][a-z0-9][a-z0-9][a-z0-9]?.dailymotion.com/
acl videocache_allow_url url_regex -i vid.akm.dailymotion.com/
acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?.xtube.com/(.)flv
acl videocache_allow_url url_regex -i .vimeo.com/(.).(flv|mp4)
acl videocache_allow_url url_regex -i va.wrzuta.pl/wa[0-9][0-9][0-9][0-9]?
acl videocache_allow_url url_regex -i .youporn.com/(.).flv
acl videocache_allow_url url_regex -i .msn.com.edgesuite.net/(.).flv
acl videocache_allow_url url_regex -i .tube8.com/(.).(flv|3gp)
acl videocache_allow_url url_regex -i .mais.uol.com.br/(.).flv
acl videocache_allow_url url_regex -i .blip.tv/(.).(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram|m4v)
acl videocache_allow_url url_regex -i .apniisp.com/(.).(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram|m4v)
acl videocache_allow_url url_regex -i .break.com/(.).(flv|mp4)
acl videocache_allow_url url_regex -i redtube.com/(.).flv
acl videocache_allow_dom dstdomain .mccont.com .metacafe.com .cdn.dailymotion.com
acl videocache_deny_dom dstdomain .download.youporn.com .static.blip.tv
acl dontrewrite url_regex redbot.org .php
acl getmethod method GET
storeurl_access deny dontrewrite
storeurl_access deny !getmethod
storeurl_access deny videocache_deny_dom
storeurl_access allow videocache_allow_url
storeurl_access allow videocache_allow_dom
storeurl_access deny allEnd Custom Option Caching Video
Custom Option storeurl
storeurl_rewrite_program /usr/local/etc/squid/storeurl.pl
storeurl_rewrite_children 7
storeurl_rewrite_concurrency 10
negative ttl 0 secondsEnd Custom Option storeurl
acl snmppublic snmp_community public
cachemgr_passwd none config reconfigure#work around for fragment videos of msn
acl msnvideo url_regex QualityLevel.*Fragment
http_access deny msnvideo#always_direct allow html
#cache_peer localhost parent 4001 0 carp login=PASS name=backend-1
max_stale 10 yearsinclude /usr/local/etc/squid/refresh.conf
#acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
#upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache#read_ahead_gap 0 KB
#ie_refresh on
reload_into_ims onstrip_query_terms off
deny_info TCP_RESET localnet
negative_dns_ttl 1 second
negative_ttl 1 second
snmp_port 3401
snmp_access allow snmppublic all
maximum_single_addr_tries 2
retry_on_error on
n_aiops_threads 64
#request_header_max_size 128 KB
#reply_header_max_size 128 KB
#range_offset_limit 10 MB
vary_ignore_expire on
#client_db off # this needs to be on for acl maxconn to work
ipcache_size 4096
fqdncache_size 20
#tcp_recv_bufsize 64 KB
pipeline_prefetch on
#half_closed_clients off0x10 no delay, 0x08 throughput, 0x04 reliability
0x10 10000 (minimize delay) Use delay metric
0x08 01000 (maximize throughput) Use default metric
0x04 00100 (maximize reliability) Use reliability metric
0x02 00010 (minimize monetary cost) Use cost metric
dscp squidtos+ECN
56 0xE0 11100000
48 0xc0 11000000
08 0x20 00100000
32 0x80 10000000
16 0x40 01000000
#tcp_outgoing_tos 0x03 video
#tcp_outgoing_tos 0xb8 html
#tcp_outgoing_tos 0x20 images
#tcp_outgoing_tos 0x02 all#zph_mode tos
#zph_local 0xb8
#zph_parent 0x08#acl monitor url_regex avira
#logformat chudy %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm="" %ru="" %mt="" http%rv="" rq[%="">h] Rp[%<h]<br>#access_log /var/squid/log/access2.log chudy monitor#buffered_logs on
#download_fastest_client_speed on
#acl text rep_header Content-Type -i text/
#acl hit rep_header X-Cache -i hit
#acl partial rep_header Content-Range .*
#log_access deny partial
#log_access deny php
#log_access deny text
#log_access deny hit
#log_access deny html
#log_access deny !getmethod
high_page_fault_warning 50
#log_access deny managerCustom Option Youtube non-range (utuh)
quick_abort_min -1 KB
acl ytrange url_regex ^.*youtube.com/videoplayback.range=.$
http_access deny ytrangeEnd Custom Option Youtube non-range (utuh)
refresh Conf :
$Rev$
chudy_fernandez@yahoo.com
1 year = 525600 mins, 1 month = 43800 mins
refresh_pattern (get_video|videoplayback|videodownload|.flv).(begin|start)=[1-9][0-9] 0 0% 0
refresh_pattern imeem..flv 0 0% 0 override-lastmod override-expire
refresh_pattern ^ftp: 40320 20% 40320 override-expire reload-into-ims store-stale
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern code.googlec.com.(svn|download) 0 50% 1440 reload-into-ims#ads
refresh_pattern ^.(streamate.doublepimp.com..js?|utm.gif|ads?|rmxads.com|ad.z5x.net|bh.contextweb.com|bstats.adbrite.com|a1.interclick.com|ad.trafficmp.com|ads.cubics.com|ad.xtendmedia.com|.googlesyndication.com|advertising.com|yieldmanager|game-advertising.com|pixel.quantserve.com|adperium.com|doubleclick.net|adserving.cpxinteractive.com|syndication.com|media.fastclick.net).* 5259487 20% 5259487 ignore-no-cache ignore-no-store ignore-private override-expire ignore-reload ignore-auth ignore-must-revalidate store-stale negative-ttl=40320 max-stale=1440#antivirus
refresh_pattern avast.com..vpx 40320 50% 161280 store-stale reload-into-ims
refresh_pattern (avgate|avira)..(idx|gz)$ 1440 90% 1440 ignore-reload ignore-no-cache ignore-no-store store-stale ignore-must-revalidate
refresh_pattern kaspersky..avc$ 5259487 999999% 5259487 ignore-reload store-stale
refresh_pattern kaspersky 1440 50% 161280 ignore-no-cache store-stale
refresh_pattern mbamupdates.com..ref 1440 50% 161280 reload-into-ims store-stale#specific sites
refresh_pattern .rapidshare./[0-9]/./[^/] 161280 90% 161280 ignore-reload store-stale
refresh_pattern (get_video?|videoplayback?|videodownload?|.flv?|.fid?) 5259487 99999999% 5259487 override-expire ignore-reload store-stale ignore-private negative-ttl=0
refresh_pattern .(ico|video-stats) 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern .etology? 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern galleries.video(?|sz) 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern brazzers? 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern .adtology? 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern ^.safebrowsing.google 5259487 999999% 5259487 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern ^http://((cbk|mt|khm|mlt)[0-9]?).google.co(m|.uk) 5259487 999999% 5259487 override-expire ignore-reload store-stale ignore-private negative-ttl=10080
refresh_pattern ytimg.com..(jpg|png) 5259487 999999% 5259487 override-expire ignore-reload store-stale
refresh_pattern images.friendster.com..(png|gif) 5259487 999999% 5259487 override-expire ignore-reload store-stale
refresh_pattern ((facebook.com)|(85.131.151.39))..(png|gif) 5259487 999999% 5259487 override-expire ignore-reload store-stale
refresh_pattern garena.com 5259487 999999% 5259487 override-expire reload-into-ims store-stale
refresh_pattern photobucket..(jp(e?g|e|2)|tiff?|bmp|gif|png) 5259487 999999% 5259487 override-expire ignore-reload store-stale
refresh_pattern vid.akm.dailymotion.com..on2? 5259487 999999% 5259487 ignore-no-cache override-expire override-lastmod store-stale
refresh_pattern .fbcdn.net..(jpg|gif|png) 5259487 999999% 5259487 ignore-no-cache override-expire ignore-reload store-stale negative-ttl=0
refresh_pattern ^http://images|pics|thumbs[0-9]. 5259487 999999% 5259487 ignore-no-cache ignore-no-store ignore-reload override-expire store-stale
refresh_pattern ^http://www.onemanga.com./ 5259487 999999% 5259487 reload-into-ims override-expire store-stale
refresh_pattern mediafire.com/images..(jp(e?g|e|2)|tiff?|bmp|gif|png) 5259487 999999% 5259487 reload-into-ims override-expire ignore-private store-stale#general
refresh_pattern .(jp(e?g|e|2)|tiff?|bmp|gif|png) 5259487 999999% 5259487 ignore-no-cache ignore-no-store reload-into-ims override-expire ignore-must-revalidate store-stale
refresh_pattern .(z(ip|[0-9]{2})|r(ar|[0-9]{2})|jar|bz2|gz|tar|rpm|vpu) 5259487 999999% 5259487 override-expire reload-into-ims
refresh_pattern .(mp3|wav|og(g|a)|flac|midi?|rm|aac|wma|mka|ape) 5259487 999999% 5259487 override-expire reload-into-ims ignore-reload
refresh_pattern .(exe|msi|dmg|bin|xpi|iso|swf|mar|psf|cab) 5259487 999999% 5259487 override-expire reload-into-ims ignore-no-cache ignore-must-revalidate
refresh_pattern .(mpeg|ra?m|avi|mp(g|e|4)|mov|divx|asf|wmv|m\dv|rv|vob|asx|ogm|flv|3gp|on2) 5259487 9999999% 5259487 override-expire reload-into-ims
refresh_pattern -i (cgi-bin) 0 0% 0
refresh_pattern .(php|jsp|cgi|asx)? 0 0% 0
refresh_pattern . 0 50% 161280 store-staleMohon bantuan Pada Master sekalian …</h]<br></st>
-
Include.conf
Refresh.conf
Storeurl.pl diatas saya coba test berjalan. Youtube tercache.Nah.. Seandainya belum tercache coba di cek
Squid.conf ?
Firewall rules ? -
mau nanya gan proxy tadinya baik aja bisa hit youtube, sejak kemaren tiap buka youtube yang keluar klip yang sama…???
trs saya rubah storeurl.pl dari chudy_fernandez@yahoo.com defoult youtube g bisa cache???
dan itu terjadi pada yang lain dengan masalah yang sama minta solusi gan??
apa bener youtube lg update system???
maklum nuwbie.................. -
repot deh kalo maenan dengan youtube2 an …
kembali ke konsep awal lagi saja, sembari ngarepin koneksi broadband di kita terus membaik.
after all ... emang jadi tantangan tersendiri dan kepuasan tersendiri juga ngoprek untuk terus2 an berusaha HIT
pasti akan sampe pada titik boring deh ...keep explore, happy oprek ...
-
repot deh kalo maenan dengan youtube2 an …
kembali ke konsep awal lagi saja, sembari ngarepin koneksi broadband di kita terus membaik.
after all ... emang jadi tantangan tersendiri dan kepuasan tersendiri juga ngoprek untuk terus2 an berusaha HIT
pasti akan sampe pada titik boring deh ...keep explore, happy oprek ...
Om Serangku, ada clue dari Om Syaifuddin JW….
Mudah2an bisa diterapkan di Pfsense....di U***** server:
build squid dengan opsi "–enable-referer-log"
lalu install paket pendukungnya
apt-get install libfile-readbackwards-perlsquid config
referer_log /var/log/squid/referer.logstoreurl.pl (revisi untuk youtube yg sudah ada)
kode pastebin http://pastebin.com/TGLBtZ5Z
dan bagian akhir file tambahkan ini
sub GetID{
use File::ReadBackwards;
my $ref_log = File::ReadBackwards->new('/var/log/squid/referer.log');
while (defined($line = $ref_log->readline)){
if ($line =~ m/.youtube./watch?.v=([a-zA-Z0-9-_]).*\s.id=$IDS[0]./){
$id = $1;
last;
}
if ($line =~ m/.youtube./ptracking.cpn=$CPN[0].video_id=([a-zA-Z0-9-_])./){
$id = $1;
last;
}
if ($line =~ m/.youtube./ptracking.video_id=([a-zA-Z0-9-_]).cpn=$CPN[0]./){
$id = $1;
last;
}
}
$ref_log->close();
return $id;
}Menunggu pencerahan dari Om Master2 PFSENSE….berharap mode on
-
ikut nunggu ah…....... :o :o :o :o
-
SIAPKAN KOPI PANAS BUAT PARA MASTER….. :o :o :o :o
-
hasilnya bagaimana dengan storeurl ini mas…??
ada yang bisa share
terus yang ane tanyakan koq ane lihat link ini http://pastebin.com/TGLBtZ5Z katanya "Private Paste ID: TGLBtZ5Z" padahal ane udah ada accountnya…
apakah ane perlu minta izin ke yang punya klo ane harus minta izin ane dengan memohon minta dong dengan pemilik file ini supaya di bukakan lagi hak aksesnya..
terima kasih
-
mohon petunjuk master….(post diatas) ;D
-
refresh…............
-
bagaimana kelanjutannya nih…??
koq pada diem ya
-
MASTER2 COMENT DIKIT…..
;D -
AGAK LAMBAT RESPECT DARI FORUM LAENNYA
-
repot deh kalo maenan dengan youtube2 an …
kembali ke konsep awal lagi saja, sembari ngarepin koneksi broadband di kita terus membaik.
after all ... emang jadi tantangan tersendiri dan kepuasan tersendiri juga ngoprek untuk terus2 an berusaha HIT
pasti akan sampe pada titik boring deh ...keep explore, happy oprek ...
Om Serangku, ada clue dari Om Syaifuddin JW….
Mudah2an bisa diterapkan di Pfsense....di U***** server:
build squid dengan opsi "–enable-referer-log"
lalu install paket pendukungnya
apt-get install libfile-readbackwards-perlsquid config
referer_log /var/log/squid/referer.logstoreurl.pl (revisi untuk youtube yg sudah ada)
kode pastebin http://pastebin.com/TGLBtZ5Z
dan bagian akhir file tambahkan ini
sub GetID{
use File::ReadBackwards;
my $ref_log = File::ReadBackwards->new('/var/log/squid/referer.log');
while (defined($line = $ref_log->readline)){
if ($line =~ m/.youtube./watch?.v=([a-zA-Z0-9-_]).*\s.id=$IDS[0]./){
$id = $1;
last;
}
if ($line =~ m/.youtube./ptracking.cpn=$CPN[0].video_id=([a-zA-Z0-9-_])./){
$id = $1;
last;
}
if ($line =~ m/.youtube./ptracking.video_id=([a-zA-Z0-9-_]).cpn=$CPN[0]./){
$id = $1;
last;
}
}
$ref_log->close();
return $id;
}Menunggu pencerahan dari Om Master2 PFSENSE….berharap mode on
use File::ReadBackwards;
buat baca file per line, masalahnya gak include di standard perl nih, harus di install pake pkg-add
ni masalah PACKAGESITE source ftpnya freebsd di kutak katik sama pfsense kadang nambah package2 std freebsd aja jadi unable to fetch bla..blah gitu..
hmm.. stay tune.
brb.
-
jadi gimana solusinya nih gans…??
-
SEKEDAR share install readbackward.pm di pfsense sesuai yang diajarkan om rb.nababan
install package dari puttypkg_add -r http://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/perl5/p5-File-ReadBackwards-1.05.tbz
-
ngetest readbackward udah terinstall atau belum, bisa pake kode ini:
#!/usr/bin/perl use File::ReadBackwards; $fh = File::ReadBackwards->new('/var/squid/log/access.log') or die "can't read file: $!\n"; while ( defined($line = $fh->readline) ) { print $line ; }
simpan dengan nama cobaReadBack.pl
lalu jalankan dengan perl cobaReadBack.pl, kalo ReadBackWards udah terinstall dengan baik, maka file squid/log/access.log akan ditampilkan secara terbalik ( dari akhir file ) alias BackWard.. itu sebabnya kang ucok karnadi pake library ini… baca file lognya dari belakang alias baris yang dibaca dulu adalah yang terakhir disimpan / ditambahkan kedalam log. CMIIW
-
sesuaikan storeurl dengan style squid pfsense.
perubahan di bagian akhir storeurl.pl
ub GetID { $id = ""; use File::ReadBackwards; my $lim = 200 ; my $ref_log = File::ReadBackwards->new('/var/squid/log/yt.log'); while (defined($line = $ref_log->readline)) { if ($line =~ m/.*youtube.*\/watch\?.*v=([a-zA-Z0-9\-\_]*).*\s.*id=$IDS[0].*/){ $id = $1; last; } if ($line =~ m/.*youtube.*\/.*cpn=$CPN[0].*[&](video_id|docid|v)=([a-zA-Z0-9\-\_]*).*/){ $id = $2; last; } if ($line =~ m/.*youtube.*\/.*[&?](video_id|docid|v)=([a-zA-Z0-9\-\_]*).*cpn=$CPN[0].*/){ $id = $2; last; } last if --$lim <= 0; } if ($id eq ""){ $id = $IDS[0]; } $ref_log->close(); return $id; }
original storeurl.pl ada di http://tempat-sampah.googlecode.com/svn/storeurl.pl
dan edit /usr/local/etc/squid/include.conf karena kita gak boleh edit squid.conf langsung.
tambahkan kode ini paling atasnya sesuai petunjuk ucok karnady
strip_query_terms off acl yutub url_regex -i .*youtube\.com\/.*$ acl yutub url_regex -i .*youtu\.be\/.*$ logformat squid1 %{Referer}>h %ru access_log /var/squid/log/yt.log squid1 yutub acl redirec urlpath_regex -i .*&redirect_counter=1&cms_redirect=yes acl redirec urlpath_regex -i .*&ir=1&rr=12 cache deny redirec acl reddeny url_regex -i c\.youtube\.com\/videoplayback.*redirect_counter=1.*$ acl reddeny url_regex -i c\.youtube\.com\/videoplayback.*cms_redirect=yes.*$ storeurl_access deny reddeny
udah silakan dicoba dan share hasilnya … :P :D
-
hasilnya bagaimana nih para mastah….
-
maaf saya mau tanya, untuk lusca berarti ga diperlukan enable-referrer-log nya ya ?