projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
speelingg error
[spider.git]
/
cmd
/
set
/
badip.pl
diff --git
a/cmd/set/badip.pl
b/cmd/set/badip.pl
index b53763569127f2505be6d73f3afcb3ac27ca8a13..1ed8225adb050de98ac87e7d388860c8785125e6 100644
(file)
--- a/
cmd/set/badip.pl
+++ b/
cmd/set/badip.pl
@@
-9,10
+9,16
@@
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->remotecmd;
# are we permitted?
return (1, $self->msg('e5')) if $self->priv < 6;
return (1, $self->msg('e5')) if $self->remotecmd;
# are we permitted?
return (1, $self->msg('e5')) if $self->priv < 6;
+return (1, q{Please install Net::CIDR::Lite or libnet-cidr-lite-perl to use this command}) unless $DXCIDR::active;
+
my @out;
my @added;
my @in = split /\s+/, $line;
my @out;
my @added;
my @in = split /\s+/, $line;
-return (1, "set/badip: need IP, IP-IP or IP/24") unless @in;
+my $suffix = 'local';
+if ($in[0] =~ /^[_\d\w]+$/) {
+ $suffix = shift @in;
+}
+return (1, "set/badip: need [suffix (def: local])] IP, IP-IP or IP/24") unless @in;
for my $ip (@in) {
my $r;
eval{ $r = DXCIDR::find($ip); };
for my $ip (@in) {
my $r;
eval{ $r = DXCIDR::find($ip); };
@@
-21,12
+27,13
@@
for my $ip (@in) {
push @out, "set/badip: $ip exists, not added";
next;
}
push @out, "set/badip: $ip exists, not added";
next;
}
- DXCIDR::add($ip);
+ DXCIDR::add($
suffix, $
ip);
push @added, $ip;
}
my $count = @added;
my $list = join ' ', @in;
DXCIDR::clean_prep();
push @added, $ip;
}
my $count = @added;
my $list = join ' ', @in;
DXCIDR::clean_prep();
-DXCIDR::save();
-push @out, "set/badip: added $count entries: $list" if $count;
+#$DB::single = 1;
+DXCIDR::append($suffix, @added);
+push @out, "set/badip: added $count entries to badip.$suffix : $list" if $count;
return (1, @out);
return (1, @out);