Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f36e093

Browse files
committed
minor update
1 parent 7e925bc commit f36e093

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

lib/core/common.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,7 @@ def goGoodSamaritan(part, prevValue, originalCharset):
12491249
predictionSet = set()
12501250
wildIndexes = []
12511251
singleValue = None
1252+
reObj = getCompiledRegex('\A%s' % prevValue)
12521253

12531254
if prevValue[-1] != '.':
12541255
prevValue += '.'
@@ -1265,7 +1266,7 @@ def goGoodSamaritan(part, prevValue, originalCharset):
12651266
if part in kb.commonOutputs:
12661267
for item in kb.commonOutputs[part]:
12671268
# Check if the common output (item) starts with prevValue
1268-
if re.search('\A%s' % prevValue, item):
1269+
if reObj.search(item):
12691270
singleValue = item
12701271

12711272
for index in wildIndexes:
@@ -1331,3 +1332,30 @@ def getPartRun():
13311332
break
13321333

13331334
return commonPartsDict[retVal][1] if retVal in commonPartsDict else retVal
1335+
1336+
def getCommonStart(strings=[]):
1337+
"""
1338+
Returns common start of given strings
1339+
"""
1340+
if not strings or not isinstance(strings, list):
1341+
return None
1342+
1343+
if len(strings) == 1:
1344+
return strings[0]
1345+
1346+
retVal = str()
1347+
maxCount = min(len(string) for string in strings)
1348+
1349+
count = 0
1350+
while count < maxCount:
1351+
char = strings[0][count]
1352+
for i in xrange(1, len(strings)):
1353+
if char != strings[i][count]:
1354+
char = None
1355+
break
1356+
if char is None:
1357+
break
1358+
retVal += char
1359+
count += 1
1360+
1361+
return retVal

lib/core/option.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,11 @@ def __basicOptionValidation():
10771077
conf.limitStop is not None and isinstance(conf.limitStop, int) and conf.limitStop > 0 and conf.limitStop <= conf.limitStart:
10781078
errMsg = "value for --start (limitStart) option must be smaller than value for --stop (limitStop) option"
10791079
raise sqlmapSyntaxException, errMsg
1080+
1081+
if conf.cpuThrottle is not None and isinstance(conf.cpuThrottle, int) and (conf.cpuThrottle > 100 or\
1082+
conf.cpuThrottle < 0):
1083+
errMsg = "value for --cpu-throttle (cpuThrottle) option must be in range [0,100]"
1084+
raise sqlmapSyntaxException, errMsg
10801085

10811086
def init(inputOptions=advancedDict()):
10821087
"""

0 commit comments

Comments
 (0)