@@ -1443,13 +1443,14 @@ def parseTargetUrl():
14431443 conf .hostname = conf .hostname .strip ("[]" ).replace (kb .customInjectionMark , "" )
14441444
14451445 try :
1446- _ = conf .hostname .encode ("idna" )
1447- except LookupError :
1448- _ = conf .hostname .encode (UNICODE_ENCODING )
1449- except UnicodeError :
1450- _ = None
1446+ conf .hostname .encode ("idna" )
1447+ conf .hostname .encode (UNICODE_ENCODING )
1448+ except (LookupError , UnicodeError ):
1449+ invalid = True
1450+ else :
1451+ invalid = False
14511452
1452- if any ((_ is None , re .search (r"\s" , conf .hostname ), '..' in conf .hostname , conf .hostname .startswith ('.' ), '\n ' in originalUrl )):
1453+ if any ((invalid , re .search (r"\s" , conf .hostname ), '..' in conf .hostname , conf .hostname .startswith ('.' ), '\n ' in originalUrl )):
14531454 errMsg = "invalid target URL ('%s')" % originalUrl
14541455 raise SqlmapSyntaxException (errMsg )
14551456
@@ -2994,7 +2995,7 @@ def setOptimize():
29942995 Sets options turned on by switch '-o'
29952996 """
29962997
2997- #conf.predictOutput = True
2998+ # conf.predictOutput = True
29982999 conf .keepAlive = True
29993000 conf .threads = 3 if conf .threads < 3 else conf .threads
30003001 conf .nullConnection = not any ((conf .data , conf .textOnly , conf .titles , conf .string , conf .notString , conf .regexp , conf .tor ))
@@ -3198,9 +3199,7 @@ def showHttpErrorCodes():
31983199
31993200 if kb .httpErrorCodes :
32003201 warnMsg = "HTTP error codes detected during run:\n "
3201- warnMsg += ", " .join ("%d (%s) - %d times" % (code , httplib .responses [code ] \
3202- if code in httplib .responses else '?' , count ) \
3203- for code , count in kb .httpErrorCodes .items ())
3202+ warnMsg += ", " .join ("%d (%s) - %d times" % (code , httplib .responses [code ] if code in httplib .responses else '?' , count ) for code , count in kb .httpErrorCodes .items ())
32043203 logger .warn (warnMsg )
32053204 if any ((str (_ ).startswith ('4' ) or str (_ ).startswith ('5' )) and _ != httplib .INTERNAL_SERVER_ERROR and _ != kb .originalCode for _ in kb .httpErrorCodes .keys ()):
32063205 msg = "too many 4xx and/or 5xx HTTP error codes "
@@ -3216,8 +3215,7 @@ def openFile(filename, mode='r', encoding=UNICODE_ENCODING, errors="replace", bu
32163215 return codecs .open (filename , mode , encoding , errors , buffering )
32173216 except IOError :
32183217 errMsg = "there has been a file opening error for filename '%s'. " % filename
3219- errMsg += "Please check %s permissions on a file " % ("write" if \
3220- mode and ('w' in mode or 'a' in mode or '+' in mode ) else "read" )
3218+ errMsg += "Please check %s permissions on a file " % ("write" if mode and ('w' in mode or 'a' in mode or '+' in mode ) else "read" )
32213219 errMsg += "and that it's not locked by another process."
32223220 raise SqlmapSystemException (errMsg )
32233221
@@ -4350,7 +4348,9 @@ def prioritySortColumns(columns):
43504348 ['userid', 'name', 'password']
43514349 """
43524350
4353- _ = lambda x : x and "id" in x .lower ()
4351+ def _ (column ):
4352+ return column and "id" in column .lower ()
4353+
43544354 return sorted (sorted (columns , key = len ), lambda x , y : - 1 if _ (x ) and not _ (y ) else 1 if not _ (x ) and _ (y ) else 0 )
43554355
43564356def getRequestHeader (request , name ):
0 commit comments