mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 05:01:30 +00:00
Patch for an Issue #703
This commit is contained in:
@@ -917,7 +917,7 @@ def readInput(message, default=None, checkBatch=True):
|
||||
|
||||
return retVal
|
||||
|
||||
def randomRange(start=0, stop=1000):
|
||||
def randomRange(start=0, stop=1000, seed=None):
|
||||
"""
|
||||
Returns random integer value in given range
|
||||
|
||||
@@ -926,9 +926,11 @@ def randomRange(start=0, stop=1000):
|
||||
423
|
||||
"""
|
||||
|
||||
return int(random.randint(start, stop))
|
||||
randint = random.WichmannHill(seed).randint if seed is not None else random.randint
|
||||
|
||||
def randomInt(length=4):
|
||||
return int(randint(start, stop))
|
||||
|
||||
def randomInt(length=4, seed=None):
|
||||
"""
|
||||
Returns random integer value with provided number of digits
|
||||
|
||||
@@ -937,9 +939,11 @@ def randomInt(length=4):
|
||||
874254
|
||||
"""
|
||||
|
||||
return int("".join(random.choice(string.digits if _ != 0 else string.digits.replace('0', '')) for _ in xrange(0, length)))
|
||||
choice = random.WichmannHill(seed).choice if seed is not None else random.choice
|
||||
|
||||
def randomStr(length=4, lowercase=False, alphabet=None):
|
||||
return int("".join(choice(string.digits if _ != 0 else string.digits.replace('0', '')) for _ in xrange(0, length)))
|
||||
|
||||
def randomStr(length=4, lowercase=False, alphabet=None, seed=None):
|
||||
"""
|
||||
Returns random string value with provided number of characters
|
||||
|
||||
@@ -948,12 +952,14 @@ def randomStr(length=4, lowercase=False, alphabet=None):
|
||||
'RNvnAv'
|
||||
"""
|
||||
|
||||
choice = random.WichmannHill(seed).choice if seed is not None else random.choice
|
||||
|
||||
if alphabet:
|
||||
retVal = "".join(random.choice(alphabet) for _ in xrange(0, length))
|
||||
retVal = "".join(choice(alphabet) for _ in xrange(0, length))
|
||||
elif lowercase:
|
||||
retVal = "".join(random.choice(string.ascii_lowercase) for _ in xrange(0, length))
|
||||
retVal = "".join(choice(string.ascii_lowercase) for _ in xrange(0, length))
|
||||
else:
|
||||
retVal = "".join(random.choice(string.ascii_letters) for _ in xrange(0, length))
|
||||
retVal = "".join(choice(string.ascii_letters) for _ in xrange(0, length))
|
||||
|
||||
return retVal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user