mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +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
|
||||
|
||||
def sanitizeAsciiString(subject):
|
||||
retVal = None
|
||||
if subject:
|
||||
retVal = "".join(char if ord(char) < 128 else '?' for char in subject)
|
||||
index = None
|
||||
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):
|
||||
retVal = NamedTemporaryFile()
|
||||
|
|
Loading…
Reference in New Issue
Block a user