Guest User

Untitled

a guest
Nov 4th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.57 KB | None | 0 0
  1. --- module/vara.pl.orig 2013-11-05 15:18:21.000000000 +0900
  2. +++ module/vara.pl  2017-11-04 14:29:10.000000000 +0900
  3. @@ -7,6 +7,7 @@
  4.  
  5.  use strict;
  6.  #use warnings;
  7. +use LWP::Simple;
  8.  
  9.  #------------------------------------------------------------------------------------------------------------
  10.  #
  11. @@ -341,6 +342,49 @@
  12.                 $Form->Set('FROM', "</b>[´+ω+`] $host <b>$from");
  13.             }
  14.         }
  15. +      
  16. +       # VPNGate
  17. +       {
  18. +           my $path = $Sys->Get('BBSPATH') . '/' . $Sys->Get('BBS') . "/info/vpngate.cgi";
  19. +           my $now = time;
  20. +           my @blacklist_vpn = ();
  21. +          
  22. +           if (open(my $fh, '<', $path)) {
  23. +               while (<$fh>) {
  24. +                   chomp($_);
  25. +                   push(@blacklist_vpn, $_);
  26. +               }
  27. +               close($fh);
  28. +           }
  29. +          
  30. +           if (!(-f $path) || (($now - (stat $path)[9]) > 600)) {
  31. +               my $url = 'http://www.vpngate.net/api/iphone/';
  32. +               my $data = get($url);
  33. +               if (defined($data)) {
  34. +                   my @blacklist_vpn_new = ();
  35. +                   while ($data =~ /,(([0-9]{1,3}\.){3}[0-9]{1,3}),/g) {
  36. +                       if (!grep {$_ eq $1} @blacklist_vpn) {
  37. +                           push(@blacklist_vpn_new, $1);
  38. +                       }
  39. +                   }
  40. +                   if (@blacklist_vpn_new && open(my $fh, (-f $path ? '+<' : '>'), $path)) {
  41. +                       flock($fh, 2);
  42. +                       seek($fh, 0, 2);
  43. +                       binmode($fh);
  44. +                       print $fh join("\n", @blacklist_vpn_new) . "\n";
  45. +                       close($fh);
  46. +                   }
  47. +                   elsif (@blacklist_vpn) {
  48. +                       utime $now, $now, ($path);
  49. +                   }
  50. +                   push(@blacklist_vpn, @blacklist_vpn_new);
  51. +               }
  52. +           }
  53. +          
  54. +           if (grep {$_ eq $addr} @blacklist_vpn) {
  55. +               return $ZP::E_REG_NGUSER;
  56. +           }
  57. +       }
  58.     }
  59.    
  60.     # pluginに渡す値を設定
Advertisement
Add Comment
Please, Sign In to add comment