Advertisement
ujiajah1

store-id.pl /#bonbin

Feb 16th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 9.85 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # faktor yang bisa menyelamatkan adalah mamam
  3. # storeid.pl with debug opt - based on storeurl.pl
  4. # jangan lupa mamam loh
  5. # hati hati telat mamam nanti sakit mah
  6. # BONBIN.NET http://172.16.0.2/
  7. chomp;
  8.  
  9. my $puji = "";
  10. if (s/^(\d+\s+)//o) { $puji = $1; }
  11.  
  12. @X = split;
  13. if (@X[0] =~ m/^(exit|quit|x|q)/) {
  14. print STDERR "quiting helper quietly\n";
  15. exit 0;
  16. }
  17. $url = $X[0];
  18. $referer = $X[1];
  19.  
  20. use IO::File;
  21. $|=1;
  22. STDOUT->autoflush(1);
  23. $debug=0;           ## recommended:0
  24. $bypassallrules=0;      ## recommended:0
  25. $sucks="";          ## unused
  26. $sucks="sucks" if ($debug>=1);
  27. $timenow="";
  28. $printtimenow=1;        ## print timenow: 0|1
  29. my $logfile = '/tmp/storeid.log';
  30.  
  31. open my $logfh, '>>', $logfile
  32.     or die "Couldn't open $logfile for appending: $!\n" if $debug;
  33. $logfh->autoflush(1) if $debug;
  34.  
  35. while (<>) {
  36. $timenow=time()." " if ($printtimenow);
  37. print $logfh "$timenow"."in : $_" if ($debug>=1);
  38. chop;
  39. my $myURL = $_;
  40. @X = split(" ",$myURL);
  41. $a = $X[0]; ## channel id
  42. $b = $X[1]; ## url
  43. $c = $X[2]; ## ip address
  44. $u = $b; ## url
  45.  
  46. if ($bypassallrules){
  47.  $out="$u"; ## map 1:1
  48.  
  49. } elsif ($u=~ m/^https?:\/\/.*\.*(vimeo\.com.*\/)(\.?.*).*/) {
  50.     $out="OK store-id=http://vimeo-website.squid.internal/" . $1 . "/" . $2;
  51.  
  52. } elsif ($u=~ m/^https?\:\/\/.*\.akamaihd\.net\/(.*[0-9]+\w+\d+[^\&\s]*)/) {
  53.     $out="OK store-id=http://vimeo-video1.squid.internal/" . $1;
  54.  
  55. } elsif ($u=~ m/^https?:\/\/(.*\.vimeocdn\.com\/)(.*\.?\W+)(.*[0-9]+\w+\d+[^\&\s]*).*/) {
  56.     $out="OK store-id=http://vimeo-video2.squid.internal/" . $1 . $2 . "/" . $3 ;
  57.  
  58. } elsif ($u=~ m/^https?:\/\/.*\.akamaihd\.net\/(.*\.*)(.*[0-9]+\w+\d+[^\&\s]*).*/) {
  59.     $out="OK store-id=http://vimeo-video3.squid.internal/" . $1 . "/" . $2;
  60.  
  61. } elsif ($u=~ m/^https?:\/\/.*\.vimeocdn\.com(.*\.*)(.*[0-9]+\w+\d+[^\&\s]*).*/) {
  62.     $out="OK store-id=http://vimeo.squid.internal/" . $1 . "/" . $2;
  63.  
  64. } elsif ($u =~ m/^https?:\/\/.*steampowered\.com\/.*\/([0-9]+\/(.*))/) {
  65.         $out="OK store-id=http://steampowered.squid.internal/" . $1 . "/" . $2;
  66.  
  67. } elsif ($u =~ m/^https?\:\/\/.*steampowered.*\/(client|depot)\/(.*)/) {
  68.         $out="OK store-id=http://steampowered.squid.internal/" . $1 . "/" . $2;
  69.  
  70. } elsif ($u =~ m/^https?\:\/\/.*steampowered.*\/(client|depot)\/(.*)\?.*/) {
  71.          $out="OK store-id=http://steampowered.squid.internal/" . $1 . "/" . $2 ;
  72.  
  73. } elsif ($u=~ m/^https?:\/\/.*\.vimeocdn\.com\/(.*(js|jpg|webp|jpeg|gif|svg|icon|css|html)).*/) {
  74.     $out="OK store-id=http://vimeo-images-assets.squid.internal/" . $1 . "/" . $2;
  75.  
  76. } elsif ($u=~ m/^https?\:\/\/.*\/(.*\..*(mp4|3gp|flv))\?.*/) {
  77.     $out="OK store-id=http://video-file.squid.internal/" . $1;
  78.  
  79. } elsif ($u=~ m/^http:\/\/.*\.*mediafire\.com.*\/(.*[0-9]+\w+\d+[^\&\s]*).*/) {
  80.     $out="OK store-id=http://mediafire.download.squid.internal/" . $1;
  81.  
  82. } elsif ($u=~ m/^http:\/\/.*\.*mediafire\.com.*\/(\w+\d+[0-9]+[^\&\s]*).*/) {
  83.     $out="OK store-id=http://mediafire.download.squid.internal/" . $1;
  84.  
  85. } elsif ($u=~ m/^https?:\/\/.*\.mediafire\.com\/(.*[0-9]+[^\&\s]*)/) {
  86.     $out="OK store-id=http://mediafire.download.squid.internal/" . $1 ;
  87.  
  88. } elsif ($u=~ m/^https?:\/\/.*\.(mediafire\.com\/)(.*[0-9]+[^\&\s]*)/) {
  89.     $out="OK store-id=http://mediafire.download.squid.internal/" . $1 . "/" . $2;
  90.  
  91. } elsif ($u=~ m/http.*\.(fbcdn|akamaihd)\.net\/h(profile|photos).*[\d\w].*\/([\w]\d+x\d+\/.*\.[\d\w]{3}).*/) {
  92.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $1 . $2 . "/" . $3 ;
  93.  
  94. } elsif ($u=~ m/http.*\.(fbcdn|akamaihd)\.net\/h(profile|photos).*[\d\w].*\/([\w]\d+x\d+\/.*\.[\d\w]{3}).*/) {
  95.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $2 . "/" . $3 ;
  96.  
  97. } elsif ($u=~ m/^http(.*)static(.*)(akamaihd|fbcdn).net\/rsrc.php\/(.*\/.*\/(.*).(js|css|png|gif))(\?(.*)|$)/) {
  98.     $out="OK store-id=http://fbcdn.net.squid.internal/static/" . $5 . "." . $6 ;
  99.  
  100. } elsif ($u=~ m/^https?:\/\/[a-zA-Z0-9\-\_\.\%]*(fbcdn|akamaihd)[a-zA-Z0-9\-\_\.\%]*net\/rsrc\.php\/(.*)/) {
  101.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $2 ;
  102.  
  103. } elsif ($u=~ m/^https?\:\/\/.*(profile|photo|creative).*\.ak\.fbcdn\.net\/((h|)(profile|photos)-ak-)(snc|ash|prn)[0-9]?(.*)/) {
  104.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $2  . "fb" .  $6 ;
  105.  
  106. } elsif ($u=~ m/^https?:\/\/.*(profile|photo|creative)*.akamaihd\.net\/((h|)(profile|photos|ads)-ak-)(snc|ash|prn|frc[0-9])[0-9]?(.*)/) {
  107.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $2  . $5 .  $6 ;
  108.  
  109. } elsif ($u=~ m/^https?\:\/\/video\.(.*)\.fbcdn\.net\/(.*?)\/([0-9_]+\.(mp4|flv|avi|mkv|m4v|mov|wmv|3gp|mpg|mpeg)?)(.*)/) {
  110.     $out="OK store-id=http://video.fbcdn.net.squid.internal/" . $1 ;
  111.  
  112. } elsif ($u =~ m/^http:\/\/(.*\.*apple\.com\W+\d+[0-9]*[^\&\s]*).*/) {
  113.     $out="OK store-id=http://apple.com.squid.internal/" . $1;
  114.  
  115. } elsif ($u =~ m/^http:\/\/.*\.apple\.com\/([^\&\s]*).*/) {
  116.     $out="OK store-id=http://apple.com.squid.internal/" . $1;
  117.  
  118. } elsif ($u =~ m/^http:\/\/(.*\.3kingdom\.net)\/(.*patch.*)/) {
  119.     $out="OK store-id=http://3kingdom.squid.internal/" . $1 . "/" . $2;
  120.  
  121. } elsif ($u=~ m/http.*\.(fbcdn|akamaihd)\.net\/h(profile|photos).*[\d\w].*\/([\w]\d+x\d+\/.*\.[\d\w]{3}).*/) {
  122.     $out="OK store-id=http://fbcdn.net.squid.internal/" . $2 . "/" . $3 ;
  123.  
  124. } elsif ($u=~ m/^http(.*)static(.*)(akamaihd|fbcdn).net\/rsrc.php\/(.*\/.*\/(.*).(js|css|png|gif))(\?(.*)|$)/) {
  125.     $out="OK store-id=http://fbcdn.net.squid.internal/static/" . $5 . "." . $6 ;
  126.  
  127. } elsif ($u=~ m/^https?\:\/\/.*utm.gif.*/) {
  128.     $out="OK store-id=http://google-analytics.squid.internal/__utm.gif";
  129.  
  130. } elsif ($u=~ m/^https?\:\/\/.*\/(.*\..*(mp4|3gp|flv))\?.*/) {
  131.     $out="OK store-id=http://video-file.squid.internal/" . $1;
  132.  
  133. } elsif ($u=~ m/^http:\/\/[a-z0-9]{4}\.reverbnation\.com\/.*\/([0-9]*).*/) {
  134.     $out="http://reverbnation.com.squid.internal/" . $1;
  135.  
  136. } elsif ($u=~ m/^https?\:\/\/c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/(.*)\?.*/) {
  137.     $out="OK store-id=http://reverbnation.squid.internal/" . $1;
  138.  
  139. } elsif ($u=~ m/^https?\:\/\/.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/(.*\/.*)\?.*/) {
  140.     $out="OK store-id=http://playstore-android.squid.internal/" . $1;
  141.  
  142. } elsif ($u =~ m/^http:\/\/([a-z])[0-9]?(\.gstatic\.com.*|\.wikimapia\.org.*)/) {
  143.     $out="OK store-id=http://gstatic.squid.internal/" . $2;
  144.  
  145. } elsif ($u =~ m/^https?:\/\/.*(googleusercontent.com|blogspot.com)\/(.*)\/([a-z0-9]+)(-[a-z]-[a-z]-[a-z]+)?\/(.*\.(jpg|png))/){
  146.     $out="OK store-id=http://googleusercontent.squid.internal/" . $5;
  147.  
  148. } elsif ($_ =~ m/^https?:\/\/([a-z0-9.]*)(\.doubleclick\.net|\.quantserve\.com|.exoclick\.com|interclick.\com|\.googlesyndication\.com|\.auditude\.com|.visiblemeasures\.com|yieldmanager|cpxinteractive)(.*)/){
  149.     $out="OK store-id=http://ads.squid.internal/" . $3;
  150.  
  151. } elsif ($u=~ m/^http\:\/\/.*\.4shared\.com\/download\/(.*)\/.*/) {
  152.     $out="OK store-id=http://4shared.squid.internal/" . $1;
  153.  
  154. } elsif ($u =~ m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {
  155.     $out="OK store-id=http://ziddu.squid.internal/" . $1;
  156.  
  157. } elsif ($u =~ m/^https:\/\/.*googleapis\.com\/.*\.*\/v2\/code\.google\.com\/([^\&\s]*).*/) {
  158.     $out="OK store-id=http://googlecode-download.squid.internal/" . $1;
  159.  
  160. } elsif ($u =~ m/^http:\/\/(.*\.*)\W+(aclst\.com).*\.*(mp3.*?)\.*\.*(\w+\d+.*)/) {
  161.     $out="OK store-id=http://yt-mp3converter.squid.internal/" . $1;
  162.  
  163. } elsif ($u =~ m/^http:\/\/(.*\.*filehippo\.com\/)([^\&\s]*).*/) {
  164.     $out="OK store-id=http://filehippo-download.squid.internal/" . $1;
  165.  
  166. } elsif ($u =~ m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {
  167.     $out="OK store-id=http://cdn.yimg.squid.internal/" . $3;
  168.  
  169. } elsif ($u=~ m/^https?\:\/\/.*\/speedtest\/(.*\.(jpg|txt)).*/) {
  170.     $out="OK store-id=http://speedtest.squid.internal/" . $1;
  171.  
  172. } elsif (($u =~ /filehippo/) && (m/^https?:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {
  173.     @y = ($1,$2,$4,$5); $y[0] =~ s/[a-z0-9]{2,5}/cdn./;
  174.     $out="OK store-id=http://filehippo.squid.internal/" . $3;
  175.    
  176. } elsif ($u[1] =~ m/^http:\/\/.*dlink__[23]Fdownload_[23]F([\w\d-]+)_3Ftsid.*/) {
  177.     $1 =~ s/_5F/_/g;
  178.     $out="OK store-id=http://4shared.squid.internal/" . $1;
  179.  
  180. } elsif ($u=~ m/^https?\:\/\/.*youtube.*ptracking.*/){
  181.     @video_id = m/[&?]video_id\=([^\&\s]*)/;
  182.     @cpn = m/[&?]cpn\=([^\&\s]*)/;
  183.     unless (-e "/tmp/@cpn"){
  184.     open FILE, ">/tmp/@cpn";
  185.     print FILE "@video_id";
  186.     close FILE;
  187.     }
  188.     $out="ERR";
  189.  
  190. } elsif ($u=~ m/^https?\:\/\/.*youtube.*stream_204.*/){
  191.     @docid = m/[&?]docid\=([^\&\s]*)/;
  192.     @cpn = m/[&?]cpn\=([^\&\s]*)/;
  193.     unless (-e "/tmp/@cpn"){
  194.     open FILE, ">/tmp/@cpn";
  195.     print FILE "@docid";
  196.     close FILE;
  197.     }
  198.     $out="ERR";
  199.  
  200. } elsif ($u=~ m/^https?\:\/\/.*youtube.*player_204.*/){
  201.     @v = m/[&?]v\=([^\&\s]*)/;
  202.     @cpn = m/[&?]cpn\=([^\&\s]*)/;
  203.     unless (-e "/tmp/@cpn"){
  204.     open FILE, ">/tmp/@cpn";
  205.     print FILE "@v";
  206.     close FILE;
  207.     }
  208.     $out="ERR";
  209.  
  210. }elsif ($url =~ m/^https?:\/\/.*\.googlevideo\.com\/videoplayback\?.*/) {
  211.         @id = m/[\&?|\%?|\s?]id=([^\&\%\s]+)/;
  212.         @range = m/[\&?|\%?|\s?]range=([^\&\%\s]+)/;
  213.         @itag = m/[\&?|\%?|\s?]itag=([^\&\%\s]+)/;
  214.         @mime = m/[\&?|\%?|\s?]mime=([^\&\%\s]+)/;
  215.         @clen = m/[\&?|\%?|\s?]clen=([^\&\%\s]+)/;
  216.         if ($referer =~ m/^https?\:\/\/www\.youtube\.com\/(watch\?v\=|embed\/|v\/)(.*)/) {
  217.             $v = $2;
  218.         } else { $v = $id[0] }
  219.         $out = "http://youtube.puji-ganteng.com/" . $v . "@range@itag@mime@clen";
  220.  
  221. } elsif ($u=~ m/^https?\:\/\/.*(youtube|googlevideo).*videoplayback.*/){
  222.     @itag = m/[&?](itag\=[0-9]*)/;
  223.     @range = m/[&?](range\=[^\&\s]*)/;
  224.     @cpn = m/[&?]cpn\=([^\&\s]*)/;
  225.     @mime = m/[&?](mime\=[^\&\s]*)/;
  226.     @id = m/[&?]id\=([^\&\s]*)/;
  227.  
  228.     if (defined(@cpn[0])){
  229.         if (-e "/tmp/@cpn"){
  230.         open FILE, "/tmp/@cpn";
  231.         @id = <FILE>;
  232.         close FILE;}
  233.     }
  234.     $out="OK store-id=http://video-srv.squid.internal/id=@id@mime@range@referer";
  235.  
  236. } else {
  237.     $out="ERR";
  238. }
  239.     print $logfh "$timenow"."out: $a $out\n" if ($debug>=1);
  240.     print "$a $out\n";
  241. }
  242. if ($out =~ m/^http:\/\/.*/) {
  243.     print $puji, "OK store-id=$out\n";
  244. } else {
  245.     print $puji, "ERR\n";
  246. close $logfh if ($debug);
  247. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement