mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
Stabilizing DREI
This commit is contained in:
@@ -27,6 +27,7 @@ from lib.core.common import randomStr
|
||||
from lib.core.common import readXmlFile
|
||||
from lib.core.common import shellExec
|
||||
from lib.core.compat import round
|
||||
from lib.core.compat import xrange
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import paths
|
||||
@@ -47,6 +48,7 @@ class Failures(object):
|
||||
failedTraceBack = None
|
||||
|
||||
_failures = Failures()
|
||||
_rand = 0
|
||||
|
||||
def vulnTest():
|
||||
"""
|
||||
@@ -91,11 +93,45 @@ def vulnTest():
|
||||
|
||||
return retVal
|
||||
|
||||
def dirtyPatchRandom():
|
||||
"""
|
||||
Unifying random generated data across different Python versions
|
||||
"""
|
||||
|
||||
def _lcg():
|
||||
global _rand
|
||||
a = 1140671485
|
||||
c = 128201163
|
||||
m = 2 ** 24
|
||||
_rand = (a * _rand + c) % m
|
||||
return _rand
|
||||
|
||||
def _randint(a, b):
|
||||
_ = a + (_lcg() % (b - a + 1))
|
||||
return _
|
||||
|
||||
def _choice(seq):
|
||||
return seq[_randint(0, len(seq) - 1)]
|
||||
|
||||
def _sample(population, k):
|
||||
return [_choice(population) for _ in xrange(k)]
|
||||
|
||||
def _seed(seed):
|
||||
global _rand
|
||||
_rand = seed
|
||||
|
||||
random.choice = _choice
|
||||
random.randint = _randint
|
||||
random.sample = _sample
|
||||
random.seed = _seed
|
||||
|
||||
def smokeTest():
|
||||
"""
|
||||
Runs the basic smoke testing of a program
|
||||
"""
|
||||
|
||||
dirtyPatchRandom()
|
||||
|
||||
retVal = True
|
||||
count, length = 0, 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user