Skip to content

Instantly share code, notes, and snippets.

@oskopek
Last active May 10, 2021 16:10
Show Gist options
  • Save oskopek/9566780 to your computer and use it in GitHub Desktop.
Save oskopek/9566780 to your computer and use it in GitHub Desktop.
Irssi notification script for KDE using kdialog
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '0.1.2';
%IRSSI = (
authors => 'Ondrej Skopek',
contact => '[email protected]',
name => 'kdialog',
description => 'A KDialog PassivePopup show\'s who is talking to you, on what IRC channel.',
url => 'https://gist.github.com/oskopek/9566780',
license => 'BSD',
changed => '$Date: 2014-03-15 13:55:00 +0100 (Sat, 15 Mar 2014) $'
);
#--------------------------------------------------------------------
# Based on osd.pl 0.3.3 by Jeroen Coekaerts, Koenraad Heijlen
# http://www.irssi.org/scripts/scripts/osd.pl
#--------------------------------------------------------------------
# Based on knotify.pl 0.1.1 by Hugo Haas
# http://larve.net/people/hugo/2003/scratchpad/IrssiKnotify.html
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Printing private messages
#--------------------------------------------------------------------
sub priv_msg {
my ($server, $msg, $nick, $address) = @_;
kde_print("Private Message", "< " . $nick . "> " . $msg)
}
#--------------------------------------------------------------------
# Printing hilight's
#--------------------------------------------------------------------
sub hilight {
my ($dest, $text, $stripped) = @_;
if ($dest->{level} & MSGLEVEL_HILIGHT) {
kde_print($dest->{target}, $stripped);
}
}
#--------------------------------------------------------------------
# The actual printing
#--------------------------------------------------------------------
sub kde_print {
my ($title, $text) = @_;
system('kdialog', '--title', 'Irssi: '.$title, '--passivepopup', $text);
}
#--------------------------------------------------------------------
# Irssi::signal_add_last
#--------------------------------------------------------------------
Irssi::signal_add_last("message private", "priv_msg");
Irssi::signal_add_last("print text", "hilight");
#- end
@calve
Copy link

calve commented Apr 27, 2015

Please, do not use this code as it makes your irssi vulnerable to arbitrary code execution sent between backticks, as described here : irssi/irssi#243

Instead, one MUST change line 50 to the following
system('kdialog', '--title', 'Irssi: '.$title, '--passivepopup', $text); so that text contained in backticks do not get interpreted by perl.

@GeertHauwaerts
Copy link

@oskopek, do you mind changing that line to remove the vulnerability? Tnx :)

@vague666
Copy link

@oskopek , please fix the gist to reflect the comments above

@Psilokos
Copy link

Psilokos commented May 9, 2019

@oskopek ping ^^^

@oskopek
Copy link
Author

oskopek commented May 9, 2019

Done, sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment