Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a555d1a

Browse files
committed
minor improvement
1 parent 22ce464 commit a555d1a

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

lib/core/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def initCommonOutputs():
13551355

13561356
cfile.close()
13571357

1358-
def getFileItems(filename, commentPrefix='#', unicode_=True):
1358+
def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, unique=False):
13591359
retVal = []
13601360

13611361
checkFile(filename)
@@ -1376,6 +1376,10 @@ def getFileItems(filename, commentPrefix='#', unicode_=True):
13761376
except UnicodeDecodeError:
13771377
continue
13781378
if line:
1379+
if lowercase:
1380+
line = line.lower()
1381+
if unique and line in retVal:
1382+
continue
13791383
retVal.append(line)
13801384

13811385
return retVal

lib/techniques/brute/use.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
from lib.core.data import conf
2222
from lib.core.data import kb
2323
from lib.core.data import logger
24+
from lib.core.enums import DBMS
2425
from lib.core.exception import sqlmapMissingMandatoryOptionException
2526
from lib.core.exception import sqlmapThreadException
2627
from lib.core.settings import METADB_SUFFIX
2728
from lib.request import inject
2829

2930
def tableExists(tableFile):
30-
tables = getFileItems(tableFile)
31+
tables = getFileItems(tableFile, lowercase=kb.dbms in (DBMS.ACCESS), unique=True)
3132
tableSet = set(tables)
3233
retVal = []
3334
infoMsg = "checking table existence using items from '%s'" % tableFile
@@ -133,7 +134,7 @@ def columnExists(columnFile):
133134
errMsg = "missing table parameter"
134135
raise sqlmapMissingMandatoryOptionException, errMsg
135136

136-
columns = getFileItems(columnFile)
137+
columns = getFileItems(columnFile, unique=True)
137138
if conf.db and not conf.db.endswith(METADB_SUFFIX):
138139
table = "%s.%s" % (conf.db, conf.tbl)
139140
else:

0 commit comments

Comments
 (0)