mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
str() -> unicode()
This commit is contained in:
parent
f24187f251
commit
a3db3c03c1
|
@ -257,7 +257,7 @@ def checkDynParam(place, parameter, value):
|
|||
logger.info(infoMsg)
|
||||
|
||||
randInt = randomInt()
|
||||
payload = agent.payload(place, parameter, value, str(randInt))
|
||||
payload = agent.payload(place, parameter, value, unicode(randInt))
|
||||
dynResult1 = Request.queryPage(payload, place)
|
||||
|
||||
if True == dynResult1:
|
||||
|
@ -395,7 +395,7 @@ def checkConnection():
|
|||
conf.seqMatcher.set_seq1(page)
|
||||
|
||||
except sqlmapConnectionException, errMsg:
|
||||
errMsg = str(errMsg)
|
||||
errMsg = unicode(errMsg)
|
||||
raise sqlmapConnectionException, errMsg
|
||||
|
||||
return True
|
||||
|
|
|
@ -155,7 +155,7 @@ def start():
|
|||
|
||||
if not conf.dropSetCookie:
|
||||
for _, cookie in enumerate(conf.cj):
|
||||
cookie = str(cookie)
|
||||
cookie = unicode(cookie)
|
||||
index = cookie.index(" for ")
|
||||
|
||||
cookieStr += "%s;" % cookie[8:index]
|
||||
|
@ -267,7 +267,7 @@ def start():
|
|||
action()
|
||||
|
||||
except exceptionsTuple, e:
|
||||
e = str(e)
|
||||
e = unicode(e)
|
||||
|
||||
if conf.multipleTargets:
|
||||
e += ", skipping to next url"
|
||||
|
|
|
@ -451,7 +451,7 @@ def readInput(message, default=None):
|
|||
message += "\n> "
|
||||
|
||||
if conf.batch and default:
|
||||
infoMsg = "%s%s" % (message, str(default))
|
||||
infoMsg = "%s%s" % (message, unicode(default))
|
||||
logger.info(infoMsg)
|
||||
|
||||
debugMsg = "used the default behaviour, running in batch mode"
|
||||
|
@ -517,7 +517,7 @@ def sanitizeStr(inpStr):
|
|||
@rtype: C{str}
|
||||
"""
|
||||
|
||||
cleanString = str(inpStr)
|
||||
cleanString = unicode(inpStr)
|
||||
cleanString = cleanString.replace("\n", " ").replace("\r", "")
|
||||
|
||||
return cleanString
|
||||
|
@ -638,8 +638,8 @@ def parseTargetDirect():
|
|||
conf.dbmsUser = details.group('user')
|
||||
conf.dbmsPass = details.group('pass')
|
||||
else:
|
||||
conf.dbmsUser = str()
|
||||
conf.dbmsPass = str()
|
||||
conf.dbmsUser = unicode()
|
||||
conf.dbmsPass = unicode()
|
||||
|
||||
if not conf.dbmsPass:
|
||||
conf.dbmsPass = None
|
||||
|
@ -1032,7 +1032,7 @@ def safeStringFormat(formatStr, params):
|
|||
|
||||
if index != -1:
|
||||
if count < len(params):
|
||||
retVal = retVal[:index] + str(params[count]) + retVal[index+2:]
|
||||
retVal = retVal[:index] + unicode(params[count]) + retVal[index+2:]
|
||||
else:
|
||||
raise sqlmapNoneDataException, "wrong number of parameters during string formatting"
|
||||
count += 1
|
||||
|
@ -1107,7 +1107,7 @@ def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
|
|||
import gtk
|
||||
import pydot
|
||||
except ImportError, e:
|
||||
errMsg = "profiling requires third-party libraries (%s)" % str(e)
|
||||
errMsg = "profiling requires third-party libraries (%s)" % unicode(e)
|
||||
logger.error(errMsg)
|
||||
return
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ def getCommonStart(strings=[]):
|
|||
if len(strings) == 1:
|
||||
return strings[0]
|
||||
|
||||
retVal = str()
|
||||
retVal = unicode()
|
||||
maxCount = min(len(string) for string in strings)
|
||||
|
||||
count = 0
|
||||
|
|
|
@ -63,7 +63,7 @@ class Dump:
|
|||
|
||||
return
|
||||
|
||||
data = str(data)
|
||||
data = unicode(data)
|
||||
|
||||
if data:
|
||||
data = data.replace("__NEWLINE__", "\n").replace("__TAB__", "\t")
|
||||
|
@ -93,7 +93,7 @@ class Dump:
|
|||
if isinstance(element, basestring):
|
||||
self.__write("[*] %s" % element)
|
||||
elif isinstance(element, (list, tuple, set)):
|
||||
self.__write("[*] " + ", ".join(str(e) for e in element))
|
||||
self.__write("[*] " + ", ".join(unicode(e) for e in element))
|
||||
|
||||
if elements:
|
||||
self.__write("")
|
||||
|
|
|
@ -80,7 +80,7 @@ class ProgressBar:
|
|||
" " * (allFull - numHashes))
|
||||
|
||||
# Add the percentage at the beginning of the progress bar
|
||||
percentString = str(percentDone) + "%"
|
||||
percentString = unicode(percentDone) + "%"
|
||||
self.__progBar = "%s %s" % (percentString, self.__progBar)
|
||||
|
||||
def draw(self, eta=0):
|
||||
|
@ -102,4 +102,4 @@ class ProgressBar:
|
|||
This method returns the progress bar string
|
||||
"""
|
||||
|
||||
return str(self.__progBar)
|
||||
return unicode(self.__progBar)
|
||||
|
|
|
@ -214,7 +214,7 @@ def __updateSqlmap():
|
|||
logger.debug(debugMsg)
|
||||
|
||||
def notify(event_dict):
|
||||
action = str(event_dict['action'])
|
||||
action = unicode(event_dict['action'])
|
||||
index = action.find('_')
|
||||
prefix = action[index + 1].upper() if index != -1 else action.capitalize()
|
||||
|
||||
|
@ -224,7 +224,7 @@ def __updateSqlmap():
|
|||
if action.find('_completed') == -1:
|
||||
print "%s\t%s" % (prefix, event_dict['path'])
|
||||
else:
|
||||
revision = str(event_dict['revision'])
|
||||
revision = unicode(event_dict['revision'])
|
||||
index = revision.find('number ')
|
||||
|
||||
if index != -1:
|
||||
|
|
|
@ -94,7 +94,7 @@ def decodePage(page, encoding):
|
|||
Decode gzip/deflate HTTP response
|
||||
"""
|
||||
|
||||
if str(encoding).lower() in ('gzip', 'x-gzip', 'deflate'):
|
||||
if unicode(encoding).lower() in (u'gzip', u'x-gzip', u'deflate'):
|
||||
if encoding == 'deflate':
|
||||
# http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
|
||||
data = StringIO.StringIO(zlib.decompress(page, -15))
|
||||
|
|
|
@ -163,7 +163,7 @@ class Connect:
|
|||
if not cookieStr:
|
||||
cookieStr = "Cookie: "
|
||||
|
||||
cookie = str(cookie)
|
||||
cookie = unicode(cookie)
|
||||
index = cookie.index(" for ")
|
||||
|
||||
cookieStr += "%s; " % cookie[8:index]
|
||||
|
@ -257,7 +257,7 @@ class Connect:
|
|||
responseMsg += "(%s - %d):\n" % (status, code)
|
||||
|
||||
if conf.verbose <= 4:
|
||||
responseMsg += str(responseHeaders)
|
||||
responseMsg += unicode(responseHeaders)
|
||||
elif conf.verbose > 4:
|
||||
responseMsg += "%s\n%s\n" % (responseHeaders, page)
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ def direct(query, content=True):
|
|||
output = base64unpickle(kb.resumedQueries[conf.hostname][query][:-1])
|
||||
|
||||
infoMsg = "resumed from file '%s': " % conf.sessionFile
|
||||
infoMsg += "%s..." % str(output)[:20]
|
||||
infoMsg += "%s..." % unicode(output)[:20]
|
||||
logger.info(infoMsg)
|
||||
elif select:
|
||||
output = timeout(func=conf.dbmsConnector.select, args=(query,), duration=conf.timeout, default=None)
|
||||
|
@ -67,7 +67,7 @@ def direct(query, content=True):
|
|||
|
||||
if len(output) == 1:
|
||||
if len(output[0]) == 1:
|
||||
return str(list(output)[0][0])
|
||||
return unicode(list(output)[0][0])
|
||||
else:
|
||||
return list(output)
|
||||
else:
|
||||
|
|
|
@ -156,7 +156,7 @@ class Metasploit:
|
|||
|
||||
if not choice:
|
||||
if lst:
|
||||
choice = str(default)
|
||||
choice = unicode(default)
|
||||
else:
|
||||
return default
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ def unionUse(expression, direct=False, unescape=True, resetCounter=False, nullCh
|
|||
# sql injection output
|
||||
startPosition = resultPage.index(temp.start)
|
||||
endPosition = resultPage.rindex(temp.stop) + len(temp.stop)
|
||||
value = str(resultPage[startPosition:endPosition])
|
||||
value = unicode(resultPage[startPosition:endPosition])
|
||||
|
||||
duration = calculateDeltaSeconds(start)
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class Google:
|
|||
responseMsg = "HTTP response (%s - %d):\n" % (status, code)
|
||||
|
||||
if conf.verbose <= 4:
|
||||
responseMsg += str(responseHeaders)
|
||||
responseMsg += unicode(responseHeaders)
|
||||
elif conf.verbose > 4:
|
||||
responseMsg += "%s\n%s\n" % (responseHeaders, page)
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class Fingerprint(GenericFingerprint):
|
|||
for i in xrange(len(table)):
|
||||
version, checks = table[i]
|
||||
failed = False
|
||||
check = checks[randomRange(0,len(checks)-1)].replace("%d", str(randomRange(1,100)))
|
||||
check = checks[randomRange(0,len(checks)-1)].replace("%d", unicode(randomRange(1,100)))
|
||||
payload = agent.fullPayload(check)
|
||||
result = Request.queryPage(payload)
|
||||
if result:
|
||||
|
|
|
@ -217,7 +217,7 @@ class Fingerprint(GenericFingerprint):
|
|||
|
||||
for sp in sps:
|
||||
query = "(SELECT LEN(%s) FROM %s WHERE %s " % (self.tblField, self.fileTblName, self.tblField)
|
||||
query += "LIKE '%Service Pack " + str(sp) + "%')>0"
|
||||
query += "LIKE '%Service Pack " + unicode(sp) + "%')>0"
|
||||
query = agent.forgeCaseStatement(query)
|
||||
|
||||
if inject.getValue(query, charsetType=1) == "1":
|
||||
|
|
|
@ -76,7 +76,7 @@ class Fingerprint(GenericFingerprint):
|
|||
|
||||
for version in range(element[0], element[1] + 1):
|
||||
randInt = randomInt()
|
||||
version = str(version)
|
||||
version = unicode(version)
|
||||
query = agent.prefixQuery(" /*!%s AND %d=%d*/" % (version, randInt, randInt + 1))
|
||||
query = agent.postfixQuery(query)
|
||||
payload = agent.payload(newValue=query)
|
||||
|
@ -168,7 +168,7 @@ class Fingerprint(GenericFingerprint):
|
|||
infoMsg = "testing MySQL"
|
||||
logger.info(infoMsg)
|
||||
|
||||
randInt = str(randomInt(1))
|
||||
randInt = unicode(randomInt(1))
|
||||
payload = agent.fullPayload(" AND CONNECTION_ID()=CONNECTION_ID()")
|
||||
result = Request.queryPage(payload)
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class Fingerprint(GenericFingerprint):
|
|||
infoMsg = "testing PostgreSQL"
|
||||
logger.info(infoMsg)
|
||||
|
||||
randInt = str(randomInt(1))
|
||||
randInt = unicode(randomInt(1))
|
||||
|
||||
payload = agent.fullPayload(" AND %s::int=%s" % (randInt, randInt))
|
||||
result = Request.queryPage(payload)
|
||||
|
|
Loading…
Reference in New Issue
Block a user