mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-22 05:53:17 +03:00
Minor refactoring of direct()
This commit is contained in:
parent
91ea8e52b7
commit
c7cf8b2e80
|
@ -11,6 +11,7 @@ from extra.safe2bin.safe2bin import safecharencode
|
||||||
from lib.core.agent import agent
|
from lib.core.agent import agent
|
||||||
from lib.core.common import Backend
|
from lib.core.common import Backend
|
||||||
from lib.core.common import calculateDeltaSeconds
|
from lib.core.common import calculateDeltaSeconds
|
||||||
|
from lib.core.common import extractExpectedValue
|
||||||
from lib.core.common import getCurrentThreadData
|
from lib.core.common import getCurrentThreadData
|
||||||
from lib.core.common import getUnicode
|
from lib.core.common import getUnicode
|
||||||
from lib.core.common import hashDBRetrieve
|
from lib.core.common import hashDBRetrieve
|
||||||
|
@ -21,6 +22,7 @@ from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.dicts import SQL_STATEMENTS
|
from lib.core.dicts import SQL_STATEMENTS
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
|
from lib.core.enums import EXPECTED
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
from lib.utils.timeout import timeout
|
from lib.utils.timeout import timeout
|
||||||
|
|
||||||
|
@ -62,16 +64,9 @@ def direct(query, content=True):
|
||||||
elif content:
|
elif content:
|
||||||
if output and isListLike(output):
|
if output and isListLike(output):
|
||||||
if len(output[0]) == 1:
|
if len(output[0]) == 1:
|
||||||
if len(output) > 1:
|
output = [_[0] for _ in output]
|
||||||
output = map(lambda _: _[0], output)
|
|
||||||
else:
|
|
||||||
output = output[0][0]
|
|
||||||
|
|
||||||
retVal = getUnicode(output, noneToNull=True)
|
retVal = getUnicode(output, noneToNull=True)
|
||||||
return safecharencode(retVal) if kb.safeCharEncode else retVal
|
return safecharencode(retVal) if kb.safeCharEncode else retVal
|
||||||
else:
|
else:
|
||||||
for line in output:
|
return extractExpectedValue(output, EXPECTED.BOOL)
|
||||||
if line[0] in (1, -1):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user