Advertisement
ujiajah1

store-id/angga

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