Skip to content

Commit 25f0ec3

Browse files
committed
some minor range to xrange conversion (where safe to do)
1 parent eb24024 commit 25f0ec3

24 files changed

Lines changed: 29 additions & 29 deletions

File tree

‎extra/keepalive/keepalive.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def comp(N, url):
422422
def fetch(N, url, delay=0):
423423
lens = []
424424
starttime = time.time()
425-
for i in range(N):
425+
for i in xrange(N):
426426
if delay and i > 0: time.sleep(delay)
427427
fo = urllib2.urlopen(url)
428428
foo = fo.read()

‎lib/core/agent.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
562562
inbandQuery = self.prefixQuery("UNION ALL SELECT ", prefix=prefix)
563563

564564
if limited:
565-
inbandQuery += ",".join(map(lambda x: char if x != position else '(SELECT %s)' % query, range(0, count)))
565+
inbandQuery += ",".join(map(lambda x: char if x != position else '(SELECT %s)' % query, xrange(0, count)))
566566
inbandQuery += FROM_TABLE.get(Backend.getIdentifiedDbms(), "")
567567
inbandQuery = self.suffixQuery(inbandQuery, comment, suffix)
568568

@@ -583,7 +583,7 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
583583
if Backend.getIdentifiedDbms() in FROM_TABLE and inbandQuery.endswith(FROM_TABLE[Backend.getIdentifiedDbms()]):
584584
inbandQuery = inbandQuery[:-len(FROM_TABLE[Backend.getIdentifiedDbms()])]
585585

586-
for element in range(0, count):
586+
for element in xrange(0, count):
587587
if element > 0:
588588
inbandQuery += ", "
589589

@@ -610,7 +610,7 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
610610
if multipleUnions:
611611
inbandQuery += " UNION ALL SELECT "
612612

613-
for element in range(count):
613+
for element in xrange(count):
614614
if element > 0:
615615
inbandQuery += ", "
616616

‎lib/core/common.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2817,7 +2817,7 @@ def safeSQLIdentificatorNaming(name, isTable=False):
28172817

28182818
parts = name.split('.')
28192819

2820-
for i in range(len(parts)):
2820+
for i in xrange(len(parts)):
28212821
if not re.match(r"\A[A-Za-z0-9_]+\Z", parts[i]):
28222822
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS):
28232823
parts[i] = "`%s`" % parts[i].strip("`")

‎lib/core/dump.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def dbTableValues(self, tableValues):
414414
warnMsg += "due to the large table size"
415415
logger.warning(warnMsg)
416416

417-
for i in range(count):
417+
for i in xrange(count):
418418
console = (i >= count - TRIM_STDOUT_DUMP_SIZE)
419419
field = 1
420420
values = []

‎lib/core/target.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ def __setRequestParams():
111111
conf.paramDict[PLACE.URI] = {}
112112
parts = conf.url.split(URI_INJECTION_MARK_CHAR)
113113

114-
for i in range(len(parts)-1):
114+
for i in xrange(len(parts)-1):
115115
result = str()
116116

117-
for j in range(len(parts)):
117+
for j in xrange(len(parts)):
118118
result += parts[j]
119119

120120
if i == j:

‎lib/core/threads.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
110110
return
111111

112112
# Start the threads
113-
for numThread in range(numThreads):
113+
for numThread in xrange(numThreads):
114114
thread = threading.Thread(target=exceptionHandledFunction, name=str(numThread), args=[threadFunction])
115115

116116
# Reference: http://stackoverflow.com/questions/190010/daemon-threads-explanation

‎lib/techniques/union/test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __orderByTest(cols):
107107
min_, max_ = MAX_RATIO, MIN_RATIO
108108
pages = {}
109109

110-
for count in range(lowerCount, upperCount+1):
110+
for count in xrange(lowerCount, upperCount+1):
111111
query = agent.forgeInbandQuery('', -1, count, comment, prefix, suffix, kb.uChar)
112112
payload = agent.payload(place=place, parameter=parameter, newValue=query, where=where)
113113
page, headers = Request.queryPage(payload, place=place, content=True, raise404=False)

‎lib/utils/hash.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def attackDumpedTable():
303303
results = dictionaryAttack(attack_dict)
304304

305305
for (user, hash_, password) in results:
306-
for i in range(count):
306+
for i in xrange(count):
307307
for column in columns:
308308
if column == colUser or column == '__infos__':
309309
continue

‎plugins/dbms/access/syntax.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def unescape(expression, quote=True):
3333
old = "'%s'" % expression[firstIndex:lastIndex]
3434
unescaped = ""
3535

36-
for i in range(firstIndex, lastIndex):
36+
for i in xrange(firstIndex, lastIndex):
3737
unescaped += "CHR(%d)" % (ord(expression[i]))
3838
if i < lastIndex - 1:
3939
unescaped += "&"

‎plugins/dbms/db2/syntax.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""
4-
$Id$
4+
$Id$
55
66
Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
77
See the file 'doc/COPYING' for copying permission
@@ -34,7 +34,7 @@ def unescape(expression, quote=True):
3434
old = "'%s'" % expression[firstIndex:lastIndex]
3535
unescaped = ""
3636

37-
for i in range(firstIndex, lastIndex):
37+
for i in xrange(firstIndex, lastIndex):
3838
unescaped += "CHR(%d)" % (ord(expression[i]))
3939
if i < lastIndex - 1:
4040
unescaped += "||"

0 commit comments

Comments
 (0)