From 03b90e0a3fe3b3e7b2604b07781b760c2b2b3abb Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sun, 2 Nov 2008 18:23:42 +0000 Subject: [PATCH] Be more user friendly on messages and minor code layout improvement --- lib/core/dump.py | 9 ++++++--- plugins/dbms/mssqlserver.py | 2 +- plugins/dbms/oracle.py | 2 +- plugins/generic/filesystem.py | 4 ++-- plugins/generic/takeover.py | 2 +- sqlmap.py | 4 ++++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index c50d82dd7..d36734d98 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -91,7 +91,8 @@ class Dump: def lister(self, header, elements): - self.__write("%s [%d]:" % (header, len(elements))) + if elements: + self.__write("%s [%d]:" % (header, len(elements))) try: elements = set(elements) @@ -106,13 +107,15 @@ class Dump: elif isinstance(element, (list, tuple, set)): self.__write("[*] " + ", ".join(e for e in element)) - self.__write("") + if elements: + self.__write("") def userSettings(self, header, userSettings, subHeader): self.__areAdmins = set() - self.__write("%s:" % header) + if userSettings: + self.__write("%s:" % header) if isinstance(userSettings, (tuple, list, set)): self.__areAdmins = userSettings[1] diff --git a/plugins/dbms/mssqlserver.py b/plugins/dbms/mssqlserver.py index 45f124417..c6d0eb3f7 100644 --- a/plugins/dbms/mssqlserver.py +++ b/plugins/dbms/mssqlserver.py @@ -195,7 +195,7 @@ class MSSQLServerMap(Fingerprint, Enumeration, Filesystem, Takeover): def getPrivileges(self): - warnMsg = "this plugin can not fetch database users privileges" + warnMsg = "on MySQL is it not possible to fetch database users privileges" logger.warn(warnMsg) return {} diff --git a/plugins/dbms/oracle.py b/plugins/dbms/oracle.py index ac98f2a37..fc134af0f 100644 --- a/plugins/dbms/oracle.py +++ b/plugins/dbms/oracle.py @@ -210,7 +210,7 @@ class OracleMap(Fingerprint, Enumeration, Filesystem, Takeover): def getDbs(self): - warnMsg = "this plugin can not enumerate databases" + warnMsg = "on Oracle it is not possible to enumerate databases" logger.warn(warnMsg) return [] diff --git a/plugins/generic/filesystem.py b/plugins/generic/filesystem.py index c8b429629..1c0faa788 100644 --- a/plugins/generic/filesystem.py +++ b/plugins/generic/filesystem.py @@ -33,10 +33,10 @@ class Filesystem: """ def readFile(self, rFile): - errMsg = "this plugin does not support OS file reading yet" + errMsg = "OS file reading not yet implemented for this DBMS" raise sqlmapUnsupportedFeatureException, errMsg def writeFile(self, wFile): - errMsg = "this plugin does not support OS file writing yet" + errMsg = "OS file writing not yet implemented for this DBMS" raise sqlmapUnsupportedFeatureException, errMsg diff --git a/plugins/generic/takeover.py b/plugins/generic/takeover.py index 94fa6fbc2..a5bd473c0 100644 --- a/plugins/generic/takeover.py +++ b/plugins/generic/takeover.py @@ -33,5 +33,5 @@ class Takeover: """ def osShell(self): - errMsg = "this plugin does not support OS shell functionality yet" + errMsg = "OS shell functionality not yet implemented for this DBMS" raise sqlmapUnsupportedFeatureException, errMsg diff --git a/sqlmap.py b/sqlmap.py index 29a447076..7dfea99fb 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -72,16 +72,20 @@ def main(): if conf.start: start() + except exceptionsTuple, e: logger.error(e) + except KeyboardInterrupt: print errMsg = "user aborted" logger.error(errMsg) + except EOFError: print errMsg = "exit" logger.error(errMsg) + except: errMsg = unhandledException() logger.error(errMsg)