X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fspoof.pl;fp=cmd%2Fspoof.pl;h=8c8fda85c6b516afc3d769eb6e4a4c38a085c5cc;hb=1fcf24aae37e929a6b9c2dab9ca5afff00d8db57;hp=0000000000000000000000000000000000000000;hpb=9e2fbafcfdab1ee45e581524311f1a97ac41f6ad;p=spider.git diff --git a/cmd/spoof.pl b/cmd/spoof.pl new file mode 100644 index 00000000..8c8fda85 --- /dev/null +++ b/cmd/spoof.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl +# +# pretend that you are another user, useful for reseting +# those silly things that people insist on getting wrong +# like set/homenode et al +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +my ($self, $line) = @_; + +my $mycall = $self->call; +my $myuser = $self->user; + +my ($call, $newline) = split /\s+/, $line, 2; +return (1, $self->msg('nodee1', $call)) if DXChannel->get($call); + +if ($self->remotecmd) { + Log('DXCommand', "$mycall is trying to spoof $call remotely"); + return (1, $self->msg('e5')); +} +if ($self->priv < 9) { + Log('DXCommand', "$mycall is trying to spoof $call locally"); + return (1, $self->msg('e5')); +} + +my @out; +$call = uc $call; +my $user = DXUser->get($call); +unless ($user) { + $user = DXUser->new($call); + push @out, $self->msg('spf1', $call); +} + +# set up basic environment +$self->call($call); +$self->user($user); +Log('DXCommand', "spoof '$newline' as $call by $mycall"); +my @in = $self->run_cmd($newline); +push @out, map {"spoof $call: $_"} @in; +$self->call($mycall); +$self->user($myuser); + +return (1, @out);