mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-26 03:23:48 +03:00
optimization of CPU intensive sanitizeAsciiString
This commit is contained in:
parent
5396f13bab
commit
7107e8fd6a
|
@ -1027,10 +1027,19 @@ def safeStringFormat(formatStr, params):
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def sanitizeAsciiString(subject):
|
def sanitizeAsciiString(subject):
|
||||||
retVal = None
|
|
||||||
if subject:
|
if subject:
|
||||||
retVal = "".join(char if ord(char) < 128 else '?' for char in subject)
|
index = None
|
||||||
return retVal
|
for i in xrange(len(subject)):
|
||||||
|
if ord(subject[i]) >= 128:
|
||||||
|
index = i
|
||||||
|
break
|
||||||
|
if not index:
|
||||||
|
return subject
|
||||||
|
else:
|
||||||
|
retVal = subject[:index] + "".join(subject[i] if ord(subject[i]) < 128 else '?' for i in xrange(index, len(subject)))
|
||||||
|
return retVal
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def decloakToNamedTemporaryFile(filepath, name=None):
|
def decloakToNamedTemporaryFile(filepath, name=None):
|
||||||
retVal = NamedTemporaryFile()
|
retVal = NamedTemporaryFile()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user