@@ -1165,7 +1165,6 @@ def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
11651165 gobject .timeout_add (1000 , win .update , dotOutputFile )
11661166 gtk .main ()
11671167
1168-
11691168def getConsoleWidth (default = 80 ):
11701169 width = None
11711170
@@ -1204,31 +1203,36 @@ def initCommonOutputs():
12041203 key = None
12051204
12061205 fileName = os .path .join (paths .SQLMAP_TXT_PATH , 'common-outputs.txt' )
1207- file = open (fileName , 'r' )
1206+ cfile = open (fileName , 'r' )
12081207
1209- for line in file .xreadlines ():
1208+ for line in cfile .xreadlines ():
12101209 line = line .strip ()
1210+
12111211 if len (line ) > 1 :
12121212 if line [0 ] == '[' and line [- 1 ] == ']' :
12131213 key = line [1 :- 1 ]
12141214 elif key :
12151215 if key not in kb .commonOutputs :
12161216 kb .commonOutputs [key ] = []
1217+
12171218 kb .commonOutputs [key ].append (line .strip ())
1218- file .close ()
1219+
1220+ cfile .close ()
12191221
12201222def getGoodSamaritanCharsets (part , prevValue , originalCharset ):
12211223 ###wild card . (dot) is supported for compatibility with threading
1222- if not kb .commonOutputs :
1224+ if kb .commonOutputs is None :
12231225 initCommonOutputs ()
12241226
12251227 predictionSet = set ()
12261228 wildIndexes = []
12271229
12281230 if prevValue [- 1 ] != '.' :
12291231 prevValue += '.'
1232+
12301233 charIndex = 0
12311234 findIndex = prevValue .find ('.' , charIndex )
1235+
12321236 while findIndex != - 1 :
12331237 wildIndexes .append (findIndex )
12341238 charIndex += 1
@@ -1239,16 +1243,21 @@ def getGoodSamaritanCharsets(part, prevValue, originalCharset):
12391243 if re .search ('\A%s' % prevValue , item ):
12401244 for index in wildIndexes :
12411245 char = item [index ]
1246+
12421247 if char not in predictionSet :
12431248 predictionSet .add (char )
1249+
12441250 predictedCharset = []
12451251 otherCharset = []
1252+
12461253 for ordChar in originalTable :
12471254 if chr (ordChar ) not in predictionSet :
12481255 otherCharset .append (ordChar )
12491256 else :
12501257 predictedCharset .append (ordChar )
1258+
12511259 predictedCharset .sort ()
1260+
12521261 return predictedCharset , otherCharset
12531262 else :
12541263 return None , originalTable
0 commit comments