some changes regarding --common-outputs feature

This commit is contained in:
Miroslav Stampar 2010-05-31 09:41:41 +00:00
parent 0450df8a77
commit 4bb5885413
3 changed files with 69 additions and 25 deletions

View File

@ -54,6 +54,8 @@ from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
from lib.core.data import queries from lib.core.data import queries
from lib.core.data import temp from lib.core.data import temp
from lib.core.convert import md5hash
from lib.core.convert import sha1hash
from lib.core.convert import urlencode from lib.core.convert import urlencode
from lib.core.convert import utf8decode from lib.core.convert import utf8decode
from lib.core.exception import sqlmapFilePathException from lib.core.exception import sqlmapFilePathException
@ -1224,7 +1226,9 @@ def initCommonOutputs():
if key not in kb.commonOutputs: if key not in kb.commonOutputs:
kb.commonOutputs[key] = [] kb.commonOutputs[key] = []
kb.commonOutputs[key].append(line.strip()) item = line.strip()
if item not in kb.commonOutputs[key]:
kb.commonOutputs[key].append(item)
cfile.close() cfile.close()
@ -1252,29 +1256,23 @@ def goGoodSamaritan(part, prevValue, originalCharset):
predictionSet = set() predictionSet = set()
wildIndexes = [] wildIndexes = []
singleValue = None singleValue = None
reObj = getCompiledRegex('\A%s' % prevValue)
if prevValue[-1] != '.':
prevValue += '.'
charIndex = 0
findIndex = prevValue.find('.', charIndex)
while findIndex != -1:
wildIndexes.append(findIndex)
charIndex += 1
findIndex = prevValue.find('.', charIndex)
# If the header we are looking for has common outputs defined # If the header we are looking for has common outputs defined
if part in kb.commonOutputs: if part in kb.commonOutputs:
for item in kb.commonOutputs[part]: for item in kb.commonOutputs[part]:
#if part == 'Passwords':
#if prevValue.startswith('*'): #MySQL_160bit
#return None, None, originalCharset
#if item not in kb.cache.md5:
#kb.cache.md5[item] = md5hash(item).upper()
#item = kb.cache.md5[item]
# Check if the common output (item) starts with prevValue # Check if the common output (item) starts with prevValue
if reObj.search(item): if item.startswith(prevValue):
singleValue = item singleValue = item
for index in wildIndexes: if len(item) > len(prevValue):
char = item[index] char = item[len(prevValue)]
if char not in predictionSet: if char not in predictionSet:
predictionSet.add(char) predictionSet.add(char)

View File

@ -214,13 +214,12 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
else: else:
if minValue == maxChar or maxValue == minChar: if minValue == maxChar or maxValue == minChar:
return None return None
retVal = originalTbl[originalTbl.index(minValue) + 1] for retVal in (originalTbl[originalTbl.index(minValue)], originalTbl[originalTbl.index(minValue) + 1]):
forgedPayload = safeStringFormat(payload.replace('%3E', '%3D'), (expressionUnescaped, idx, retVal)) forgedPayload = safeStringFormat(payload.replace('%3E', '%3D'), (expressionUnescaped, idx, retVal))
queriesCount[0] += 1 queriesCount[0] += 1
result = Request.queryPage(urlencode(forgedPayload)) result = Request.queryPage(urlencode(forgedPayload))
if result: if result:
return chr(retVal) if retVal < 128 else unichr(retVal) return chr(retVal) if retVal < 128 else unichr(retVal)
else:
return None return None
def etaProgressUpdate(charTime, index): def etaProgressUpdate(charTime, index):

View File

@ -1,10 +1,14 @@
[Databases] [Databases]
#MySQL
information_schema information_schema
mysql mysql
public public
master master
[Tables] [Tables]
#MySQL
CHARACTER_SETS CHARACTER_SETS
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_CHARACTER_SET_APPLICABILITY
COLLATIONS COLLATIONS
@ -33,3 +37,46 @@ TABLES
TRIGGERS TRIGGERS
USER_PRIVILEGES USER_PRIVILEGES
VIEWS VIEWS
#Oracle
BONUS
DEPT
EMP
SALGRADE
USERS
[Passwords]
root
test
testpass
password
abc123
qwertz
12345
123456
[Users]
#Oracle
SCOTT
MGMT_VIEW
MDDATA
SYSMAN
MDSYS
SI_INFORMTN_SCHEMA
ORDPLUGINS
ORDSYS
OLAPSYS
ANONYMOUS
XDB
CTXSYS
EXFSYS
WMSYS
DBSNMP
TSMSYS
DMSYS
DIP
OUTLN
SYSTEM
SYS