1#!/usr/local/bin/perl -w 2use strict; 3use Irssi 20010120.0250 (); 4use vars qw($VERSION %IRSSI); 5$VERSION = "1"; 6%IRSSI = ( 7 authors => 'David Leadbeater', 8 contact => 'dgl@dgl.cx', 9 name => 'remote', 10 description => 'Lets you run commands remotely via /msg and a password', 11 license => 'GNU GPLv2 or later', 12 url => 'http://irssi.dgl.cx/', 13); 14 15 16# Usage: 17# as your user /remote on (uncomment the $remote = 1 line below if you want it 18# on by default) 19# /msg user remote login password 20# then /msg user remote command 21# it will execute the command on the same server... 22# so you can do mode #channel +o whoever 23# but it will allow any command, yes it's dangerous if someone knows the 24# password they can access just about anything your user account can.... 25# put a crypted password here 26my $password = "pp00000000"; 27my($login,$remote); 28# $remote = 1; 29 30sub event{ 31 my($server,$text,$nick,$hostmask)=@_; 32# if you're really paranoid change this.... 33 if($text =~ s/^remote\s+//i){ 34 my $ok; 35 $ok = 1 if $login eq $nick."!".$hostmask; 36 $ok = 0 if !defined $remote; 37 my($command,$options) = split(/ /,$text,2); 38 if($command eq "login"){ 39 if(crypt($options,substr($password,0,2)) eq $password){ 40 $login = $nick."!".$hostmask; 41 }else{ 42 Irssi::print("Invaild login attempt from $nick ($hostmask): $text"); 43 } 44 }elsif(!$ok){ 45 Irssi::print("Invaild remote use from $nick ($hostmask): $text"); 46 }elsif($ok){ 47 Irssi::command("/".$text); 48 } 49 } 50} 51 52sub remote{ 53 my($args) = shift; 54 if($args eq "enable" or $args eq "on"){ 55 $remote = 1; 56 }else{ 57 $remote = undef; 58 } 59} 60 61Irssi::signal_add_last("message private", "event"); 62Irssi::command_bind("remote", "remote"); 63 64