minor improvement

This commit is contained in:
Miroslav Stampar 2010-12-26 11:15:02 +00:00
parent 22ce464efc
commit a555d1ad68
2 changed files with 8 additions and 3 deletions

View File

@ -1355,7 +1355,7 @@ def initCommonOutputs():
cfile.close()
def getFileItems(filename, commentPrefix='#', unicode_=True):
def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, unique=False):
retVal = []
checkFile(filename)
@ -1376,6 +1376,10 @@ def getFileItems(filename, commentPrefix='#', unicode_=True):
except UnicodeDecodeError:
continue
if line:
if lowercase:
line = line.lower()
if unique and line in retVal:
continue
retVal.append(line)
return retVal

View File

@ -21,13 +21,14 @@ from lib.core.common import safeStringFormat
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.enums import DBMS
from lib.core.exception import sqlmapMissingMandatoryOptionException
from lib.core.exception import sqlmapThreadException
from lib.core.settings import METADB_SUFFIX
from lib.request import inject
def tableExists(tableFile):
tables = getFileItems(tableFile)
tables = getFileItems(tableFile, lowercase=kb.dbms in (DBMS.ACCESS), unique=True)
tableSet = set(tables)
retVal = []
infoMsg = "checking table existence using items from '%s'" % tableFile
@ -133,7 +134,7 @@ def columnExists(columnFile):
errMsg = "missing table parameter"
raise sqlmapMissingMandatoryOptionException, errMsg
columns = getFileItems(columnFile)
columns = getFileItems(columnFile, unique=True)
if conf.db and not conf.db.endswith(METADB_SUFFIX):
table = "%s.%s" % (conf.db, conf.tbl)
else: