Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- module/vara.pl.orig 2013-11-05 15:18:21.000000000 +0900
- +++ module/vara.pl 2017-11-04 14:29:10.000000000 +0900
- @@ -7,6 +7,7 @@
- use strict;
- #use warnings;
- +use LWP::Simple;
- #------------------------------------------------------------------------------------------------------------
- #
- @@ -341,6 +342,49 @@
- $Form->Set('FROM', "</b>[´+ω+`] $host <b>$from");
- }
- }
- +
- + # VPNGate
- + {
- + my $path = $Sys->Get('BBSPATH') . '/' . $Sys->Get('BBS') . "/info/vpngate.cgi";
- + my $now = time;
- + my @blacklist_vpn = ();
- +
- + if (open(my $fh, '<', $path)) {
- + while (<$fh>) {
- + chomp($_);
- + push(@blacklist_vpn, $_);
- + }
- + close($fh);
- + }
- +
- + if (!(-f $path) || (($now - (stat $path)[9]) > 600)) {
- + my $url = 'http://www.vpngate.net/api/iphone/';
- + my $data = get($url);
- + if (defined($data)) {
- + my @blacklist_vpn_new = ();
- + while ($data =~ /,(([0-9]{1,3}\.){3}[0-9]{1,3}),/g) {
- + if (!grep {$_ eq $1} @blacklist_vpn) {
- + push(@blacklist_vpn_new, $1);
- + }
- + }
- + if (@blacklist_vpn_new && open(my $fh, (-f $path ? '+<' : '>'), $path)) {
- + flock($fh, 2);
- + seek($fh, 0, 2);
- + binmode($fh);
- + print $fh join("\n", @blacklist_vpn_new) . "\n";
- + close($fh);
- + }
- + elsif (@blacklist_vpn) {
- + utime $now, $now, ($path);
- + }
- + push(@blacklist_vpn, @blacklist_vpn_new);
- + }
- + }
- +
- + if (grep {$_ eq $addr} @blacklist_vpn) {
- + return $ZP::E_REG_NGUSER;
- + }
- + }
- }
- # pluginに渡す値を設定
Advertisement
Add Comment
Please, Sign In to add comment