diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/remote.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/remote.pl')
| -rw-r--r-- | scripts/remote.pl | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/scripts/remote.pl b/scripts/remote.pl new file mode 100644 index 0000000..3557575 --- /dev/null +++ b/scripts/remote.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w +use Irssi 20010120.0250 (); +$VERSION = "1"; +%IRSSI = ( +    authors     => 'David Leadbeater', +    contact     => 'dgl@dgl.cx', +    name        => 'remote', +    description => 'Lets you run commands remotely via /msg and a password', +    license     => 'GNU GPLv2 or later', +    url         => 'http://irssi.dgl.yi.org/', +); + + +# Usage: +# as your user /remote on (uncomment the $remote = 1 line below if you want it +# on by default) +# /msg user remote login password +# then /msg user remote command +# it will execute the command on the same server... +# so you can do mode #channel +o whoever +# but it will allow any command, yes it's dangerous if someone knows the +# password they can access just about anything your user account can.... +use strict; +# put a crypted password here +my $password = "pp00000000"; +my($login,$remote); +# $remote = 1; + +sub event{ +   my($server,$text,$nick,$hostmask)=@_; +# if you're really paranoid change this.... +   if($text =~ s/^remote\s+//i){ +	  my $ok; +      $ok = 1 if $login eq $nick."!".$hostmask; +	  $ok = 0 if !defined $remote; +	  my($command,$options) = split(/ /,$text,2); +	  if($command eq "login"){ +		 if(crypt($options,substr($password,0,2)) eq $password){ +			$login = $nick."!".$hostmask; +		 }else{ +			Irssi::print("Invaild login attempt from $nick ($hostmask): $text"); +		 } +	  }elsif(!$ok){ +		 Irssi::print("Invaild remote use from $nick ($hostmask): $text"); +	  }elsif($ok){ +		 Irssi::command("/".$text); +	  } +   } +} + +sub remote{ +   my($args) = shift; +   if($args eq "enable" or $args eq "on"){ +	  $remote = 1; +   }else{ +	  $remote = undef; +   } +} + +Irssi::signal_add_last("message private", "event"); +Irssi::command_bind("remote", "remote"); + | 
