diff options
-rw-r--r-- | src/msec/config.py | 3 | ||||
-rwxr-xr-x | src/msec/help_draksec.py | 6 | ||||
-rwxr-xr-x | src/msec/libmsec.py | 16 | ||||
-rwxr-xr-x | src/msec/msec.py | 3 | ||||
-rwxr-xr-x | src/msec/msecperms.py | 3 | ||||
-rw-r--r-- | src/msec/plugins/pam.py | 3 |
6 files changed, 20 insertions, 14 deletions
diff --git a/src/msec/config.py b/src/msec/config.py index 8342fa5..5646fb7 100644 --- a/src/msec/config.py +++ b/src/msec/config.py @@ -36,8 +36,7 @@ SECURITYLOG = '/var/log/msec.log' # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str diff --git a/src/msec/help_draksec.py b/src/msec/help_draksec.py index 335ce77..1497fc6 100755 --- a/src/msec/help_draksec.py +++ b/src/msec/help_draksec.py @@ -31,8 +31,7 @@ import gettext # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str @@ -54,8 +53,7 @@ import gettext # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str diff --git a/src/msec/libmsec.py b/src/msec/libmsec.py index d3f8d6e..4f520ae 100755 --- a/src/msec/libmsec.py +++ b/src/msec/libmsec.py @@ -56,8 +56,7 @@ import config # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str @@ -218,11 +217,20 @@ class Log: self.logger.setLevel(log_level) + def trydecode(self, message): + """Attempts to decode a unicode message""" + try: + msg = message.decode('UTF-*') + except: + msg = message + return msg + def info(self, message): """Informative message (normal msec operation)""" if self.quiet: # skip informative messages in quiet mode return + message = self.trydecode(message) if self.buffer: self.buffer["info"].append(message) else: @@ -230,6 +238,7 @@ class Log: def error(self, message): """Error message (security has changed: authentication, passwords, etc)""" + message = self.trydecode(message) if self.buffer: self.buffer["error"].append(message) else: @@ -237,6 +246,7 @@ class Log: def debug(self, message): """Debugging message""" + message = self.trydecode(message) if self.buffer: self.buffer["debug"].append(message) else: @@ -244,6 +254,7 @@ class Log: def critical(self, message): """Critical message (big security risk, e.g., rootkit, etc)""" + message = self.trydecode(message) if self.buffer: self.buffer["critical"].append(message) else: @@ -254,6 +265,7 @@ class Log: if self.quiet: # skip warning messages in quiet mode return + message = self.trydecode(message) if self.buffer: self.buffer["warn"].append(message) else: diff --git a/src/msec/msec.py b/src/msec/msec.py index 0e8e5ce..9908db7 100755 --- a/src/msec/msec.py +++ b/src/msec/msec.py @@ -28,8 +28,7 @@ import logging # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str diff --git a/src/msec/msecperms.py b/src/msec/msecperms.py index 5a948e2..328f804 100755 --- a/src/msec/msecperms.py +++ b/src/msec/msecperms.py @@ -18,8 +18,7 @@ import getopt import gettext try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str diff --git a/src/msec/plugins/pam.py b/src/msec/plugins/pam.py index 56eda83..bb04eff 100644 --- a/src/msec/plugins/pam.py +++ b/src/msec/plugins/pam.py @@ -14,8 +14,7 @@ import config # localization try: - cat = gettext.Catalog('msec') - _ = cat.gettext + gettext.install('msec') except IOError: _ = str |