mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-29 09:23:30 +03:00
minor improvement
This commit is contained in:
parent
22ce464efc
commit
a555d1ad68
|
@ -1355,7 +1355,7 @@ def initCommonOutputs():
|
||||||
|
|
||||||
cfile.close()
|
cfile.close()
|
||||||
|
|
||||||
def getFileItems(filename, commentPrefix='#', unicode_=True):
|
def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, unique=False):
|
||||||
retVal = []
|
retVal = []
|
||||||
|
|
||||||
checkFile(filename)
|
checkFile(filename)
|
||||||
|
@ -1376,6 +1376,10 @@ def getFileItems(filename, commentPrefix='#', unicode_=True):
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
continue
|
continue
|
||||||
if line:
|
if line:
|
||||||
|
if lowercase:
|
||||||
|
line = line.lower()
|
||||||
|
if unique and line in retVal:
|
||||||
|
continue
|
||||||
retVal.append(line)
|
retVal.append(line)
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
|
@ -21,13 +21,14 @@ from lib.core.common import safeStringFormat
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||||
from lib.core.exception import sqlmapThreadException
|
from lib.core.exception import sqlmapThreadException
|
||||||
from lib.core.settings import METADB_SUFFIX
|
from lib.core.settings import METADB_SUFFIX
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
|
|
||||||
def tableExists(tableFile):
|
def tableExists(tableFile):
|
||||||
tables = getFileItems(tableFile)
|
tables = getFileItems(tableFile, lowercase=kb.dbms in (DBMS.ACCESS), unique=True)
|
||||||
tableSet = set(tables)
|
tableSet = set(tables)
|
||||||
retVal = []
|
retVal = []
|
||||||
infoMsg = "checking table existence using items from '%s'" % tableFile
|
infoMsg = "checking table existence using items from '%s'" % tableFile
|
||||||
|
@ -133,7 +134,7 @@ def columnExists(columnFile):
|
||||||
errMsg = "missing table parameter"
|
errMsg = "missing table parameter"
|
||||||
raise sqlmapMissingMandatoryOptionException, errMsg
|
raise sqlmapMissingMandatoryOptionException, errMsg
|
||||||
|
|
||||||
columns = getFileItems(columnFile)
|
columns = getFileItems(columnFile, unique=True)
|
||||||
if conf.db and not conf.db.endswith(METADB_SUFFIX):
|
if conf.db and not conf.db.endswith(METADB_SUFFIX):
|
||||||
table = "%s.%s" % (conf.db, conf.tbl)
|
table = "%s.%s" % (conf.db, conf.tbl)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user