Advertisement
suprianto

rewritespeedtest

Feb 16th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # edited by zoky_raharjo@yahoo.com
  3. # http://www.facebook.com/zoky.raharjo.5
  4.  
  5. $|=1;
  6. while (<>) {
  7.  
  8. # auto detect channel ID
  9. my $channel = "";
  10. if (s/^(\d+\s+)//o) {
  11. $channel = $1;
  12. }
  13.  
  14. @X = split;
  15. # number of split
  16. $zoky = $X[0]; ## url
  17. $zoky1 = $X[1]; ## ip client
  18. $zoky2 = $X[2]; ## -
  19. $zoky3 = $X[3]; ## method ( GET )
  20. $zoky4 = $X[4]; ## myip=ipurl
  21. $zoky5 = $X[5]; ## myport=porturl
  22. $zoky6 = $X[6]; ## kosong
  23.  
  24. #Speedtest
  25. if ($zoky =~ m/^https?\:\/\/.*(speedtest|espeed).*\/(.*\.(jpg|png|bmp|txt)).*/) {
  26. print "$channel OK status=302 url=http://192.168.100.2:99/speedtest/$2\n";
  27.  
  28. } elsif ($zoky =~ m/^https?\:\/\/.*(speedtest|espeed).*\/(.*\.(php)).*/) {
  29. print "$channel OK rewrite-url=http://192.168.100.2:99/speedtest/$2\n";
  30.  
  31. } else {
  32. print "$channel ERR\n";
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement