Advertisement
punces

new-storeid.pl

Feb 13th, 2017
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. #!/usr/bin/perl
  2. $|=1;
  3. while (<>) {
  4. @X = split;
  5. if ($X[0] =~ m/^http.*/) {
  6. $url = $X[0];
  7. $referer = $X[1];
  8. $urlreferer = $X[0] ." ". $X[1];
  9. } else {
  10. $chanel = $X[0];
  11. $url = $X[1];
  12. $referer = $X[2];
  13. $urlreferer = $X[1] ." ". $X[2];
  14. }
  15.  
  16. #youtube googlevideo
  17. if ($url =~ m/^https?\:\/\/.*google.*video(playback|goodput).*/){
  18. @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
  19. @id = m/[=%&?\/]id[=%&?\/]([^\&\s]*)/;
  20. @itag = m/[=%&?\/]itag[=%&?\/]([\d]*)/;
  21. @range = m/[=%&?\/]range[=%&?\/]([\d]*-[\d]*)/;
  22. @mime = m/[=%&?\/]mime[=%&?\/]([^\&\s]*)/;
  23. if ($referer =~ m/^https?\:\/\/(www|gaming)\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
  24. @id = $3;
  25. } else {
  26. if (defined(@cpn[0])){
  27. if (-e "/var/log/squid/@cpn"){
  28. open FILE, "/var/log/squid/@cpn";
  29. @id = <FILE>;
  30. close FILE;
  31. }
  32. }
  33. }
  34. $out="OK store-id=http://squid/google/video/id=@id/itag=@itag/mime=@mime/range=@range";
  35.  
  36. #youtube parameter
  37. } elsif (
  38. ($url =~ m/^https?\:\/\/.*youtube.*(stream_204|watchtime|qoe|atr|csi_204|playback).*[=%&?\/]docid[=%&?\/]([^\&\s]*)/) ||
  39. ($url =~ m/^https?\:\/\/.*youtube.*(ptracking|set_awesome).*[=%&?\/]video_id[=%&?\/]([^\&\s]*)/) ||
  40. ($url =~ m/^https?\:\/\/.*youtube.*(player_204).*[=%&?\/]v[=%&?\/]([^\&\s]*)/)
  41. ){
  42. @id = $2;
  43. @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
  44. if ($referer !~ m/^https?\:\/\/(www|gaming)\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
  45. unless (-e "/var/log/squid/@cpn"){
  46. open FILE, ">/var/log/squid/@cpn";
  47. print FILE @id;
  48. close FILE;
  49. }
  50. }
  51. $out = "ERR";
  52.  
  53. #utmgif
  54. } elsif ($url =~ m/^https?\:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
  55. $out="OK store-id=http://squid/google-analytics/__utm.gif";
  56.  
  57. #fbcdn.net or akamaihd.net video range
  58. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([\w-]+\.[\w]{2,4}).*(bytestart[=%&?\/][\d]+[&\/]byteend[=%&?\/][\d]+)/) {
  59. $out="OK store-id=http://squid/$1/$2/$3";
  60.  
  61. #fbcdn.net or akamaihd.net with size
  62. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/([a-zA-Z][\d]+[x][\d]+\/[\w-]+\.[\w]{2,4})($|\?)/) {
  63. $out="OK store-id=http://squid/$1/$2";
  64.  
  65. #fbcdn.net or akamaihd.net safe_image.php
  66. } elsif ($url =~ m/^https?\:\/\/.*(fbcdn\.net|akamaihd\.net).*\/safe_image\.php\?(.*)/) {
  67. $out="OK store-id=http://squid/$1/$2";
  68.  
  69. #reverbnation
  70. } elsif ($url =~ m/^https?\:\/\/c2lo\.reverbnation\.com\/audio_player\/ec_stream_song\/(.*)\?.*/) {
  71. $out="OK store-id=http://squid/reverbnation/$1";
  72.  
  73. #playstore
  74. } elsif ($url =~ m/^https?\:\/\/.*\.c\.android\.clients\.google\.com\/market\/GetBinary\/GetBinary\/(.*\/.*)\?.*/) {
  75. $out="OK store-id=http://squid/android/market/$1";
  76.  
  77.  
  78. #filehost
  79. } elsif ($url =~ m/^https?\:\/\/.*datafilehost.*\/get\.php.*file\=(.*)/) {
  80. $out="OK store-id=http://squid/datafilehost/$1";
  81.  
  82.  
  83. #speedtest
  84. } elsif ($url =~ m/^https?\:\/\/.*(speedtest|espeed).*\/(.*\.(txt|jpg)).*/) {
  85. $out="OK store-id=http://squid/speedtest/$2";
  86.  
  87.  
  88. #filehippo
  89. } elsif ($url =~ m/^https?\:\/\/.*\.filehippo\.com\/.*\/([\w-]+\.[\w]{2,4})\?.*/) {
  90. $out="OK store-id=http://squid/filehippo/$1";
  91.  
  92.  
  93. #4shared preview.mp3
  94. } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/.*\/(.*\/.*)\/dlink.*preview.mp3/) {
  95. $out="OK store-id=http://squid/4shared/preview/$1";
  96.  
  97. #4shared
  98. } elsif ($url =~ m/^https?\:\/\/.*\.4shared\.com\/download\/(.*\/.*)\?tsid.*/) {
  99. $out="OK store-id=http://squid/4shared/download/$1";
  100.  
  101. #savefile-animeindo.tv
  102. } elsif ($url =~ m/^https?:\/\/www\.savefile\.co\:182\/.*\/(.*\.(mp4|flv|3gp)).*/) {
  103. $out="OK store-id=http://squid/savefile:182/$1";
  104.  
  105. #imdb
  106. } elsif ($url =~ m/^https?\:\/\/video\-http\.media\-imdb\.com\/(.*\.mp4)\?.*/) {
  107. $out="OK store-id=http://squid/imdb/$1";
  108.  
  109. #sourceforge
  110. } elsif ($url =~ m/^https?\:\/\/.*\.dl\.sourceforge\.net\/([\w-]+\.[\w]{2,3})/) {
  111. $out="OK store-id=http://squid/sourceforge/$1";
  112.  
  113. #steampowered dota 2
  114. } elsif ($url =~ m/^https?\:\/\/(.*steam(powered|content).*\/(client|depot)\/[\d]+\/(chunk|manifest)\/[^\?\s]*).*/) {
  115. $out="OK store-id=http://squid/$1";
  116.  
  117. } else {
  118. $out="ERR";
  119. }
  120.  
  121. if ($X[0] =~ m/^http.*/) {
  122. print "$out\n";
  123. } else {
  124. print "$chanel $out\n";
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement