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

Skip to content

Commit ce9618c

Browse files
committed
Implements #3993
1 parent c91fcbb commit ce9618c

8 files changed

Lines changed: 38 additions & 17 deletions

File tree

lib/core/option.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,18 @@ class _(six.text_type):
17701770
conf.col = re.sub(r"\s*,\s*", ',', conf.col)
17711771

17721772
if conf.exclude:
1773-
conf.exclude = re.sub(r"\s*,\s*", ',', conf.exclude)
1773+
regex = False
1774+
if any(_ in conf.exclude for _ in ('+', '*')):
1775+
try:
1776+
re.compile(conf.exclude)
1777+
except re.error:
1778+
pass
1779+
else:
1780+
regex = True
1781+
1782+
if not regex:
1783+
conf.exclude = re.sub(r"\s*,\s*", ',', conf.exclude)
1784+
conf.exclude = "\A%s\Z" % '|'.join(re.escape(_) for _ in conf.exclude.split(','))
17741785

17751786
if conf.binaryFields:
17761787
conf.binaryFields = re.sub(r"\s*,\s*", ',', conf.binaryFields)

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.11.1"
21+
VERSION = "1.3.11.2"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/maxdb/enumeration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import re
9+
810
from lib.core.common import isListLike
911
from lib.core.common import readInput
1012
from lib.core.common import safeSQLIdentificatorNaming
@@ -121,7 +123,7 @@ def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMod
121123
colList = []
122124

123125
if conf.exclude:
124-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
126+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
125127

126128
for col in colList:
127129
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)

plugins/dbms/mssqlserver/enumeration.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import re
9+
810
from lib.core.agent import agent
911
from lib.core.common import arrayizeValue
1012
from lib.core.common import getLimitRange
@@ -96,7 +98,7 @@ def getTables(self):
9698
singleTimeLogMessage(infoMsg)
9799
continue
98100

99-
if conf.exclude and db in conf.exclude.split(','):
101+
if conf.exclude and re.search(conf.exclude, db, re.I) is not None:
100102
infoMsg = "skipping database '%s'" % db
101103
singleTimeLogMessage(infoMsg)
102104
continue
@@ -119,7 +121,7 @@ def getTables(self):
119121
singleTimeLogMessage(infoMsg)
120122
continue
121123

122-
if conf.exclude and db in conf.exclude.split(','):
124+
if conf.exclude and re.search(conf.exclude, db, re.I) is not None:
123125
infoMsg = "skipping database '%s'" % db
124126
singleTimeLogMessage(infoMsg)
125127
continue
@@ -209,7 +211,7 @@ def searchTable(self):
209211
singleTimeLogMessage(infoMsg)
210212
continue
211213

212-
if conf.exclude and db in conf.exclude.split(','):
214+
if conf.exclude and re.search(conf.exclude, db, re.I) is not None:
213215
infoMsg = "skipping database '%s'" % db
214216
singleTimeLogMessage(infoMsg)
215217
continue
@@ -283,7 +285,7 @@ def searchColumn(self):
283285
colList = conf.col.split(',')
284286

285287
if conf.exclude:
286-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
288+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
287289

288290
origTbl = conf.tbl
289291
origDb = conf.db
@@ -344,7 +346,7 @@ def searchColumn(self):
344346
if conf.excludeSysDbs and db in self.excludeDbsList:
345347
continue
346348

347-
if conf.exclude and db in conf.exclude.split(','):
349+
if conf.exclude and re.search(conf.exclude, db, re.I) is not None:
348350
continue
349351

350352
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:

plugins/dbms/sybase/enumeration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import re
9+
810
from lib.core.common import filterPairValues
911
from lib.core.common import isListLike
1012
from lib.core.common import isTechniqueAvailable
@@ -185,7 +187,7 @@ def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMod
185187
colList = []
186188

187189
if conf.exclude:
188-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
190+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
189191

190192
for col in colList:
191193
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)

plugins/generic/databases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import re
9+
810
from lib.core.agent import agent
911
from lib.core.common import arrayizeValue
1012
from lib.core.common import Backend
@@ -332,7 +334,7 @@ def getTables(self, bruteForce=None):
332334
logger.info(infoMsg)
333335
continue
334336

335-
if conf.exclude and db in conf.exclude.split(','):
337+
if conf.exclude and re.search(conf.exclude, db, re.I) is not None:
336338
infoMsg = "skipping database '%s'" % unsafeSQLIdentificatorNaming(db)
337339
singleTimeLogMessage(infoMsg)
338340
continue
@@ -466,7 +468,7 @@ def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMod
466468
colList = []
467469

468470
if conf.exclude:
469-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
471+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
470472

471473
for col in colList:
472474
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)

plugins/generic/entries.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def dumpTable(self, foundData=None):
7878
errMsg += "the tables' columns"
7979
raise SqlmapMissingMandatoryOptionException(errMsg)
8080

81-
if conf.exclude and conf.db in conf.exclude.split(','):
81+
if conf.exclude and re.search(conf.exclude, conf.db, re.I) is not None:
8282
infoMsg = "skipping database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
8383
singleTimeLogMessage(infoMsg)
8484
return
@@ -112,7 +112,7 @@ def dumpTable(self, foundData=None):
112112
if kb.dumpKeyboardInterrupt:
113113
break
114114

115-
if conf.exclude and tbl in conf.exclude.split(','):
115+
if conf.exclude and re.search(conf.exclude, tbl, re.I) is not None:
116116
infoMsg = "skipping table '%s'" % unsafeSQLIdentificatorNaming(tbl)
117117
singleTimeLogMessage(infoMsg)
118118
continue
@@ -145,7 +145,7 @@ def dumpTable(self, foundData=None):
145145
colList = sorted(column for column in columns if column)
146146

147147
if conf.exclude:
148-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
148+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
149149

150150
if not colList:
151151
warnMsg = "skipping table '%s'" % unsafeSQLIdentificatorNaming(tbl)
@@ -491,7 +491,7 @@ def dumpAll(self):
491491
conf.db = db
492492

493493
for table in tables:
494-
if conf.exclude and table in conf.exclude.split(','):
494+
if conf.exclude and re.search(conf.exclude, table, re.I) is not None:
495495
infoMsg = "skipping table '%s'" % unsafeSQLIdentificatorNaming(table)
496496
logger.info(infoMsg)
497497
continue
@@ -562,7 +562,7 @@ def dumpFoundColumn(self, dbs, foundCols, colConsider):
562562
colList = [_ for _ in columns if _]
563563

564564
if conf.exclude:
565-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
565+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
566566

567567
conf.col = ','.join(colList)
568568
kb.data.cachedColumns = {}

plugins/generic/search.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import re
9+
810
from lib.core.agent import agent
911
from lib.core.common import arrayizeValue
1012
from lib.core.common import Backend
@@ -376,7 +378,7 @@ def searchColumn(self):
376378
colList = conf.col.split(',')
377379

378380
if conf.exclude:
379-
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
381+
colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
380382

381383
origTbl = conf.tbl
382384
origDb = conf.db

0 commit comments

Comments
 (0)