@@ -1166,49 +1166,54 @@ def calculateDeltaSeconds(start, epsilon=0.05):
11661166
11671167def initCommonOutputs ():
11681168 kb .commonOutputs = {}
1169+ key = None
1170+
11691171 fileName = os .path .join (paths .SQLMAP_TXT_PATH , 'common-outputs.txt' )
11701172 file = open (fileName , 'r' )
1171- key = None
1173+
11721174 for line in file .xreadlines ():
11731175 line = line .strip ()
11741176 if len (line ) > 1 :
11751177 if line [0 ] == '[' and line [- 1 ] == ']' :
11761178 key = line [1 :- 1 ]
11771179 elif key :
1178- if key not in kb .commonTables :
1179- kb .commonTables [key ] = []
1180- kb .commonTables [key ].append (line .strip ())
1180+ if key not in kb .commonOutputs :
1181+ kb .commonOutputs [key ] = []
1182+ kb .commonOutputs [key ].append (line .strip ())
1183+ file .close ()
11811184
1182- def getGoodSamaritanCharsets (part , originalCharset ):
1185+ def getGoodSamaritanCharsets (part , prevValue , originalCharset ):
1186+ ###wild card . (dot) is supported for compatibility with threading
11831187 if not kb .commonOutputs :
11841188 initCommonOutputs ()
11851189
11861190 predictionSet = set ()
11871191 wildIndexes = []
11881192
1189- if value [- 1 ] != '.' :
1190- value += '.'
1193+ if prevValue [- 1 ] != '.' :
1194+ prevValue += '.'
11911195 charIndex = 0
1192- findIndex = value .find ('.' , charIndex )
1196+ findIndex = prevValue .find ('.' , charIndex )
11931197 while findIndex != - 1 :
11941198 wildIndexes .append (findIndex )
11951199 charIndex += 1
1196- findIndex = value .find ('.' , charIndex )
1197- if kb .dbms in kb .commonTables :
1198- for item in kb .commonTables [kb .dbms ]:
1199- if re .search ('\A%s' % value , item ):
1200+ findIndex = prevValue .find ('.' , charIndex )
1201+
1202+ if part in kb .commonOutputs :
1203+ for item in kb .commonOutputs [kb .dbms ]:
1204+ if re .search ('\A%s' % prevValue , item ):
12001205 for index in wildIndexes :
12011206 char = item [index ]
12021207 if char not in predictionSet :
12031208 predictionSet .add (char )
1204- predictionTable = []
1205- otherTable = []
1209+ predictedCharset = []
1210+ otherCharset = []
12061211 for ordChar in originalTable :
12071212 if chr (ordChar ) not in predictionSet :
1208- otherTable .append (ordChar )
1213+ otherCharset .append (ordChar )
12091214 else :
1210- predictionTable .append (ordChar )
1211- predictionTable .sort ()
1212- return predictionTable , otherTable
1215+ predictedCharset .append (ordChar )
1216+ predictedCharset .sort ()
1217+ return predictedCharset , otherCharset
12131218 else :
12141219 return None , originalTable
0 commit comments