mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
new commit regarding good samaritan feature
This commit is contained in:
parent
2a1dd492f5
commit
056d1ad76e
|
@ -1224,6 +1224,9 @@ def getGoodSamaritanCharsets(part, prevValue, originalCharset):
|
||||||
if kb.commonOutputs is None:
|
if kb.commonOutputs is None:
|
||||||
initCommonOutputs()
|
initCommonOutputs()
|
||||||
|
|
||||||
|
if not part or not prevValue: #is not None and != ""
|
||||||
|
return None, originalCharset
|
||||||
|
|
||||||
predictionSet = set()
|
predictionSet = set()
|
||||||
wildIndexes = []
|
wildIndexes = []
|
||||||
|
|
||||||
|
@ -1239,7 +1242,7 @@ def getGoodSamaritanCharsets(part, prevValue, originalCharset):
|
||||||
findIndex = prevValue.find('.', charIndex)
|
findIndex = prevValue.find('.', charIndex)
|
||||||
|
|
||||||
if part in kb.commonOutputs:
|
if part in kb.commonOutputs:
|
||||||
for item in kb.commonOutputs[kb.dbms]:
|
for item in kb.commonOutputs[part]:
|
||||||
if re.search('\A%s' % prevValue, item):
|
if re.search('\A%s' % prevValue, item):
|
||||||
for index in wildIndexes:
|
for index in wildIndexes:
|
||||||
char = item[index]
|
char = item[index]
|
||||||
|
@ -1250,7 +1253,7 @@ def getGoodSamaritanCharsets(part, prevValue, originalCharset):
|
||||||
predictedCharset = []
|
predictedCharset = []
|
||||||
otherCharset = []
|
otherCharset = []
|
||||||
|
|
||||||
for ordChar in originalTable:
|
for ordChar in originalCharset:
|
||||||
if chr(ordChar) not in predictionSet:
|
if chr(ordChar) not in predictionSet:
|
||||||
otherCharset.append(ordChar)
|
otherCharset.append(ordChar)
|
||||||
else:
|
else:
|
||||||
|
@ -1260,7 +1263,7 @@ def getGoodSamaritanCharsets(part, prevValue, originalCharset):
|
||||||
|
|
||||||
return predictedCharset, otherCharset
|
return predictedCharset, otherCharset
|
||||||
else:
|
else:
|
||||||
return None, originalTable
|
return None, originalCharset
|
||||||
|
|
||||||
def getCompiledRegex(regex):
|
def getCompiledRegex(regex):
|
||||||
if regex in __compiledRegularExpressions:
|
if regex in __compiledRegularExpressions:
|
||||||
|
|
|
@ -141,12 +141,23 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getChar(idx, charTbl=asciiTbl):
|
def getChar(idx, charTbl=asciiTbl, sequentialOrder=True):
|
||||||
result = tryHint(idx)
|
result = tryHint(idx)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
if not sequentialOrder:
|
||||||
|
originalTbl = list(charTbl)
|
||||||
|
|
||||||
|
if len(charTbl) == 1:
|
||||||
|
forgedPayload = safeStringFormat(payload.replace('%3E', '%3D'), (expressionUnescaped, idx, charTbl[0]))
|
||||||
|
result = Request.queryPage(urlencode(forgedPayload))
|
||||||
|
if result:
|
||||||
|
return chr(charTbl[0]) if charTbl[0] < 128 else unichr(charTbl[0])
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
maxChar = maxValue = charTbl[-1]
|
maxChar = maxValue = charTbl[-1]
|
||||||
minValue = charTbl[0]
|
minValue = charTbl[0]
|
||||||
|
|
||||||
|
@ -189,15 +200,14 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
if maxValue == 1:
|
if maxValue == 1:
|
||||||
return None
|
return None
|
||||||
elif minValue == maxChar:
|
elif minValue == maxChar:
|
||||||
charTbl = xrange( maxChar + 1, (maxChar + 1) << 8 )
|
charTbl = xrange(maxChar + 1, (maxChar + 1) << 8)
|
||||||
maxChar = maxValue = charTbl[-1]
|
maxChar = maxValue = charTbl[-1]
|
||||||
minValue = charTbl[0]
|
minValue = charTbl[0]
|
||||||
else:
|
elif sequentialOrder:
|
||||||
retVal = minValue + 1
|
retVal = minValue + 1
|
||||||
if retVal < 128:
|
return chr(retVal) if retVal < 128 else unichr(retVal)
|
||||||
return chr(retVal)
|
else:
|
||||||
else:
|
retVal = originalTbl[originalTbl.index(minValue) + 1]
|
||||||
return unichr(retVal)
|
|
||||||
|
|
||||||
def etaProgressUpdate(charTime, index):
|
def etaProgressUpdate(charTime, index):
|
||||||
if len(progressTime) <= ( (length * 3) / 100 ):
|
if len(progressTime) <= ( (length * 3) / 100 ):
|
||||||
|
@ -361,7 +371,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
|
|
||||||
if conf.useCommonPrediction:
|
if conf.useCommonPrediction:
|
||||||
predictedCharset, otherCharset = getGoodSamaritanCharsets(kb.partRun, finalValue, asciiTbl)
|
predictedCharset, otherCharset = getGoodSamaritanCharsets(kb.partRun, finalValue, asciiTbl)
|
||||||
val = getChar(index, predictedCharset) if predictedCharset else None
|
val = getChar(index, predictedCharset, False) if predictedCharset else None
|
||||||
if not val:
|
if not val:
|
||||||
val = getChar(index, otherCharset)
|
val = getChar(index, otherCharset)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
[Tables]
|
[Tables]
|
||||||
users
|
users
|
||||||
|
|
||||||
|
[Users]
|
||||||
|
luther
|
Loading…
Reference in New Issue
Block a user