mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-06-28 04:20:58 +00:00
Minor patches
This commit is contained in:
parent
ea1f089220
commit
4e2438dc1e
6 changed files with 57 additions and 12 deletions
|
|
@ -4507,13 +4507,15 @@ def safeCSValue(value):
|
|||
'"foo, bar"'
|
||||
>>> safeCSValue('foobar')
|
||||
'foobar'
|
||||
>>> safeCSValue('foo\\rbar')
|
||||
'"foo\\rbar"'
|
||||
"""
|
||||
|
||||
retVal = value
|
||||
|
||||
if retVal and isinstance(retVal, six.string_types):
|
||||
if not (retVal[0] == retVal[-1] == '"'):
|
||||
if any(_ in retVal for _ in (conf.get("csvDel", defaults.csvDel), '"', '\n')):
|
||||
if any(_ in retVal for _ in (conf.get("csvDel", defaults.csvDel), '"', '\n', '\r')):
|
||||
retVal = '"%s"' % retVal.replace('"', '""')
|
||||
|
||||
return retVal
|
||||
|
|
@ -5299,9 +5301,38 @@ def splitFields(fields, delimiter=','):
|
|||
|
||||
>>> splitFields('foo, bar, max(foo, bar)')
|
||||
['foo', 'bar', 'max(foo,bar)']
|
||||
>>> splitFields("a, 'b, c', d")
|
||||
['a', "'b, c'", 'd']
|
||||
"""
|
||||
|
||||
fields = fields.replace("%s " % delimiter, delimiter)
|
||||
# collapse "<delimiter> " -> "<delimiter>" but only OUTSIDE quoted string literals, so a
|
||||
# space inside e.g. 'b, c' survives (the quote handling mirrors zeroDepthSearch)
|
||||
normalized = []
|
||||
quote = None
|
||||
index = 0
|
||||
while index < len(fields):
|
||||
char = fields[index]
|
||||
if quote:
|
||||
normalized.append(char)
|
||||
if char == quote:
|
||||
if index + 1 < len(fields) and fields[index + 1] == quote: # escaped quote (e.g. '')
|
||||
normalized.append(fields[index + 1])
|
||||
index += 2
|
||||
continue
|
||||
else:
|
||||
quote = None
|
||||
elif char in ('"', "'"):
|
||||
quote = char
|
||||
normalized.append(char)
|
||||
elif char == delimiter and index + 1 < len(fields) and fields[index + 1] == ' ':
|
||||
normalized.append(char) # keep the delimiter, drop the single trailing space
|
||||
index += 2
|
||||
continue
|
||||
else:
|
||||
normalized.append(char)
|
||||
index += 1
|
||||
|
||||
fields = "".join(normalized)
|
||||
commas = [-1, len(fields)]
|
||||
commas.extend(zeroDepthSearch(fields, ','))
|
||||
commas = sorted(commas)
|
||||
|
|
|
|||
|
|
@ -2074,6 +2074,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
|||
kb.cache.comparison = LRUDict(capacity=256)
|
||||
kb.cache.encoding = LRUDict(capacity=256)
|
||||
kb.cache.alphaBoundaries = None
|
||||
kb.cache.charsetAsciiTbl = None
|
||||
kb.cache.hashRegex = None
|
||||
kb.cache.intBoundaries = None
|
||||
kb.cache.parsedDbms = {}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.6.115"
|
||||
VERSION = "1.10.6.116"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue