Be more user friendly on messages and minor code layout improvement

This commit is contained in:
Bernardo Damele 2008-11-02 18:23:42 +00:00
parent 09ca578ca1
commit 03b90e0a3f
6 changed files with 15 additions and 8 deletions

View File

@ -91,7 +91,8 @@ class Dump:
def lister(self, header, elements): def lister(self, header, elements):
self.__write("%s [%d]:" % (header, len(elements))) if elements:
self.__write("%s [%d]:" % (header, len(elements)))
try: try:
elements = set(elements) elements = set(elements)
@ -106,13 +107,15 @@ class Dump:
elif isinstance(element, (list, tuple, set)): elif isinstance(element, (list, tuple, set)):
self.__write("[*] " + ", ".join(e for e in element)) self.__write("[*] " + ", ".join(e for e in element))
self.__write("") if elements:
self.__write("")
def userSettings(self, header, userSettings, subHeader): def userSettings(self, header, userSettings, subHeader):
self.__areAdmins = set() self.__areAdmins = set()
self.__write("%s:" % header) if userSettings:
self.__write("%s:" % header)
if isinstance(userSettings, (tuple, list, set)): if isinstance(userSettings, (tuple, list, set)):
self.__areAdmins = userSettings[1] self.__areAdmins = userSettings[1]

View File

@ -195,7 +195,7 @@ class MSSQLServerMap(Fingerprint, Enumeration, Filesystem, Takeover):
def getPrivileges(self): 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) logger.warn(warnMsg)
return {} return {}

View File

@ -210,7 +210,7 @@ class OracleMap(Fingerprint, Enumeration, Filesystem, Takeover):
def getDbs(self): def getDbs(self):
warnMsg = "this plugin can not enumerate databases" warnMsg = "on Oracle it is not possible to enumerate databases"
logger.warn(warnMsg) logger.warn(warnMsg)
return [] return []

View File

@ -33,10 +33,10 @@ class Filesystem:
""" """
def readFile(self, rFile): 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 raise sqlmapUnsupportedFeatureException, errMsg
def writeFile(self, wFile): 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 raise sqlmapUnsupportedFeatureException, errMsg

View File

@ -33,5 +33,5 @@ class Takeover:
""" """
def osShell(self): 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 raise sqlmapUnsupportedFeatureException, errMsg

View File

@ -72,16 +72,20 @@ def main():
if conf.start: if conf.start:
start() start()
except exceptionsTuple, e: except exceptionsTuple, e:
logger.error(e) logger.error(e)
except KeyboardInterrupt: except KeyboardInterrupt:
print print
errMsg = "user aborted" errMsg = "user aborted"
logger.error(errMsg) logger.error(errMsg)
except EOFError: except EOFError:
print print
errMsg = "exit" errMsg = "exit"
logger.error(errMsg) logger.error(errMsg)
except: except:
errMsg = unhandledException() errMsg = unhandledException()
logger.error(errMsg) logger.error(errMsg)