mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 06:50:14 +00:00
Fixes #2471
This commit is contained in:
parent
c74756c3bc
commit
9b3d229294
16 changed files with 90 additions and 90 deletions
|
|
@ -161,7 +161,7 @@ def _showInjections():
|
|||
else:
|
||||
header = "sqlmap resumed the following injection point(s) from stored session"
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
conf.dumper.string("", {"url": conf.url, "query": conf.parameters.get(PLACE.GET), "data": conf.parameters.get(PLACE.POST)}, content_type=CONTENT_TYPE.TARGET)
|
||||
conf.dumper.string("", kb.injections, content_type=CONTENT_TYPE.TECHNIQUES)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ class Format(object):
|
|||
infoApi = {}
|
||||
|
||||
if info and "type" in info:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
infoApi["%s operating system" % target] = info
|
||||
else:
|
||||
infoStr += "%s operating system: %s" % (target, Format.humanize(info["type"]))
|
||||
|
|
@ -288,12 +288,12 @@ class Format(object):
|
|||
infoStr += " (%s)" % Format.humanize(info["codename"])
|
||||
|
||||
if "technology" in info:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
infoApi["web application technology"] = Format.humanize(info["technology"], ", ")
|
||||
else:
|
||||
infoStr += "\nweb application technology: %s" % Format.humanize(info["technology"], ", ")
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
return infoApi
|
||||
else:
|
||||
return infoStr.lstrip()
|
||||
|
|
@ -896,7 +896,7 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
|
|||
message = data
|
||||
|
||||
try:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.get("api"):
|
||||
sys.stdout.write(message, status, content_type)
|
||||
else:
|
||||
sys.stdout.write(setColor(message, bold))
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Dump(object):
|
|||
self._lock = threading.Lock()
|
||||
|
||||
def _write(self, data, newline=True, console=True, content_type=None):
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE)
|
||||
return
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ class Dump(object):
|
|||
def string(self, header, data, content_type=None, sort=True):
|
||||
kb.stickyLevel = None
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(data, content_type=content_type)
|
||||
return
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ class Dump(object):
|
|||
except:
|
||||
pass
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(elements, content_type=content_type)
|
||||
return
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ class Dump(object):
|
|||
users = userSettings.keys()
|
||||
users.sort(key=lambda x: x.lower() if isinstance(x, basestring) else x)
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(userSettings, content_type=content_type)
|
||||
return
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ class Dump(object):
|
|||
|
||||
def dbTables(self, dbTables):
|
||||
if isinstance(dbTables, dict) and len(dbTables) > 0:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(dbTables, content_type=CONTENT_TYPE.TABLES)
|
||||
return
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ class Dump(object):
|
|||
|
||||
def dbTableColumns(self, tableColumns, content_type=None):
|
||||
if isinstance(tableColumns, dict) and len(tableColumns) > 0:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(tableColumns, content_type=content_type)
|
||||
return
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ class Dump(object):
|
|||
|
||||
def dbTablesCount(self, dbTables):
|
||||
if isinstance(dbTables, dict) and len(dbTables) > 0:
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(dbTables, content_type=CONTENT_TYPE.COUNT)
|
||||
return
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ class Dump(object):
|
|||
db = "All"
|
||||
table = tableValues["__infos__"]["table"]
|
||||
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(tableValues, content_type=CONTENT_TYPE.DUMP_TABLE)
|
||||
return
|
||||
|
||||
|
|
@ -666,7 +666,7 @@ class Dump(object):
|
|||
logger.warn(msg)
|
||||
|
||||
def dbColumns(self, dbColumnsDict, colConsider, dbs):
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
self._write(dbColumnsDict, content_type=CONTENT_TYPE.COLUMNS)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -2192,7 +2192,7 @@ def _mergeOptions(inputOptions, overrideOptions):
|
|||
if key not in conf or value not in (None, False) or overrideOptions:
|
||||
conf[key] = value
|
||||
|
||||
if not hasattr(conf, "api"):
|
||||
if not conf.api:
|
||||
for key, value in conf.items():
|
||||
if value is not None:
|
||||
kb.explicitSettings.add(key)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
|||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.1.4.13"
|
||||
VERSION = "1.1.4.14"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
# Set kb.partRun in case "common prediction" feature (a.k.a. "good samaritan") is used or the engine is called from the API
|
||||
if conf.predictOutput:
|
||||
kb.partRun = getPartRun()
|
||||
elif hasattr(conf, "api"):
|
||||
elif conf.api:
|
||||
kb.partRun = getPartRun(alias=False)
|
||||
else:
|
||||
kb.partRun = None
|
||||
|
|
@ -168,7 +168,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
warnMsg += "usage of option '--threads' for faster data retrieval"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not showEta and not conf.api:
|
||||
if isinstance(length, int) and conf.threads > 1:
|
||||
dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, conf.progressWidth)))
|
||||
dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X"))
|
||||
|
|
@ -492,7 +492,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
if (endCharIndex - startCharIndex == conf.progressWidth) and (endCharIndex < length - 1):
|
||||
output = output[:-2] + '..'
|
||||
|
||||
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not showEta and not conf.api:
|
||||
_ = count - firstChar
|
||||
output += '_' * (min(length, conf.progressWidth) - len(output))
|
||||
status = ' %d/%d (%d%%)' % (_, length, round(100.0 * _ / length))
|
||||
|
|
@ -522,7 +522,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
finalValue = "".join(value)
|
||||
infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue))
|
||||
|
||||
if conf.verbose in (1, 2) and not showEta and infoMsg and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not showEta and infoMsg and not conf.api:
|
||||
dataToStdout(infoMsg)
|
||||
|
||||
# No multi-threading (--threads = 1)
|
||||
|
|
@ -558,7 +558,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
if result:
|
||||
if showEta:
|
||||
progress.progress(time.time() - charStart, len(commonValue))
|
||||
elif conf.verbose in (1, 2) or hasattr(conf, "api"):
|
||||
elif conf.verbose in (1, 2) or conf.api:
|
||||
dataToStdout(filterControlChars(commonValue[index - 1:]))
|
||||
|
||||
finalValue = commonValue
|
||||
|
|
@ -608,7 +608,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
|
||||
if showEta:
|
||||
progress.progress(time.time() - charStart, index)
|
||||
elif conf.verbose in (1, 2) or hasattr(conf, "api"):
|
||||
elif conf.verbose in (1, 2) or conf.api:
|
||||
dataToStdout(filterControlChars(val))
|
||||
|
||||
# some DBMSes (e.g. Firebird, DB2, etc.) have issues with trailing spaces
|
||||
|
|
@ -635,11 +635,11 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
elif partialValue:
|
||||
hashDBWrite(expression, "%s%s" % (PARTIAL_VALUE_MARKER if not conf.hexConvert else PARTIAL_HEX_VALUE_MARKER, partialValue))
|
||||
|
||||
if conf.hexConvert and not abortedFlag and not hasattr(conf, "api"):
|
||||
if conf.hexConvert and not abortedFlag and not conf.api:
|
||||
infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * retrievedLength)
|
||||
dataToStdout(infoMsg)
|
||||
else:
|
||||
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not showEta and not conf.api:
|
||||
dataToStdout("\n")
|
||||
|
||||
if (conf.verbose in (1, 2) and showEta) or conf.verbose >= 3:
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ def tableExists(tableFile, regex=None):
|
|||
threadData.shared.value.append(table)
|
||||
threadData.shared.unique.add(table.lower())
|
||||
|
||||
if conf.verbose in (1, 2) and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not conf.api:
|
||||
clearConsoleLine(True)
|
||||
infoMsg = "[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(table))
|
||||
dataToStdout(infoMsg, True)
|
||||
|
|
@ -222,7 +222,7 @@ def columnExists(columnFile, regex=None):
|
|||
if result:
|
||||
threadData.shared.value.append(column)
|
||||
|
||||
if conf.verbose in (1, 2) and not hasattr(conf, "api"):
|
||||
if conf.verbose in (1, 2) and not conf.api:
|
||||
clearConsoleLine(True)
|
||||
infoMsg = "[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(column))
|
||||
dataToStdout(infoMsg, True)
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ def errorUse(expression, dump=False):
|
|||
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(expression)
|
||||
|
||||
# Set kb.partRun in case the engine is called from the API
|
||||
kb.partRun = getPartRun(alias=False) if hasattr(conf, "api") else None
|
||||
kb.partRun = getPartRun(alias=False) if conf.api else None
|
||||
|
||||
# We have to check if the SQL query might return multiple entries
|
||||
# and in such case forge the SQL limiting the query output one
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ def unionUse(expression, unpack=True, dump=False):
|
|||
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(origExpr)
|
||||
|
||||
# Set kb.partRun in case the engine is called from the API
|
||||
kb.partRun = getPartRun(alias=False) if hasattr(conf, "api") else None
|
||||
kb.partRun = getPartRun(alias=False) if conf.api else None
|
||||
|
||||
if Backend.isDbms(DBMS.MSSQL) and kb.dumpColumns:
|
||||
kb.rowXmlMode = True
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ class LogRecorder(logging.StreamHandler):
|
|||
|
||||
|
||||
def setRestAPILog():
|
||||
if hasattr(conf, "api"):
|
||||
if conf.api:
|
||||
try:
|
||||
conf.databaseCursor = Database(conf.database)
|
||||
conf.databaseCursor.connect("client")
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc
|
|||
|
||||
status = 'current status: %s... %s' % (word.ljust(5)[:5], ROTATING_CHARS[rotator])
|
||||
|
||||
if not hasattr(conf, "api"):
|
||||
if not conf.api:
|
||||
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
|
@ -657,7 +657,7 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
|
|||
if user and not user.startswith(DUMMY_USER_PREFIX):
|
||||
status += ' (user: %s)' % user
|
||||
|
||||
if not hasattr(conf, "api"):
|
||||
if not conf.api:
|
||||
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue