mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
minor refactoring
This commit is contained in:
parent
cc28f6db6b
commit
96299d3d5d
|
@ -3207,3 +3207,6 @@ def resetCookieJar(cookieJar):
|
|||
errMsg += "cookies file ('%s')" % msg
|
||||
raise sqlmapGenericException, errMsg
|
||||
|
||||
def prioritySortColumns(columns):
|
||||
_ = lambda x: x and "id" in x.lower()
|
||||
return sorted(sorted(columns, key=len), lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0)
|
||||
|
|
|
@ -19,6 +19,7 @@ from lib.core.common import dataToStdout
|
|||
from lib.core.common import getUnicode
|
||||
from lib.core.common import normalizeUnicode
|
||||
from lib.core.common import openFile
|
||||
from lib.core.common import prioritySortColumns
|
||||
from lib.core.common import restoreDumpMarkedChars
|
||||
from lib.core.common import safeCSValue
|
||||
from lib.core.common import unsafeSQLIdentificatorNaming
|
||||
|
@ -357,9 +358,7 @@ class Dump:
|
|||
field = 1
|
||||
fields = len(tableValues) - 1
|
||||
|
||||
columns = tableValues.keys()
|
||||
_ = lambda x: x and "id" in x.lower()
|
||||
columns = sorted(sorted(columns, key=len), lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0)
|
||||
columns = prioritySortColumns(tableValues.keys())
|
||||
|
||||
for column in columns:
|
||||
if column != "__infos__":
|
||||
|
|
|
@ -26,6 +26,7 @@ from lib.core.common import isTechniqueAvailable
|
|||
from lib.core.common import parsePasswordHash
|
||||
from lib.core.common import parseSqliteTableSchema
|
||||
from lib.core.common import popValue
|
||||
from lib.core.common import prioritySortColumns
|
||||
from lib.core.common import pushValue
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.common import readInput
|
||||
|
@ -1608,9 +1609,7 @@ class Enumeration:
|
|||
else:
|
||||
query = rootQuery.inband.query % (colString, conf.db, tbl)
|
||||
elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
_ = lambda x: x and "id" in x.lower()
|
||||
orderby = sorted(sorted(colList, key=len), lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0)[0]
|
||||
query = rootQuery.inband.query % (colString, conf.db, tbl, orderby)
|
||||
query = rootQuery.inband.query % (colString, conf.db, tbl, prioritySortColumns(colList)[0])
|
||||
else:
|
||||
query = rootQuery.inband.query % (colString, conf.db, tbl)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user