同步操作将从 yeqingchen1/sqlmap 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python"""Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)See the file 'LICENSE' for copying permission"""import ntpathimport refrom lib.core.common import Backendfrom lib.core.common import hashDBWritefrom lib.core.common import isStackingAvailablefrom lib.core.common import normalizePathfrom lib.core.common import ntToPosixSlashesfrom lib.core.common import posixToNtSlashesfrom lib.core.common import readInputfrom lib.core.common import singleTimeDebugMessagefrom lib.core.common import unArrayizeValuefrom lib.core.data import conffrom lib.core.data import kbfrom lib.core.data import loggerfrom lib.core.data import queriesfrom lib.core.enums import DBMSfrom lib.core.enums import HASHDB_KEYSfrom lib.core.enums import OSfrom lib.core.exception import SqlmapNoneDataExceptionfrom lib.core.exception import SqlmapUnsupportedFeatureExceptionfrom lib.request import injectclass Miscellaneous(object):"""This class defines miscellaneous functionalities for plugins."""def __init__(self):passdef getRemoteTempPath(self):if not conf.tmpPath and Backend.isDbms(DBMS.MSSQL):debugMsg = "identifying Microsoft SQL Server error log directory "debugMsg += "that sqlmap will use to store temporary files with "debugMsg += "commands' output"logger.debug(debugMsg)_ = unArrayizeValue(inject.getValue("SELECT SERVERPROPERTY('ErrorLogFileName')", safeCharEncode=False))if _:conf.tmpPath = ntpath.dirname(_)if not conf.tmpPath:if Backend.isOs(OS.WINDOWS):if conf.direct:conf.tmpPath = "%TEMP%"else:self.checkDbmsOs(detailed=True)if Backend.getOsVersion() in ("2000", "NT"):conf.tmpPath = "C:/WINNT/Temp"elif Backend.isOs("XP"):conf.tmpPath = "C:/Documents and Settings/All Users/Application Data/Temp"else:conf.tmpPath = "C:/Windows/Temp"else:conf.tmpPath = "/tmp"if re.search(r"\A[\w]:[\/\\]+", conf.tmpPath, re.I):Backend.setOs(OS.WINDOWS)conf.tmpPath = normalizePath(conf.tmpPath)conf.tmpPath = ntToPosixSlashes(conf.tmpPath)singleTimeDebugMessage("going to use '%s' as temporary files directory" % conf.tmpPath)hashDBWrite(HASHDB_KEYS.CONF_TMP_PATH, conf.tmpPath)return conf.tmpPathdef getVersionFromBanner(self):if "dbmsVersion" in kb.bannerFp:returninfoMsg = "detecting back-end DBMS version from its banner"logger.info(infoMsg)if Backend.isDbms(DBMS.MYSQL):first, last = 1, 6elif Backend.isDbms(DBMS.PGSQL):first, last = 12, 6elif Backend.isDbms(DBMS.MSSQL):first, last = 29, 9else:raise SqlmapUnsupportedFeatureException("unsupported DBMS")query = queries[Backend.getIdentifiedDbms()].substring.query % (queries[Backend.getIdentifiedDbms()].banner.query, first, last)if conf.direct:query = "SELECT %s" % querykb.bannerFp["dbmsVersion"] = unArrayizeValue(inject.getValue(query))kb.bannerFp["dbmsVersion"] = (kb.bannerFp["dbmsVersion"] or "").replace(',', "").replace('-', "").replace(' ', "")def delRemoteFile(self, filename):if not filename:returnself.checkDbmsOs()if Backend.isOs(OS.WINDOWS):filename = posixToNtSlashes(filename)cmd = "del /F /Q %s" % filenameelse:cmd = "rm -f %s" % filenameself.execCmd(cmd, silent=True)def createSupportTbl(self, tblName, tblField, tblType):inject.goStacked("DROP TABLE %s" % tblName, silent=True)if Backend.isDbms(DBMS.MSSQL) and tblName == self.cmdTblName:inject.goStacked("CREATE TABLE %s(id INT PRIMARY KEY IDENTITY, %s %s)" % (tblName, tblField, tblType))else:inject.goStacked("CREATE TABLE %s(%s %s)" % (tblName, tblField, tblType))def cleanup(self, onlyFileTbl=False, udfDict=None, web=False):"""Cleanup file system and database from sqlmap create files, tablesand functions"""if web and self.webBackdoorFilePath:logger.info("cleaning up the web files uploaded")self.delRemoteFile(self.webStagerFilePath)self.delRemoteFile(self.webBackdoorFilePath)if not isStackingAvailable() and not conf.direct:returnif any((conf.osCmd, conf.osShell)) and Backend.isDbms(DBMS.PGSQL) and kb.copyExecTest:returnif Backend.isOs(OS.WINDOWS):libtype = "dynamic-link library"elif Backend.isOs(OS.LINUX):libtype = "shared object"else:libtype = "shared library"if onlyFileTbl:logger.debug("cleaning up the database management system")else:logger.info("cleaning up the database management system")logger.debug("removing support tables")inject.goStacked("DROP TABLE %s" % self.fileTblName, silent=True)inject.goStacked("DROP TABLE %shex" % self.fileTblName, silent=True)if not onlyFileTbl:inject.goStacked("DROP TABLE %s" % self.cmdTblName, silent=True)if Backend.isDbms(DBMS.MSSQL):udfDict = {"master..new_xp_cmdshell": {}}if udfDict is None:udfDict = self.sysUdfsfor udf, inpRet in udfDict.items():message = "do you want to remove UDF '%s'? [Y/n] " % udfif readInput(message, default='Y', boolean=True):dropStr = "DROP FUNCTION %s" % udfif Backend.isDbms(DBMS.PGSQL):inp = ", ".join(i for i in inpRet["input"])dropStr += "(%s)" % inplogger.debug("removing UDF '%s'" % udf)inject.goStacked(dropStr, silent=True)logger.info("database management system cleanup finished")warnMsg = "remember that UDF %s files " % libtypeif conf.osPwn:warnMsg += "and Metasploit related files in the temporary "warnMsg += "folder "warnMsg += "saved on the file system can only be deleted "warnMsg += "manually"logger.warn(warnMsg)def likeOrExact(self, what):message = "do you want sqlmap to consider provided %s(s):\n" % whatmessage += "[1] as LIKE %s names (default)\n" % whatmessage += "[2] as exact %s names" % whatchoice = readInput(message, default='1')if not choice or choice == '1':choice = '1'condParam = " LIKE '%%%s%%'"elif choice == '2':condParam = "='%s'"else:errMsg = "invalid value"raise SqlmapNoneDataException(errMsg)return choice, condParam
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。