Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #storeid.pl & squid.conf
- #by punces
- #!/usr/bin/perl
- $|=1;
- while (<>) {
- @X = split;
- if ($X[0] =~ m/^http.*/) {
- $url = $X[0];
- $referer = $X[1];
- $urlreferer = $X[0] ." ". $X[1];
- } else {
- $chanel = $X[0];
- $url = $X[1];
- $referer = $X[2];
- $urlreferer = $X[1] ." ". $X[2];
- }
- #youtube googlevideo
- if ($url =~ m/^https?\:\/\/.*google.*video(playback|goodput).*/){
- @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
- @id = m/[=%&?\/]id[=%&?\/]([^\&\s]*)/;
- @itag = m/[=%&?\/]itag[=%&?\/]([\d]*)/;
- @range = m/[=%&?\/]range[=%&?\/]([\d]*-[\d]*)/;
- @mime = m/[=%&?\/]mime[=%&?\/]([^\&\s]*)/;
- if ($referer =~ m/^https?\:\/\/(www|gaming)\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
- @id = $3;
- } else {
- if (defined(@cpn[0])){
- if (-e "/tmp/@cpn"){
- open FILE, "/tmp/@cpn";
- @id = <FILE>;
- close FILE;
- }
- }
- }
- $out="OK store-id=http://squid/google/video/id=@id/itag=@itag/mime=@mime/range=@range";
- #youtube parameter
- } elsif (
- ($url =~ m/^https?\:\/\/.*youtube.*(stream_204|watchtime|qoe|atr|csi_204|playback).*[=%&?\/]docid[=%&?\/]([^\&\s]*)/) ||
- ($url =~ m/^https?\:\/\/.*youtube.*(ptracking|set_awesome).*[=%&?\/]video_id[=%&?\/]([^\&\s]*)/) ||
- ($url =~ m/^https?\:\/\/.*youtube.*(player_204).*[=%&?\/]v[=%&?\/]([^\&\s]*)/)
- ){
- @id = $2;
- @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
- if ($referer !~ m/^https?\:\/\/(www|gaming)\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
- unless (-e "/tmp/@cpn"){
- open FILE, ">/tmp/@cpn";
- print FILE @id;
- close FILE;
- }
- }
- $out = "ERR";
- #utmgif
- } elsif ($url =~ m/^https?\:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
- $out="OK store-id=http://squid/google-analytics/__utm.gif";
- #fbcdn.net or akamaihd.net video range
- } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([\w-]+\.[\w]{2,4}).*(bytestart[=%&?\/][\d]+[&\/]byteend[=%&?\/][\d]+)/) {
- $out="OK store-id=http://squid/$1/$2/$3";
- #fbcdn.net or akamaihd.net with size
- } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([a-zA-Z][\d]+[x][\d]+\/[\w-]+\.[\w]{2,4})($|\?)/) {
- $out="OK store-id=http://squid/$1/$2";
- #fbcdn.net or akamaihd.net safe_image.php
- } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/safe_image\.php\?(.*)/) {
- $out="OK store-id=http://squid/$1/$2";
- #reverbnation
- } elsif ($url =~ m/^https?\:\/\/c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/(.*)\?.*/) {
- $out="OK store-id=http://squid/reverbnation/$1";
- #playstore
- } elsif ($url =~ m/^https?\:\/\/.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/(.*\/.*)\?.*/) {
- $out="OK store-id=http://squid/android/market/$1";
- #filehost
- } elsif ($url =~ m/^https?\:\/\/.*datafilehost.*\/get\.php.*file\=(.*)/) {
- $out="OK store-id=http://squid/datafilehost/$1";
- #speedtest
- } elsif ($url =~ m/^https?\:\/\/.*(speedtest|espeed).*\/(.*\.(txt|jpg)).*/) {
- $out="OK store-id=http://squid/speedtest/$2";
- #filehippo
- } elsif ($url =~ m/^https?\:\/\/.*\.filehippo\.com\/.*\/([\w-]+\.[\w]{2,4})\?.*/) {
- $out="OK store-id=http://squid/filehippo/$1";
- #4shared preview.mp3
- } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/.*\/(.*\/.*)\/dlink.*preview.mp3/) {
- $out="OK store-id=http://squid/4shared/preview/$1";
- #4shared
- } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/download\/(.*\/.*)\?tsid.*/) {
- $out="OK store-id=http://squid/4shared/download/$1";
- #savefile-animeindo.tv
- } elsif ($url =~ m/^https?:\/\/www\.savefile\.co\:182\/.*\/(.*\.(mp4|flv|3gp)).*/) {
- $out="OK store-id=http://squid/savefile:182/$1";
- #imdb
- } elsif ($url =~ m/^https?\:\/\/video\-http\.media\-imdb\.com\/(.*\.mp4)\?.*/) {
- $out="OK store-id=http://squid/imdb/$1";
- #sourceforge
- } elsif ($url =~ m/^https?\:\/\/.*\.dl\.sourceforge\.net\/([\w-]+\.[\w]{2,3})/) {
- $out="OK store-id=http://squid/sourceforge/$1";
- #steampowered dota 2
- } elsif ($url =~ m/^https?\:\/\/.*steam(powered|content).*\/((client|depot)\/[\d]+\/(chunk|manifest)\/[^\?\s]*).*/) {
- $out="OK store-id=http://squid/steam/content-powered/$2";
- } else {
- $out="ERR";
- }
- if ($X[0] =~ m/^http.*/) {
- print "$out\n";
- } else {
- print "$chanel $out\n";
- }
- }
- #conf
- reply_header_access Alternate-Protocol deny all
- reply_header_access Alt-Svc deny all
- cache_dir aufs /cache 17048 40 256
- cache_mem 2 MB
- cache_swap_high 95
- cache_swap_low 90
- cache_replacement_policy heap LFUDA
- memory_replacement_policy heap GDSF
- maximum_object_size 1024000 KB
- maximum_object_size_in_memory 0 KB
- cache_mgr crewoulart@gmail.com
- visible_hostname crewoulart-proxy
- strip_query_terms off
- httpd_suppress_version_string on
- log_mime_hdrs off
- forwarded_for off
- via off
- max_filedescriptors 65536
- fqdncache_size 1024
- ipcache_size 1024
- ipcache_high 95
- ipcache_low 90
- http_port 3128
- http_port 3129 tproxy
- https_port 3127 tproxy ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/etc/squid/ssl_cert/myCA.pem
- qos_flows local-hit=0x30
- acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
- acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
- acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
- acl localnet src fc00::/7 # RFC 4193 local private network range
- acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
- acl SSL_ports port 443
- acl Safe_ports port 80 # http
- acl Safe_ports port 182 # http
- acl Safe_ports port 21 # ftp
- acl Safe_ports port 443 # https
- acl Safe_ports port 70 # gopher
- acl Safe_ports port 210 # wais
- acl Safe_ports port 1025-65535 # unregistered ports
- acl Safe_ports port 280 # http-mgmt
- acl Safe_ports port 488 # gss-http
- acl Safe_ports port 591 # filemaker
- acl Safe_ports port 777 # multiling http
- acl step1 at_step SslBump1
- acl step2 at_step SslBump2
- acl step3 at_step SslBump3
- acl range206 req_header Range -i byte
- acl iphone browser -i regexp (iPhone|iPad)
- acl BB browser -i regexp (BlackBerry|PlayBook)
- acl Winphone browser -i regexp (Windows.*Phone|Trident|IEMobile)
- acl Android browser -i regexp Android
- acl yt-rewrite url_regex -i ^https?\:\/\/(www|gaming)\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]
- acl speedtest url_regex -i ^http.*(speedtest|espeed|api\.ookla).*\/(speedtest\.swf|speedtest-long\.swf|latency\.txt|upload\.php|speedtest-config\.php|ipaddress\.php|random.*\.jpg)
- acl youtube url_regex -i ^http.*(youtube|googlevideo|videoplayback|videogoodput)
- acl urltomiss url_regex -i ^http.*(update|patch).*versi
- acl urltomiss url_regex -i ^http.*versi.*(update|patch)
- acl urltomiss url_regex -i ^http.*(update|patch|versi|version)\.ini
- acl urltomiss url_regex -i ^http.*(antihack|xigncode|gameguard|captcha|\.aspx|\.html|\.shtml|\.xhtml|\.ini)
- acl urltomiss url_regex -i ^http.*googlevideo\.com\/video(playback|goodput).*source[\&\=\?\/]yt_live
- acl urltomiss url_regex -i ^http.*googleapis\.com\/game
- acl patchpartial url_regex -i ^http.*patch.*garena
- acl patchpartial url_regex -i ^http.*garena.*patch
- acl httptomiss http_status 302
- acl mimehtml rep_mime_type -i mime-type ^text/html
- acl mimeplain rep_mime_type -i mime-type ^text/plain
- acl tostoreid url_regex -i ^http.*(youtube|googlevideo|videoplayback|videogoodput)
- acl tostoreid url_regex -i ^http.*(fbcdn|akamaihd)
- acl tostoreid url_regex -i ^http.*c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/.*\?
- acl tostoreid url_regex -i ^http.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/.*\/.*\?
- acl tostoreid url_regex -i ^http.*datafilehost.*\/get\.php.*file\=.*
- acl tostoreid url_regex -i ^http.*\.filehippo\.com\/.*\?
- acl tostoreid url_regex -i ^http.*\.4shared\.com\/.*\/.*\/.*\/dlink.*preview.mp3
- acl tostoreid url_regex -i ^http.*\.4shared\.com\/download\/.*\/.*\?tsid
- acl tostoreid url_regex -i ^http.*steam(powered|content)
- acl tostoreid url_regex -i ^http.*savefile\.co\:182\/.*\/.*\.(mp4|flv|3gp)
- acl tostoreid url_regex -i ^http.*video\-http\.media\-imdb\.com\/.*\.mp4\?
- acl tostoreid url_regex -i ^http.*\.dl\.sourceforge\.net
- acl CONNECT method CONNECT
- acl getmethod method GET
- acl kendedes url_regex -i ^http.*kendedes\.uzone\.id
- deny_info https://www.youtube.com kendedes
- http_access deny kendedes
- acl positif url_regex -i ^http.*internetposisif\.uzone\.id
- deny_info http://10.212.212.212:8033/maksiat.jpg positif
- http_access deny positif
- acl blokir url_regex -i "/etc/squid/blokir.txt"
- deny_info http://10.212.212.212:8033/maksiat.jpg blokir
- http_access deny blokir
- http_access deny !Safe_ports
- http_access deny CONNECT !SSL_ports
- http_access allow localhost manager
- http_access deny manager
- http_access allow localnet
- http_access allow localhost
- http_access deny all
- range_offset_limit none range206 patchpartial
- quick_abort_min 1 KB
- quick_abort_max 1 KB
- quick_abort_pct 95
- cache deny speedtest
- cache deny urltomiss
- cache deny localhost
- ssl_bump splice localhost
- ssl_bump peek step1 all
- ssl_bump bump all
- sslproxy_cert_error allow all
- sslproxy_flags DONT_VERIFY_PEER
- #cache_log /dev/null
- access_log /var/log/squid/access.log !CONNECT
- netdb_filename none
- url_rewrite_access allow speedtest
- url_rewrite_access allow yt-rewrite !iphone !BB !Winphone !Android
- url_rewrite_access deny all
- url_rewrite_program /etc/squid/storerewrite.pl
- cache_peer 10.10.10.10 parent 8033 0 no-digest no-tproxy
- dead_peer_timeout 5 seconds
- cache_peer_access 10.10.10.10 allow speedtest
- cache_peer_access 10.10.10.10 deny all
- always_direct deny speedtest
- never_direct allow speedtest
- url_rewrite_children 2000 startup=30 idle=1
- request_header_access Accept-Encoding deny yt-rewrite !iphone !BB !Winphone !Android
- #yt_quality: tiny = 144px small = 240px medium = 360px large = 480px HD720 = Hd720px
- ecap_enable on
- loadable_modules /usr/local/lib/ecap_adapter_modifying.so
- #ecap_service modif respmod_precache uri=ecap://e-cap.org/ecap/services/sample/modifying voctim="html5":true roplacement="html5":false
- ecap_service modif respmod_precache uri=ecap://e-cap.org/ecap/services/sample/modifying victim="enablejsapi" replacement="vq":"medium","enablejsapi"
- adaptation_access modif allow yt-rewrite !iphone !BB !Winphone !Android
- adaptation_access modif deny all
- store_id_bypass off
- store_id_extras "%{Referer}>h"
- store_id_program /etc/squid/storeid.pl
- store_id_children 2000 startup=30 idle=1
- store_id_access allow tostoreid
- store_id_access deny all
- store_miss deny youtube httptomiss
- send_hit deny youtube httptomiss
- store_miss deny youtube mimeplain
- send_hit deny youtube mimeplain
- store_miss deny mimehtml
- send_hit deny mimehtml
- store_miss deny urltomiss
- send_hit deny urltomiss
- refresh_pattern -i ^(f|ht)tp.*(patch|update) 432000 100% 432000 override-expire override-lastmod reload-into-ims refresh-ims ignore-no-store ignore-must-revalidate ignore-private ignore-auth
- refresh_pattern -i ^(f|ht)tp.* 432000 100% 432000 override-expire override-lastmod ignore-reload ignore-no-store ignore-must-revalidate ignore-private ignore-auth
- max_stale 100 years
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement