|
54 | 54 | from lib.core.data import paths |
55 | 55 | from lib.core.data import queries |
56 | 56 | from lib.core.data import temp |
| 57 | +from lib.core.convert import md5hash |
| 58 | +from lib.core.convert import sha1hash |
57 | 59 | from lib.core.convert import urlencode |
58 | 60 | from lib.core.convert import utf8decode |
59 | 61 | from lib.core.exception import sqlmapFilePathException |
@@ -1224,7 +1226,9 @@ def initCommonOutputs(): |
1224 | 1226 | if key not in kb.commonOutputs: |
1225 | 1227 | kb.commonOutputs[key] = [] |
1226 | 1228 |
|
1227 | | - kb.commonOutputs[key].append(line.strip()) |
| 1229 | + item = line.strip() |
| 1230 | + if item not in kb.commonOutputs[key]: |
| 1231 | + kb.commonOutputs[key].append(item) |
1228 | 1232 |
|
1229 | 1233 | cfile.close() |
1230 | 1234 |
|
@@ -1252,29 +1256,23 @@ def goGoodSamaritan(part, prevValue, originalCharset): |
1252 | 1256 | predictionSet = set() |
1253 | 1257 | wildIndexes = [] |
1254 | 1258 | singleValue = None |
1255 | | - reObj = getCompiledRegex('\A%s' % prevValue) |
1256 | | - |
1257 | | - if prevValue[-1] != '.': |
1258 | | - prevValue += '.' |
1259 | | - |
1260 | | - charIndex = 0 |
1261 | | - findIndex = prevValue.find('.', charIndex) |
1262 | | - |
1263 | | - while findIndex != -1: |
1264 | | - wildIndexes.append(findIndex) |
1265 | | - charIndex += 1 |
1266 | | - findIndex = prevValue.find('.', charIndex) |
1267 | 1259 |
|
1268 | 1260 | # If the header we are looking for has common outputs defined |
1269 | 1261 | if part in kb.commonOutputs: |
1270 | 1262 | for item in kb.commonOutputs[part]: |
| 1263 | + #if part == 'Passwords': |
| 1264 | + #if prevValue.startswith('*'): #MySQL_160bit |
| 1265 | + #return None, None, originalCharset |
| 1266 | + #if item not in kb.cache.md5: |
| 1267 | + #kb.cache.md5[item] = md5hash(item).upper() |
| 1268 | + #item = kb.cache.md5[item] |
| 1269 | + |
1271 | 1270 | # Check if the common output (item) starts with prevValue |
1272 | | - if reObj.search(item): |
| 1271 | + if item.startswith(prevValue): |
1273 | 1272 | singleValue = item |
1274 | 1273 |
|
1275 | | - for index in wildIndexes: |
1276 | | - char = item[index] |
1277 | | - |
| 1274 | + if len(item) > len(prevValue): |
| 1275 | + char = item[len(prevValue)] |
1278 | 1276 | if char not in predictionSet: |
1279 | 1277 | predictionSet.add(char) |
1280 | 1278 |
|
|
0 commit comments