From 94e753aaaa9f355ac6ad1d06d58457ec1837e8b2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 8 Apr 2003 07:18:53 +0000 Subject: [PATCH] Added configure to optionally disable progstats. --- plugins/Unix.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/Unix.py b/plugins/Unix.py index 5a1d0b25f..9be4415f2 100644 --- a/plugins/Unix.py +++ b/plugins/Unix.py @@ -52,6 +52,27 @@ import struct import privmsgs import callbacks +def configure(onStart, afterConnect, advanced): + from questions import expect, anything, something, yn + print 'The "progstats" command can reveal potentially sensitive' + print 'information about your machine. Here\'s an example of its output:' + print + print progstats() + print + if yn('Would you like to disable this command?') == 'y': + onStart.append('disable progstats') + +def progstats(): + pw = pwd.getpwuid(os.getuid()) + response = 'Process ID %i running as user "%s" and as group "%s" '\ + 'from directory "%s" with the command line "%s". '\ + 'Running on Python %s.' %\ + (os.getpid(), pw[0], pw[3], + os.getcwd(), " ".join(sys.argv), + sys.version.translate(string.ascii, '\r\n')) + return response + + class Unix(callbacks.Privmsg): def errno(self, irc, msg, args): "" @@ -72,14 +93,7 @@ class Unix(callbacks.Privmsg): def progstats(self, irc, msg, args): "takes no arguments" - pw = pwd.getpwuid(os.getuid()) - response = 'Process ID %i running as user "%s" and as group "%s" '\ - 'from directory "%s" with the command line "%s". '\ - 'Running on Python %s.' %\ - (os.getpid(), pw[0], pw[3], - os.getcwd(), " ".join(sys.argv), - sys.version.translate(string.ascii, '\r\n')) - irc.reply(msg, response) + irc.reply(msg, progstats()) _cryptre = re.compile(r'[./0-9A-Za-z]') def crypt(self, irc, msg, args):