mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-12 02:22:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7d448c56c | ||
|
|
694b5bb5c0 | ||
|
|
eb498e6c03 | ||
|
|
ca8b589d43 | ||
|
|
18706f7fad | ||
|
|
80f3b9a711 | ||
|
|
6b3f01bfeb | ||
|
|
42042fb5de | ||
|
|
2abc7fc588 | ||
|
|
1ecc326714 | ||
|
|
d2d829abf5 | ||
|
|
43d9ac2bd4 | ||
|
|
d8196cf7e6 | ||
|
|
42b0edca6d | ||
|
|
331ccc5549 | ||
|
|
d5627fdf1b | ||
|
|
7b3a17bfe7 | ||
|
|
4a8f01c9dc | ||
|
|
13bf3e649a | ||
|
|
9a63fb1055 | ||
|
|
3544793961 | ||
|
|
7a8add0412 | ||
|
|
1d382bcb4d | ||
|
|
ec6ad3ce68 | ||
|
|
73d8952f2a | ||
|
|
2a810fb796 | ||
|
|
8f7a7bed20 | ||
|
|
36b0ece2ad | ||
|
|
7d8fbab035 | ||
|
|
5580db0045 | ||
|
|
3fde205cd4 | ||
|
|
1822cc05f6 | ||
|
|
509bb41b06 | ||
|
|
8ca3287df4 | ||
|
|
60767de2eb | ||
|
|
29e683fb5b | ||
|
|
148d1c9ff9 | ||
|
|
a8cb14ed4a | ||
|
|
c634f0b0d6 | ||
|
|
8605c49911 | ||
|
|
44f6951dfe | ||
|
|
b5b32c951c | ||
|
|
a9c3b59cff | ||
|
|
4528cb014d | ||
|
|
2c5f976993 | ||
|
|
4f2669a45a | ||
|
|
641838ed73 | ||
|
|
2a681b7bd6 | ||
|
|
7f3f1dcdee | ||
|
|
4147f44e63 |
@@ -64,5 +64,6 @@ Translations
|
||||
* [Japanese](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-ja-JP.md)
|
||||
* [Polish](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-pl-PL.md)
|
||||
* [Portuguese](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-pt-BR.md)
|
||||
* [Russian](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-ru-RUS.md)
|
||||
* [Spanish](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-es-MX.md)
|
||||
* [Turkish](https://github.com/sqlmapproject/sqlmap/blob/master/doc/translations/README-tr-TR.md)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# sqlmap
|
||||
|
||||
[](https://api.travis-ci.org/sqlmapproject/sqlmap) [](https://www.python.org/) [](https://raw.githubusercontent.com/sqlmapproject/sqlmap/master/LICENSE) [](https://twitter.com/sqlmap)
|
||||
|
||||
sqlmap - это инструмент для тестирования уязвимостей с открытым исходным кодом, который автоматизирует процесс обнаружения и использования ошибок SQL-инъекций и захвата серверов баз данных. Он оснащен мощным механизмом обнаружения, множеством приятных функций для профессионального тестера уязвимостей и широким спектром скриптов, которые упрощают работу с базами данных, от сбора данных из базы данных, до доступа к базовой файловой системе и выполнения команд в операционной системе через out-of-band соединение.
|
||||
|
||||
Скриншоты
|
||||
----
|
||||
|
||||

|
||||
|
||||
Вы можете посетить [набор скриншотов](https://github.com/sqlmapproject/sqlmap/wiki/Screenshots) демонстрируемые некоторые функции в wiki.
|
||||
|
||||
Установка
|
||||
----
|
||||
|
||||
Вы можете скачать последнюю версию tarball, нажав [сюда](https://github.com/sqlmapproject/sqlmap/tarball/master) или последний zipball, нажав [сюда](https://github.com/sqlmapproject/sqlmap/zipball/master).
|
||||
|
||||
Предпочтительно вы можете загрузить sqlmap, клонируя [Git](https://github.com/sqlmapproject/sqlmap) репозиторий:
|
||||
|
||||
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
|
||||
|
||||
sqlmap работает из коробки с [Python](http://www.python.org/download/) версии **2.6.x** и **2.7.x** на любой платформе.
|
||||
|
||||
Использование
|
||||
----
|
||||
|
||||
Чтобы получить список основных опций и вариантов выбора, используйте:
|
||||
|
||||
python sqlmap.py -h
|
||||
|
||||
Чтобы получить список всех опций и вариантов выбора, используйте:
|
||||
|
||||
python sqlmap.py -hh
|
||||
|
||||
Вы можете найти пробный запуск [тут](https://asciinema.org/a/46601).
|
||||
Чтобы получить обзор возможностей sqlmap, список поддерживаемых функций и описание всех параметров и переключателей, а также примеры, вам рекомендуется ознакомится с [пользовательским мануалом](https://github.com/sqlmapproject/sqlmap/wiki/Usage).
|
||||
|
||||
Ссылки
|
||||
----
|
||||
|
||||
* Основной сайт: http://sqlmap.org
|
||||
* Скачивание: [.tar.gz](https://github.com/sqlmapproject/sqlmap/tarball/master) или [.zip](https://github.com/sqlmapproject/sqlmap/zipball/master)
|
||||
* Канал новостей RSS: https://github.com/sqlmapproject/sqlmap/commits/master.atom
|
||||
* Отслеживание проблем: https://github.com/sqlmapproject/sqlmap/issues
|
||||
* Пользовательский мануал: https://github.com/sqlmapproject/sqlmap/wiki
|
||||
* Часто задаваемые вопросы (FAQ): https://github.com/sqlmapproject/sqlmap/wiki/FAQ
|
||||
* Twitter: [@sqlmap](https://twitter.com/sqlmap)
|
||||
* Демки: [http://www.youtube.com/user/inquisb/videos](http://www.youtube.com/user/inquisb/videos)
|
||||
* Скриншоты: https://github.com/sqlmapproject/sqlmap/wiki/Screenshots
|
||||
@@ -125,8 +125,12 @@ def main(src, dst):
|
||||
# Have the IP packet contain the ICMP packet (along with its payload)
|
||||
ip.contains(icmp)
|
||||
|
||||
# Send it to the target host
|
||||
sock.sendto(ip.get_packet(), (dst, 0))
|
||||
try:
|
||||
# Send it to the target host
|
||||
sock.sendto(ip.get_packet(), (dst, 0))
|
||||
except socket.error, ex:
|
||||
sys.stderr.write("'%s'\n" % ex)
|
||||
sys.stderr.flush()
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# Runs pylint on all python scripts found in a directory tree
|
||||
# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
def check(filepath):
|
||||
if filepath.endswith(".py"):
|
||||
content = open(filepath, "rb").read()
|
||||
#if re.search(r"\r?\n\r?\n", content):
|
||||
if "\n\n\n" in content:
|
||||
index = content.find("\n\n\n")
|
||||
print filepath, repr(content[index-30:index+30])
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
BASE_DIRECTORY = sys.argv[1]
|
||||
except IndexError:
|
||||
print "no directory specified, defaulting to current working directory"
|
||||
BASE_DIRECTORY = os.getcwd()
|
||||
|
||||
print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY
|
||||
for root, dirs, files in os.walk(BASE_DIRECTORY):
|
||||
if any(_ in root for _ in ("extra", "thirdparty")):
|
||||
continue
|
||||
for name in files:
|
||||
filepath = os.path.join(root, name)
|
||||
check(filepath)
|
||||
+29
-18
@@ -47,6 +47,7 @@ from lib.core.common import unArrayizeValue
|
||||
from lib.core.common import urlencode
|
||||
from lib.core.common import wasLastResponseDBMSError
|
||||
from lib.core.common import wasLastResponseHTTPError
|
||||
from lib.core.convert import unicodeencode
|
||||
from lib.core.defaults import defaults
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
@@ -54,6 +55,7 @@ from lib.core.data import logger
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.datatype import InjectionDict
|
||||
from lib.core.decorators import cachedmethod
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.dicts import FROM_DUMMY_TABLE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import HASHDB_KEYS
|
||||
@@ -452,11 +454,13 @@ def checkSqlInjection(place, parameter, value):
|
||||
boundPayload = agent.prefixQuery(fstPayload, prefix, where, clause)
|
||||
boundPayload = agent.suffixQuery(boundPayload, comment, suffix, where)
|
||||
reqPayload = agent.payload(place, parameter, newValue=boundPayload, where=where)
|
||||
|
||||
if reqPayload:
|
||||
if reqPayload in seenPayload:
|
||||
stripPayload = re.sub(r"(\A|\b|_)([A-Za-z]{4}((?<!LIKE))|\d+)(_|\b|\Z)", r"\g<1>.\g<4>", reqPayload)
|
||||
if stripPayload in seenPayload:
|
||||
continue
|
||||
else:
|
||||
seenPayload.add(reqPayload)
|
||||
seenPayload.add(stripPayload)
|
||||
else:
|
||||
reqPayload = None
|
||||
|
||||
@@ -779,7 +783,7 @@ def checkSqlInjection(place, parameter, value):
|
||||
|
||||
if conf.multipleTargets:
|
||||
msg = "how do you want to proceed? [ne(X)t target/(s)kip current test/(e)nd detection phase/(n)ext parameter/(c)hange verbosity/(q)uit]"
|
||||
choice = readInput(msg, default='T', checkBatch=False).upper()
|
||||
choice = readInput(msg, default='X', checkBatch=False).upper()
|
||||
else:
|
||||
msg = "how do you want to proceed? [(S)kip current test/(e)nd detection phase/(n)ext parameter/(c)hange verbosity/(q)uit]"
|
||||
choice = readInput(msg, default='S', checkBatch=False).upper()
|
||||
@@ -832,6 +836,7 @@ def checkSqlInjection(place, parameter, value):
|
||||
|
||||
return injection
|
||||
|
||||
@stackedmethod
|
||||
def heuristicCheckDbms(injection):
|
||||
"""
|
||||
This functions is called when boolean-based blind is identified with a
|
||||
@@ -868,6 +873,7 @@ def heuristicCheckDbms(injection):
|
||||
|
||||
return retVal
|
||||
|
||||
@stackedmethod
|
||||
def checkFalsePositives(injection):
|
||||
"""
|
||||
Checks for false positives (only in single special cases)
|
||||
@@ -929,6 +935,7 @@ def checkFalsePositives(injection):
|
||||
|
||||
return retVal
|
||||
|
||||
@stackedmethod
|
||||
def checkSuhosinPatch(injection):
|
||||
"""
|
||||
Checks for existence of Suhosin-patch (and alike) protection mechanism(s)
|
||||
@@ -952,6 +959,7 @@ def checkSuhosinPatch(injection):
|
||||
|
||||
kb.injection = popValue()
|
||||
|
||||
@stackedmethod
|
||||
def checkFilteredChars(injection):
|
||||
debugMsg = "checking for filtered characters"
|
||||
logger.debug(debugMsg)
|
||||
@@ -1314,6 +1322,7 @@ def checkRegexp():
|
||||
|
||||
return True
|
||||
|
||||
@stackedmethod
|
||||
def checkWaf():
|
||||
"""
|
||||
Reference: http://seclists.org/nmap-dev/2011/q2/att-1005/http-waf-detect.nse
|
||||
@@ -1352,7 +1361,7 @@ def checkWaf():
|
||||
conf.timeout = IDS_WAF_CHECK_TIMEOUT
|
||||
|
||||
try:
|
||||
retVal = Request.queryPage(place=place, value=value, getRatioValue=True, noteResponseTime=False, silent=True)[1] < IDS_WAF_CHECK_RATIO
|
||||
retVal = Request.queryPage(place=place, value=value, getRatioValue=True, noteResponseTime=False, silent=True, disableTampering=True)[1] < IDS_WAF_CHECK_RATIO
|
||||
except SqlmapConnectionException:
|
||||
retVal = True
|
||||
finally:
|
||||
@@ -1379,6 +1388,7 @@ def checkWaf():
|
||||
|
||||
return retVal
|
||||
|
||||
@stackedmethod
|
||||
def identifyWaf():
|
||||
if not conf.identifyWaf:
|
||||
return None
|
||||
@@ -1463,6 +1473,7 @@ def identifyWaf():
|
||||
|
||||
return retVal
|
||||
|
||||
@stackedmethod
|
||||
def checkNullConnection():
|
||||
"""
|
||||
Reference: http://www.wisec.it/sectou.php?id=472f952d79293
|
||||
@@ -1511,18 +1522,19 @@ def checkNullConnection():
|
||||
return kb.nullConnection is not None
|
||||
|
||||
def checkConnection(suppressOutput=False):
|
||||
if not any((conf.proxy, conf.tor, conf.dummy, conf.offline)):
|
||||
try:
|
||||
debugMsg = "resolving hostname '%s'" % conf.hostname
|
||||
logger.debug(debugMsg)
|
||||
socket.getaddrinfo(conf.hostname, None)
|
||||
except socket.gaierror:
|
||||
errMsg = "host '%s' does not exist" % conf.hostname
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
except socket.error, ex:
|
||||
errMsg = "problem occurred while "
|
||||
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
if not re.search(r"\A\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z", conf.hostname):
|
||||
if not any((conf.proxy, conf.tor, conf.dummy, conf.offline)):
|
||||
try:
|
||||
debugMsg = "resolving hostname '%s'" % conf.hostname
|
||||
logger.debug(debugMsg)
|
||||
socket.getaddrinfo(conf.hostname, None)
|
||||
except socket.gaierror:
|
||||
errMsg = "host '%s' does not exist" % conf.hostname
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
except socket.error, ex:
|
||||
errMsg = "problem occurred while "
|
||||
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
|
||||
if not suppressOutput and not conf.dummy and not conf.offline:
|
||||
infoMsg = "testing connection to the target URL"
|
||||
@@ -1550,11 +1562,10 @@ def checkConnection(suppressOutput=False):
|
||||
else:
|
||||
kb.errorIsNone = True
|
||||
|
||||
|
||||
threadData = getCurrentThreadData()
|
||||
|
||||
if kb.redirectChoice == REDIRECTION.YES and threadData.lastRedirectURL and threadData.lastRedirectURL[0] == threadData.lastRequestUID:
|
||||
if conf.hostname in (threadData.lastRedirectURL[1] or "") and threadData.lastRedirectURL[1].startswith("https://"):
|
||||
if (threadData.lastRedirectURL[1] or "").startswith("https://") and unicodeencode(conf.hostname) in threadData.lastRedirectURL[1]:
|
||||
conf.url = re.sub(r"https?://", "https://", conf.url)
|
||||
match = re.search(r":(\d+)", threadData.lastRedirectURL[1])
|
||||
port = match.group(1) if match else 443
|
||||
|
||||
@@ -43,6 +43,7 @@ from lib.core.common import urldecode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.enums import CONTENT_TYPE
|
||||
from lib.core.enums import HASHDB_KEYS
|
||||
from lib.core.enums import HEURISTIC_TEST
|
||||
@@ -253,6 +254,7 @@ def _saveToResultsFile():
|
||||
|
||||
conf.resultsFP.flush()
|
||||
|
||||
@stackedmethod
|
||||
def start():
|
||||
"""
|
||||
This function calls a function that performs checks on both URL
|
||||
|
||||
+47
-26
@@ -1015,8 +1015,11 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||
elif answer is None and retVal:
|
||||
retVal = "%s,%s" % (retVal, getUnicode(item, UNICODE_ENCODING))
|
||||
|
||||
if message and getattr(LOGGER_HANDLER, "is_tty", False):
|
||||
message = "\r%s" % message
|
||||
|
||||
if retVal:
|
||||
dataToStdout("\r%s%s\n" % (message, retVal), forceOutput=not kb.wizardMode, bold=True)
|
||||
dataToStdout("%s%s\n" % (message, retVal), forceOutput=not kb.wizardMode, bold=True)
|
||||
|
||||
debugMsg = "used the given answer"
|
||||
logger.debug(debugMsg)
|
||||
@@ -1030,7 +1033,7 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||
else:
|
||||
options = unicode()
|
||||
|
||||
dataToStdout("\r%s%s\n" % (message, options), forceOutput=not kb.wizardMode, bold=True)
|
||||
dataToStdout("%s%s\n" % (message, options), forceOutput=not kb.wizardMode, bold=True)
|
||||
|
||||
debugMsg = "used the default behavior, running in batch mode"
|
||||
logger.debug(debugMsg)
|
||||
@@ -1043,7 +1046,7 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||
if conf.get("beep"):
|
||||
beep()
|
||||
|
||||
dataToStdout("\r%s" % message, forceOutput=not kb.wizardMode, bold=True)
|
||||
dataToStdout("%s" % message, forceOutput=not kb.wizardMode, bold=True)
|
||||
kb.prependFlag = False
|
||||
|
||||
retVal = raw_input().strip() or default
|
||||
@@ -1384,6 +1387,10 @@ def parseTargetDirect():
|
||||
__import__("psycopg2")
|
||||
elif dbmsName == DBMS.ORACLE:
|
||||
__import__("cx_Oracle")
|
||||
|
||||
# Reference: http://itsiti.com/ora-28009-connection-sys-sysdba-sysoper
|
||||
if (conf.dbmsUser or "").upper() == "SYS":
|
||||
conf.direct = "%s?mode=SYSDBA" % conf.direct
|
||||
elif dbmsName == DBMS.SQLITE:
|
||||
__import__("sqlite3")
|
||||
elif dbmsName == DBMS.ACCESS:
|
||||
@@ -1493,6 +1500,23 @@ def parseTargetUrl():
|
||||
if conf.url != originalUrl:
|
||||
kb.originalUrls[conf.url] = originalUrl
|
||||
|
||||
def escapeJsonValue(value):
|
||||
"""
|
||||
Escapes JSON value (used in payloads)
|
||||
|
||||
# Reference: https://stackoverflow.com/a/16652683
|
||||
"""
|
||||
|
||||
retVal = ""
|
||||
|
||||
for char in value:
|
||||
if char < ' ' or char == '"':
|
||||
retVal += json.dumps(char)[1:-1]
|
||||
else:
|
||||
retVal += char
|
||||
|
||||
return retVal
|
||||
|
||||
def expandAsteriskForColumns(expression):
|
||||
"""
|
||||
If the user provided an asterisk rather than the column(s)
|
||||
@@ -2136,7 +2160,7 @@ def initCommonOutputs():
|
||||
if line not in kb.commonOutputs[key]:
|
||||
kb.commonOutputs[key].add(line)
|
||||
|
||||
def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, unique=False):
|
||||
def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, unique=False):
|
||||
"""
|
||||
Returns newline delimited items contained inside file
|
||||
"""
|
||||
@@ -2149,20 +2173,14 @@ def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, un
|
||||
checkFile(filename)
|
||||
|
||||
try:
|
||||
with openFile(filename, 'r', errors="ignore") if unicode_ else open(filename, 'r') as f:
|
||||
for line in (f.readlines() if unicode_ else f.xreadlines()): # xreadlines doesn't return unicode strings when codec.open() is used
|
||||
with openFile(filename, 'r', errors="ignore") if unicoded else open(filename, 'r') as f:
|
||||
for line in (f.readlines() if unicoded else f.xreadlines()): # xreadlines doesn't return unicode strings when codec.open() is used
|
||||
if commentPrefix:
|
||||
if line.find(commentPrefix) != -1:
|
||||
line = line[:line.find(commentPrefix)]
|
||||
|
||||
line = line.strip()
|
||||
|
||||
if not unicode_:
|
||||
try:
|
||||
line = str.encode(line)
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
|
||||
if line:
|
||||
if lowercase:
|
||||
line = line.lower()
|
||||
@@ -3280,14 +3298,17 @@ def checkIntegrity():
|
||||
logger.debug("running code integrity check")
|
||||
|
||||
retVal = True
|
||||
for checksum, _ in (re.split(r'\s+', _) for _ in getFileItems(paths.CHECKSUM_MD5)):
|
||||
path = os.path.normpath(os.path.join(paths.SQLMAP_ROOT_PATH, _))
|
||||
if not os.path.isfile(path):
|
||||
logger.error("missing file detected '%s'" % path)
|
||||
retVal = False
|
||||
elif md5File(path) != checksum:
|
||||
logger.error("wrong checksum of file '%s' detected" % path)
|
||||
retVal = False
|
||||
|
||||
if os.path.isfile(paths.CHECKSUM_MD5):
|
||||
for checksum, _ in (re.split(r'\s+', _) for _ in getFileItems(paths.CHECKSUM_MD5)):
|
||||
path = os.path.normpath(os.path.join(paths.SQLMAP_ROOT_PATH, _))
|
||||
if not os.path.isfile(path):
|
||||
logger.error("missing file detected '%s'" % path)
|
||||
retVal = False
|
||||
elif md5File(path) != checksum:
|
||||
logger.error("wrong checksum of file '%s' detected" % path)
|
||||
retVal = False
|
||||
|
||||
return retVal
|
||||
|
||||
def unhandledExceptionMessage():
|
||||
@@ -3346,7 +3367,7 @@ def createGithubIssue(errMsg, excMsg):
|
||||
msg += "with the unhandled exception information at "
|
||||
msg += "the official Github repository? [y/N] "
|
||||
try:
|
||||
choice = readInput(msg, default='N', boolean=True)
|
||||
choice = readInput(msg, default='N', checkBatch=False, boolean=True)
|
||||
except:
|
||||
choice = None
|
||||
|
||||
@@ -3413,10 +3434,10 @@ def maskSensitiveData(msg):
|
||||
value = extractRegexResult(regex, retVal)
|
||||
retVal = retVal.replace(value, '*' * len(value))
|
||||
|
||||
if not conf.get("hostname"):
|
||||
match = re.search(r"(?i)sqlmap.+(-u|--url)(\s+|=)([^ ]+)", retVal)
|
||||
if match:
|
||||
retVal = retVal.replace(match.group(3), '*' * len(match.group(3)))
|
||||
# Just in case (for problematic parameters regarding user encoding)
|
||||
match = re.search(r"(?i)[ -]-(u|url|data|cookie)( |=)(.*?)( -?-[a-z]|\Z)", retVal)
|
||||
if match:
|
||||
retVal = retVal.replace(match.group(3), '*' * len(match.group(3)))
|
||||
|
||||
if getpass.getuser():
|
||||
retVal = re.sub(r"(?i)\b%s\b" % re.escape(getpass.getuser()), '*' * len(getpass.getuser()), retVal)
|
||||
@@ -3870,7 +3891,7 @@ def asciifyUrl(url, forceQuote=False):
|
||||
# urllib.quote(s.replace('%', '')) != s.replace('%', '')
|
||||
# which would trigger on all %-characters, e.g. "&".
|
||||
if getUnicode(s).encode("ascii", "replace") != s or forceQuote:
|
||||
return urllib.quote(s.encode(UNICODE_ENCODING), safe=safe)
|
||||
return urllib.quote(s.encode(UNICODE_ENCODING) if isinstance(s, unicode) else s, safe=safe)
|
||||
return s
|
||||
|
||||
username = quote(parts.username, '')
|
||||
|
||||
+18
-1
@@ -7,6 +7,8 @@ See the file 'LICENSE' for copying permission
|
||||
|
||||
import hashlib
|
||||
|
||||
from lib.core.threads import getCurrentThreadData
|
||||
|
||||
def cachedmethod(f, cache={}):
|
||||
"""
|
||||
Method with a cached content
|
||||
@@ -15,10 +17,25 @@ def cachedmethod(f, cache={}):
|
||||
"""
|
||||
|
||||
def _(*args, **kwargs):
|
||||
key = int(hashlib.md5("".join(str(_) for _ in (f, args, kwargs))).hexdigest()[:8], 16)
|
||||
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs))).hexdigest(), 16) & 0x7fffffffffffffff
|
||||
if key not in cache:
|
||||
cache[key] = f(*args, **kwargs)
|
||||
|
||||
return cache[key]
|
||||
|
||||
return _
|
||||
|
||||
def stackedmethod(f):
|
||||
def _(*args, **kwargs):
|
||||
threadData = getCurrentThreadData()
|
||||
originalLevel = len(threadData.valueStack)
|
||||
|
||||
try:
|
||||
result = f(*args, **kwargs)
|
||||
finally:
|
||||
if len(threadData.valueStack) > originalLevel:
|
||||
threadData.valueStack = threadData.valueStack[:originalLevel]
|
||||
|
||||
return result
|
||||
|
||||
return _
|
||||
+8
-3
@@ -918,7 +918,7 @@ def _setTamperingFunctions():
|
||||
dirname, filename = os.path.split(script)
|
||||
dirname = os.path.abspath(dirname)
|
||||
|
||||
infoMsg = "loading tamper script '%s'" % filename[:-3]
|
||||
infoMsg = "loading tamper module '%s'" % filename[:-3]
|
||||
logger.info(infoMsg)
|
||||
|
||||
if not os.path.exists(os.path.join(dirname, "__init__.py")):
|
||||
@@ -932,7 +932,7 @@ def _setTamperingFunctions():
|
||||
try:
|
||||
module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or UNICODE_ENCODING))
|
||||
except Exception, ex:
|
||||
raise SqlmapSyntaxException("cannot import tamper script '%s' (%s)" % (filename[:-3], getSafeExString(ex)))
|
||||
raise SqlmapSyntaxException("cannot import tamper module '%s' (%s)" % (filename[:-3], getSafeExString(ex)))
|
||||
|
||||
priority = PRIORITY.NORMAL if not hasattr(module, "__priority__") else module.__priority__
|
||||
|
||||
@@ -962,7 +962,12 @@ def _setTamperingFunctions():
|
||||
|
||||
break
|
||||
elif name == "dependencies":
|
||||
function()
|
||||
try:
|
||||
function()
|
||||
except Exception, ex:
|
||||
errMsg = "error occurred while checking dependencies "
|
||||
errMsg += "for tamper module '%s' ('%s')" % (filename[:-3], getSafeExString(ex))
|
||||
raise SqlmapGenericException(errMsg)
|
||||
|
||||
if not found:
|
||||
errMsg = "missing function 'tamper(payload, **kwargs)' "
|
||||
|
||||
@@ -14,11 +14,11 @@ _readline = None
|
||||
try:
|
||||
from readline import *
|
||||
import readline as _readline
|
||||
except ImportError:
|
||||
except:
|
||||
try:
|
||||
from pyreadline import *
|
||||
import pyreadline as _readline
|
||||
except ImportError:
|
||||
except:
|
||||
pass
|
||||
|
||||
if IS_WIN and _readline:
|
||||
|
||||
@@ -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.2.4.0"
|
||||
VERSION = "1.2.6.0"
|
||||
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)
|
||||
@@ -367,7 +367,7 @@ URI_INJECTABLE_REGEX = r"//[^/]*/([^\.*?]+)\Z"
|
||||
SENSITIVE_DATA_REGEX = "(\s|=)(?P<result>[^\s=]*%s[^\s]*)\s"
|
||||
|
||||
# Options to explicitly mask in anonymous (unhandled exception) reports (along with anything carrying the <hostname> inside)
|
||||
SENSITIVE_OPTIONS = ("hostname", "data", "dnsDomain", "googleDork", "authCred", "proxyCred", "tbl", "db", "col", "user", "cookie", "proxy", "rFile", "wFile", "dFile", "testParameter", "authCred")
|
||||
SENSITIVE_OPTIONS = ("hostname", "answers", "data", "dnsDomain", "googleDork", "authCred", "proxyCred", "tbl", "db", "col", "user", "cookie", "proxy", "rFile", "wFile", "dFile", "testParameter", "authCred")
|
||||
|
||||
# Maximum number of threads (avoiding connection issues and/or DoS)
|
||||
MAX_NUMBER_OF_THREADS = 10
|
||||
|
||||
+1
-1
@@ -230,7 +230,7 @@ def _setRequestParams():
|
||||
if kb.customInjectionMark not in conf.data: # in case that no usable parameter values has been found
|
||||
conf.parameters[PLACE.POST] = conf.data
|
||||
|
||||
kb.processUserMarks = True if (kb.postHint and kb.customInjectionMark in conf.data) else kb.processUserMarks
|
||||
kb.processUserMarks = True if (kb.postHint and kb.customInjectionMark in (conf.data or "")) else kb.processUserMarks
|
||||
|
||||
if re.search(URI_INJECTABLE_REGEX, conf.url, re.I) and not any(place in conf.parameters for place in (PLACE.GET, PLACE.POST)) and not kb.postHint and kb.customInjectionMark not in (conf.data or "") and conf.url.startswith("http"):
|
||||
warnMsg = "you've provided target URL without any GET "
|
||||
|
||||
@@ -683,6 +683,9 @@ def cmdLineParser(argv=None):
|
||||
parser.add_option("--force-dns", dest="forceDns", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--force-pivoting", dest="forcePivoting", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--force-threads", dest="forceThreads", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ from lib.core.data import kb
|
||||
from lib.core.data import paths
|
||||
from lib.parse.handler import FingerprintHandler
|
||||
|
||||
|
||||
def headersParser(headers):
|
||||
"""
|
||||
This function calls a class that parses the input HTTP headers to
|
||||
@@ -31,7 +30,7 @@ def headersParser(headers):
|
||||
"x-powered-by": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "x-powered-by.xml"),
|
||||
}
|
||||
|
||||
for header in itertools.ifilter(lambda x: x in kb.headerPaths, headers):
|
||||
for header in itertools.ifilter(lambda _: _ in kb.headerPaths, headers):
|
||||
value = headers[header]
|
||||
xmlfile = kb.headerPaths[header]
|
||||
handler = FingerprintHandler(value, kb.headersFp)
|
||||
|
||||
+3
-1
@@ -9,6 +9,7 @@ import re
|
||||
|
||||
from xml.sax.handler import ContentHandler
|
||||
|
||||
from lib.core.common import urldecode
|
||||
from lib.core.common import parseXmlFile
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import paths
|
||||
@@ -26,6 +27,7 @@ class HTMLHandler(ContentHandler):
|
||||
self._dbms = None
|
||||
self._page = (page or "")
|
||||
self._lower_page = self._page.lower()
|
||||
self._urldecoded_page = urldecode(self._page)
|
||||
|
||||
self.dbms = None
|
||||
|
||||
@@ -47,7 +49,7 @@ class HTMLHandler(ContentHandler):
|
||||
keywords = sorted(keywords, key=len)
|
||||
kb.cache.regex[regexp] = keywords[-1].lower()
|
||||
|
||||
if kb.cache.regex[regexp] in self._lower_page and re.search(regexp, self._page, re.I):
|
||||
if kb.cache.regex[regexp] in self._lower_page and re.search(regexp, self._urldecoded_page, re.I):
|
||||
self.dbms = self._dbms
|
||||
self._markAsErrorPage()
|
||||
|
||||
|
||||
@@ -220,10 +220,6 @@ def checkCharEncoding(encoding, warn=True):
|
||||
try:
|
||||
codecs.lookup(encoding.encode(UNICODE_ENCODING) if isinstance(encoding, unicode) else encoding)
|
||||
except (LookupError, ValueError):
|
||||
if warn and ' ' not in encoding:
|
||||
warnMsg = "unknown web page charset '%s'. " % encoding
|
||||
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
|
||||
singleTimeLogMessage(warnMsg, logging.WARN, encoding)
|
||||
encoding = None
|
||||
|
||||
if encoding:
|
||||
@@ -334,7 +330,7 @@ def decodePage(page, contentEncoding, contentType):
|
||||
|
||||
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
|
||||
|
||||
if kb.pageEncoding and kb.pageEncoding.lower() == "utf-8-sig":
|
||||
if (kb.pageEncoding or "").lower() == "utf-8-sig":
|
||||
kb.pageEncoding = "utf-8"
|
||||
if page and page.startswith("\xef\xbb\xbf"): # Reference: https://docs.python.org/2/library/codecs.html (Note: noticed problems when "utf-8-sig" is left to Python for handling)
|
||||
page = page[3:]
|
||||
@@ -390,7 +386,7 @@ def processResponse(page, responseHeaders, status=None):
|
||||
continue
|
||||
|
||||
conf.paramDict[PLACE.POST][name] = value
|
||||
conf.parameters[PLACE.POST] = re.sub(r"(?i)(%s=)[^&]+" % re.escape(name), r"\g<1>%s" % re.escape(value), conf.parameters[PLACE.POST])
|
||||
conf.parameters[PLACE.POST] = re.sub(r"(?i)(%s=)[^&]+" % re.escape(name), r"\g<1>%s" % value.replace('\\', r'\\'), conf.parameters[PLACE.POST])
|
||||
|
||||
if not kb.browserVerification and re.search(r"(?i)browser.?verification", page or ""):
|
||||
kb.browserVerification = True
|
||||
|
||||
+12
-21
@@ -34,6 +34,7 @@ from lib.core.common import calculateDeltaSeconds
|
||||
from lib.core.common import checkSameHost
|
||||
from lib.core.common import clearConsoleLine
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import escapeJsonValue
|
||||
from lib.core.common import evaluateCode
|
||||
from lib.core.common import extractRegexResult
|
||||
from lib.core.common import findMultipartPostBoundary
|
||||
@@ -63,6 +64,7 @@ from lib.core.common import urlencode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.dicts import POST_HINT_CONTENT_TYPES
|
||||
from lib.core.enums import ADJUST_TIME_DELAY
|
||||
from lib.core.enums import AUTH_TYPE
|
||||
@@ -118,7 +120,6 @@ from lib.request.methodrequest import MethodRequest
|
||||
from thirdparty.odict.odict import OrderedDict
|
||||
from thirdparty.socks.socks import ProxyError
|
||||
|
||||
|
||||
class Connect(object):
|
||||
"""
|
||||
This class defines methods used to perform HTTP requests
|
||||
@@ -428,8 +429,10 @@ class Connect(object):
|
||||
method = unicodeencode(method)
|
||||
req = MethodRequest(url, post, headers)
|
||||
req.set_method(method)
|
||||
else:
|
||||
elif url is not None:
|
||||
req = urllib2.Request(url, post, headers)
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
requestHeaders += "\r\n".join(["%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in req.header_items()])
|
||||
|
||||
@@ -494,7 +497,7 @@ class Connect(object):
|
||||
responseHeaders = {}
|
||||
|
||||
page = decodePage(page, responseHeaders.get(HTTP_HEADER.CONTENT_ENCODING), responseHeaders.get(HTTP_HEADER.CONTENT_TYPE))
|
||||
status = getUnicode(conn.msg) if conn else None
|
||||
status = getUnicode(conn.msg) if conn and getattr(conn, "msg", None) else None
|
||||
|
||||
kb.connErrorCounter = 0
|
||||
|
||||
@@ -577,7 +580,7 @@ class Connect(object):
|
||||
page = page if isinstance(page, unicode) else getUnicode(page)
|
||||
|
||||
code = ex.code
|
||||
status = getUnicode(ex.msg)
|
||||
status = getSafeExString(ex)
|
||||
|
||||
kb.originalCode = kb.originalCode or code
|
||||
threadData.lastHTTPError = (threadData.lastRequestUID, code, status)
|
||||
@@ -641,13 +644,6 @@ class Connect(object):
|
||||
elif "forcibly closed" in tbMsg or "Connection is already closed" in tbMsg:
|
||||
warnMsg = "connection was forcibly closed by the target URL"
|
||||
elif "timed out" in tbMsg:
|
||||
if not conf.disablePrecon:
|
||||
singleTimeWarnMessage("turning off pre-connect mechanism because of connection time out(s)")
|
||||
conf.disablePrecon = True
|
||||
|
||||
if kb.testMode and kb.testType not in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED):
|
||||
kb.responseTimes.clear()
|
||||
|
||||
if kb.testMode and kb.testType not in (None, PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED):
|
||||
singleTimeWarnMessage("there is a possibility that the target (or WAF/IPS/IDS) is dropping 'suspicious' requests")
|
||||
kb.droppingRequests = True
|
||||
@@ -768,7 +764,8 @@ class Connect(object):
|
||||
return page, responseHeaders, code
|
||||
|
||||
@staticmethod
|
||||
def queryPage(value=None, place=None, content=False, getRatioValue=False, silent=False, method=None, timeBasedCompare=False, noteResponseTime=True, auxHeaders=None, response=False, raise404=None, removeReflection=True):
|
||||
@stackedmethod
|
||||
def queryPage(value=None, place=None, content=False, getRatioValue=False, silent=False, method=None, timeBasedCompare=False, noteResponseTime=True, auxHeaders=None, response=False, raise404=None, removeReflection=True, disableTampering=False):
|
||||
"""
|
||||
This method calls a function to get the target URL page content
|
||||
and returns its page ratio (0 <= ratio <= 1) or a boolean value
|
||||
@@ -815,7 +812,7 @@ class Connect(object):
|
||||
conf.httpHeaders.append((HTTP_HEADER.CONTENT_TYPE, contentType))
|
||||
|
||||
if payload:
|
||||
if kb.tamperFunctions:
|
||||
if not disableTampering and kb.tamperFunctions:
|
||||
for function in kb.tamperFunctions:
|
||||
try:
|
||||
payload = function(payload=payload, headers=auxHeaders)
|
||||
@@ -839,16 +836,10 @@ class Connect(object):
|
||||
# with their HTML encoded counterparts
|
||||
payload = payload.replace('>', ">").replace('<', "<")
|
||||
elif kb.postHint == POST_HINT.JSON:
|
||||
if payload.startswith('"') and payload.endswith('"'):
|
||||
payload = json.dumps(payload[1:-1])
|
||||
else:
|
||||
payload = json.dumps(payload)[1:-1]
|
||||
payload = escapeJsonValue(payload)
|
||||
elif kb.postHint == POST_HINT.JSON_LIKE:
|
||||
payload = payload.replace("'", REPLACEMENT_MARKER).replace('"', "'").replace(REPLACEMENT_MARKER, '"')
|
||||
if payload.startswith('"') and payload.endswith('"'):
|
||||
payload = json.dumps(payload[1:-1])
|
||||
else:
|
||||
payload = json.dumps(payload)[1:-1]
|
||||
payload = escapeJsonValue(payload)
|
||||
payload = payload.replace("'", REPLACEMENT_MARKER).replace('"', "'").replace(REPLACEMENT_MARKER, '"')
|
||||
value = agent.replacePayload(value, payload)
|
||||
else:
|
||||
|
||||
@@ -33,6 +33,7 @@ from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.dicts import FROM_DUMMY_TABLE
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
@@ -76,6 +77,9 @@ def _goInference(payload, expression, charsetType=None, firstChar=None, lastChar
|
||||
|
||||
value = _goDns(payload, expression)
|
||||
|
||||
if payload is None:
|
||||
return None
|
||||
|
||||
if value is not None:
|
||||
return value
|
||||
|
||||
@@ -333,6 +337,7 @@ def _goUnion(expression, unpack=True, dump=False):
|
||||
|
||||
return output
|
||||
|
||||
@stackedmethod
|
||||
def getValue(expression, blind=True, union=True, error=True, time=True, fromUser=False, expected=None, batch=False, unpack=True, resumeValue=True, charsetType=None, firstChar=None, lastChar=None, dump=False, suppressOutput=None, expectingNone=False, safeCharEncode=True):
|
||||
"""
|
||||
Called each time sqlmap inject a SQL query on the SQL injection
|
||||
|
||||
@@ -32,7 +32,7 @@ class HTTPRangeHandler(urllib2.BaseHandler):
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
# create Request and set Range header
|
||||
req = urllib2.Request('http://www.python.org/')
|
||||
req = urllib2.Request('https://www.python.org/')
|
||||
req.header['Range'] = 'bytes=30-50'
|
||||
f = urllib2.urlopen(req)
|
||||
"""
|
||||
|
||||
@@ -27,7 +27,6 @@ from lib.takeover.udf import UDF
|
||||
from lib.takeover.web import Web
|
||||
from lib.takeover.xp_cmdshell import XP_cmdshell
|
||||
|
||||
|
||||
class Abstraction(Web, UDF, XP_cmdshell):
|
||||
"""
|
||||
This class defines an abstraction layer for OS takeover functionalities
|
||||
|
||||
@@ -675,13 +675,10 @@ class Metasploit:
|
||||
written = self.writeFile(self.shellcodeexecLocal, self.shellcodeexecRemote, "binary", forceCheck=True)
|
||||
|
||||
if written is not True:
|
||||
errMsg = "there has been a problem uploading shellcodeexec, it "
|
||||
errMsg = "there has been a problem uploading shellcodeexec. It "
|
||||
errMsg += "looks like the binary file has not been written "
|
||||
errMsg += "on the database underlying file system or an AV has "
|
||||
errMsg += "flagged it as malicious and removed it. In such a case "
|
||||
errMsg += "it is recommended to recompile shellcodeexec with "
|
||||
errMsg += "slight modification to the source code or pack it "
|
||||
errMsg += "with an obfuscator software"
|
||||
errMsg += "flagged it as malicious and removed it"
|
||||
logger.error(errMsg)
|
||||
|
||||
return False
|
||||
|
||||
@@ -53,7 +53,6 @@ from lib.core.settings import VIEWSTATE_REGEX
|
||||
from lib.request.connect import Connect as Request
|
||||
from thirdparty.oset.pyoset import oset
|
||||
|
||||
|
||||
class Web:
|
||||
"""
|
||||
This class defines web-oriented OS takeover functionalities for
|
||||
|
||||
@@ -24,6 +24,7 @@ from lib.core.convert import hexencode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
@@ -96,6 +97,7 @@ class XP_cmdshell:
|
||||
|
||||
return wasLastResponseDelayed()
|
||||
|
||||
@stackedmethod
|
||||
def _xpCmdshellTest(self):
|
||||
threadData = getCurrentThreadData()
|
||||
pushValue(threadData.disableStdOut)
|
||||
|
||||
@@ -69,6 +69,9 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||
finalValue = None
|
||||
retrievedLength = 0
|
||||
|
||||
if payload is None:
|
||||
return 0, None
|
||||
|
||||
if charsetType is None and conf.charset:
|
||||
asciiTbl = sorted(set(ord(_) for _ in conf.charset))
|
||||
else:
|
||||
@@ -187,7 +190,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||
with hintlock:
|
||||
hintValue = kb.hintValue
|
||||
|
||||
if hintValue is not None and len(hintValue) >= idx:
|
||||
if payload is not None and hintValue is not None and len(hintValue) >= idx:
|
||||
if Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.ACCESS, DBMS.MAXDB, DBMS.DB2):
|
||||
posValue = hintValue[idx - 1]
|
||||
else:
|
||||
|
||||
@@ -14,7 +14,6 @@ from lib.core.dicts import FROM_DUMMY_TABLE
|
||||
from lib.core.exception import SqlmapNotVulnerableException
|
||||
from lib.techniques.dns.use import dnsUse
|
||||
|
||||
|
||||
def dnsTest(payload):
|
||||
logger.info("testing for data retrieval through DNS channel")
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ from lib.core.settings import PARTIAL_VALUE_MARKER
|
||||
from lib.core.unescaper import unescaper
|
||||
from lib.request.connect import Connect as Request
|
||||
|
||||
|
||||
def dnsUse(payload, expression):
|
||||
"""
|
||||
Retrieve the output of a SQL query taking advantage of the DNS
|
||||
|
||||
@@ -414,7 +414,7 @@ def errorUse(expression, dump=False):
|
||||
break
|
||||
|
||||
if output and isListLike(output) and len(output) == 1:
|
||||
output = output[0]
|
||||
output = unArrayizeValue(output)
|
||||
|
||||
with kb.locks.value:
|
||||
index = None
|
||||
@@ -446,7 +446,7 @@ def errorUse(expression, dump=False):
|
||||
value = _errorFields(expression, expressionFields, expressionFieldsList)
|
||||
|
||||
if value and isListLike(value) and len(value) == 1 and isinstance(value[0], basestring):
|
||||
value = value[0]
|
||||
value = unArrayizeValue(value)
|
||||
|
||||
duration = calculateDeltaSeconds(start)
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ from lib.core.common import wasLastResponseDBMSError
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.dicts import FROM_DUMMY_TABLE
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.settings import LIMITED_ROWS_TEST_NUMBER
|
||||
@@ -48,7 +49,8 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
|
||||
"""
|
||||
retVal = None
|
||||
|
||||
def _orderByTechnique(lowerCount, upperCount):
|
||||
@stackedmethod
|
||||
def _orderByTechnique(lowerCount=None, upperCount=None):
|
||||
def _orderByTest(cols):
|
||||
query = agent.prefixQuery("ORDER BY %d" % cols, prefix=prefix)
|
||||
query = agent.suffixQuery(query, suffix=suffix, comment=comment)
|
||||
@@ -88,8 +90,8 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
|
||||
kb.errorIsNone = False
|
||||
lowerCount, upperCount = conf.uColsStart, conf.uColsStop
|
||||
|
||||
if lowerCount == 1 or conf.uCols:
|
||||
found = kb.orderByColumns or _orderByTechnique(lowerCount, upperCount)
|
||||
if kb.orderByColumns is None and (lowerCount == 1 or conf.uCols): # ORDER BY is not bullet-proof
|
||||
found = _orderByTechnique(lowerCount, upperCount) if conf.uCols else _orderByTechnique()
|
||||
if found:
|
||||
kb.orderByColumns = found
|
||||
infoMsg = "target URL appears to have %d column%s in query" % (found, 's' if found > 1 else "")
|
||||
@@ -114,10 +116,10 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
|
||||
items.append((count, ratio))
|
||||
|
||||
if not isNullValue(kb.uChar):
|
||||
for regex in (kb.uChar, r'>\s*%s\s*<' % kb.uChar):
|
||||
contains = tuple((count, re.search(regex, _ or "", re.IGNORECASE) is not None) for count, _ in pages.items())
|
||||
if len(filter(lambda _: _[1], contains)) == 1:
|
||||
retVal = filter(lambda _: _[1], contains)[0][0]
|
||||
for regex in (kb.uChar.strip("'"), r'>\s*%s\s*<' % kb.uChar.strip("'")):
|
||||
contains = [count for count, content in pages.items() if re.search(regex, content or "", re.IGNORECASE) is not None]
|
||||
if len(contains) == 1:
|
||||
retVal = contains[0]
|
||||
break
|
||||
|
||||
if not retVal:
|
||||
@@ -265,6 +267,8 @@ def _unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix)
|
||||
|
||||
validPayload = None
|
||||
vector = None
|
||||
orderBy = kb.orderByColumns
|
||||
uChars = (conf.uChar, kb.uChar)
|
||||
|
||||
# In case that user explicitly stated number of columns affected
|
||||
if conf.uColsStop == conf.uColsStart:
|
||||
@@ -299,6 +303,10 @@ def _unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix)
|
||||
if not all((validPayload, vector)) and not warnMsg.endswith("consider "):
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
if count and orderBy is None and kb.orderByColumns is not None: # discard ORDER BY results (not usable - e.g. maybe invalid altogether)
|
||||
conf.uChar, kb.uChar = uChars
|
||||
validPayload, vector = _unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix)
|
||||
|
||||
return validPayload, vector
|
||||
|
||||
def unionTest(comment, place, parameter, value, prefix, suffix):
|
||||
|
||||
@@ -104,9 +104,7 @@ class Database(object):
|
||||
|
||||
def init(self):
|
||||
self.execute("CREATE TABLE logs(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, time TEXT, level TEXT, message TEXT)")
|
||||
|
||||
self.execute("CREATE TABLE data(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, status INTEGER, content_type INTEGER, value TEXT)")
|
||||
|
||||
self.execute("CREATE TABLE errors(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, error TEXT)")
|
||||
|
||||
class Task(object):
|
||||
@@ -199,7 +197,6 @@ class Task(object):
|
||||
def engine_has_terminated(self):
|
||||
return isinstance(self.engine_get_returncode(), int)
|
||||
|
||||
|
||||
# Wrapper functions for sqlmap engine
|
||||
class StdDbOut(object):
|
||||
def __init__(self, taskid, messagetype="stdout"):
|
||||
@@ -573,7 +570,6 @@ def scan_data(taskid):
|
||||
logger.debug("[%s] Retrieved scan data and error messages" % taskid)
|
||||
return jsonize({"success": True, "data": json_data_message, "error": json_errors_message})
|
||||
|
||||
|
||||
# Functions to handle scans' logs
|
||||
@get("/scan/<taskid>/log/<start>/<end>")
|
||||
def scan_log_limited(taskid, start, end):
|
||||
@@ -601,7 +597,6 @@ def scan_log_limited(taskid, start, end):
|
||||
logger.debug("[%s] Retrieved scan log messages subset" % taskid)
|
||||
return jsonize({"success": True, "log": json_log_messages})
|
||||
|
||||
|
||||
@get("/scan/<taskid>/log")
|
||||
def scan_log(taskid):
|
||||
"""
|
||||
@@ -621,7 +616,6 @@ def scan_log(taskid):
|
||||
logger.debug("[%s] Retrieved scan log messages" % taskid)
|
||||
return jsonize({"success": True, "log": json_log_messages})
|
||||
|
||||
|
||||
# Function to handle files inside the output directory
|
||||
@get("/download/<taskid>/<target>/<filename:path>")
|
||||
def download(taskid, target, filename):
|
||||
@@ -648,7 +642,6 @@ def download(taskid, target, filename):
|
||||
logger.warning("[%s] File does not exist %s" % (taskid, target))
|
||||
return jsonize({"success": False, "message": "File does not exist"})
|
||||
|
||||
|
||||
def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=RESTAPI_DEFAULT_ADAPTER, username=None, password=None):
|
||||
"""
|
||||
REST-JSON API server
|
||||
|
||||
@@ -22,7 +22,6 @@ class _Getch(object):
|
||||
def __call__(self):
|
||||
return self.impl()
|
||||
|
||||
|
||||
class _GetchUnix(object):
|
||||
def __init__(self):
|
||||
__import__("tty")
|
||||
@@ -41,7 +40,6 @@ class _GetchUnix(object):
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
||||
return ch
|
||||
|
||||
|
||||
class _GetchWindows(object):
|
||||
def __init__(self):
|
||||
__import__("msvcrt")
|
||||
@@ -50,7 +48,6 @@ class _GetchWindows(object):
|
||||
import msvcrt
|
||||
return msvcrt.getch()
|
||||
|
||||
|
||||
class _GetchMacCarbon(object):
|
||||
"""
|
||||
A function which returns the current ASCII key that is down;
|
||||
@@ -79,5 +76,4 @@ class _GetchMacCarbon(object):
|
||||
(what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1]
|
||||
return chr(msg & 0x000000FF)
|
||||
|
||||
|
||||
getch = _Getch()
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ from lib.core.common import urlencode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.enums import CUSTOM_LOGGING
|
||||
from lib.core.enums import HTTP_HEADER
|
||||
from lib.core.enums import REDIRECTION
|
||||
@@ -35,7 +36,6 @@ from lib.core.settings import UNICODE_ENCODING
|
||||
from lib.request.basic import decodePage
|
||||
from thirdparty.socks import socks
|
||||
|
||||
|
||||
def _search(dork):
|
||||
"""
|
||||
This method performs the effective search on Google providing
|
||||
@@ -165,6 +165,7 @@ def _search(dork):
|
||||
|
||||
return retVal
|
||||
|
||||
@stackedmethod
|
||||
def search(dork):
|
||||
pushValue(kb.redirectChoice)
|
||||
kb.redirectChoice = REDIRECTION.YES
|
||||
|
||||
@@ -57,7 +57,7 @@ class SQLAlchemy(GenericConnector):
|
||||
if self.dialect == "sqlite":
|
||||
engine = _sqlalchemy.create_engine(conf.direct, connect_args={"check_same_thread": False})
|
||||
elif self.dialect == "oracle":
|
||||
engine = _sqlalchemy.create_engine(conf.direct, connect_args={"allow_twophase": False})
|
||||
engine = _sqlalchemy.create_engine(conf.direct)
|
||||
else:
|
||||
engine = _sqlalchemy.create_engine(conf.direct, connect_args={})
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ PYVERSION = sys.version.split()[0]
|
||||
if PYVERSION >= "3" or PYVERSION < "2.6":
|
||||
exit("[CRITICAL] incompatible Python version detected ('%s'). To successfully run sqlmap you'll have to use version 2.6.x or 2.7.x (visit 'https://www.python.org/downloads/')" % PYVERSION)
|
||||
|
||||
extensions = ("bz2", "gzip", "ssl", "sqlite3", "zlib")
|
||||
extensions = ("bz2", "gzip", "pyexpat", "ssl", "sqlite3", "zlib")
|
||||
try:
|
||||
for _ in extensions:
|
||||
__import__(_)
|
||||
|
||||
@@ -19,9 +19,9 @@ from plugins.generic.connector import Connector as GenericConnector
|
||||
|
||||
class Connector(GenericConnector):
|
||||
"""
|
||||
Homepage: http://code.google.com/p/ibm-db/
|
||||
User guide: http://code.google.com/p/ibm-db/wiki/README
|
||||
API: http://www.python.org/dev/peps/pep-0249/
|
||||
Homepage: https://github.com/ibmdb/python-ibmdb
|
||||
User guide: https://github.com/ibmdb/python-ibmdb/wiki/README
|
||||
API: https://www.python.org/dev/peps/pep-0249/
|
||||
License: Apache License 2.0
|
||||
"""
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
|
||||
from lib.core.data import logger
|
||||
from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import Format
|
||||
from lib.core.data import conf
|
||||
|
||||
@@ -19,9 +19,9 @@ from plugins.generic.connector import Connector as GenericConnector
|
||||
|
||||
class Connector(GenericConnector):
|
||||
"""
|
||||
Homepage: http://code.google.com/p/ibm-db/
|
||||
User guide: http://code.google.com/p/ibm-db/wiki/README
|
||||
API: http://www.python.org/dev/peps/pep-0249/
|
||||
Homepage: https://github.com/ibmdb/python-ibmdb
|
||||
User guide: https://github.com/ibmdb/python-ibmdb/wiki/README
|
||||
API: https://www.python.org/dev/peps/pep-0249/
|
||||
License: Apache License 2.0
|
||||
"""
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ from plugins.dbms.mssqlserver.syntax import Syntax
|
||||
from plugins.dbms.mssqlserver.takeover import Takeover
|
||||
from plugins.generic.misc import Miscellaneous
|
||||
|
||||
|
||||
class MSSQLServerMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
|
||||
"""
|
||||
This class defines Microsoft SQL Server methods
|
||||
|
||||
@@ -21,9 +21,9 @@ from plugins.generic.connector import Connector as GenericConnector
|
||||
|
||||
class Connector(GenericConnector):
|
||||
"""
|
||||
Homepage: http://pymssql.sourceforge.net/
|
||||
User guide: http://pymssql.sourceforge.net/examples_pymssql.php
|
||||
API: http://pymssql.sourceforge.net/ref_pymssql.php
|
||||
Homepage: http://www.pymssql.org/en/stable/
|
||||
User guide: http://www.pymssql.org/en/stable/pymssql_examples.html
|
||||
API: http://www.pymssql.org/en/stable/ref/pymssql.html
|
||||
Debian package: python-pymssql
|
||||
License: LGPL
|
||||
|
||||
@@ -43,6 +43,8 @@ class Connector(GenericConnector):
|
||||
self.connector = pymssql.connect(host="%s:%d" % (self.hostname, self.port), user=self.user, password=self.password, database=self.db, login_timeout=conf.timeout, timeout=conf.timeout)
|
||||
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
|
||||
raise SqlmapConnectionException(msg)
|
||||
except ValueError:
|
||||
raise SqlmapConnectionException
|
||||
|
||||
self.initCursor()
|
||||
self.printConnected()
|
||||
|
||||
@@ -136,8 +136,8 @@ class Fingerprint(GenericFingerprint):
|
||||
self.createSupportTbl(self.fileTblName, self.tblField, "varchar(1000)")
|
||||
inject.goStacked("INSERT INTO %s(%s) VALUES (%s)" % (self.fileTblName, self.tblField, "@@VERSION"))
|
||||
|
||||
# Reference: http://en.wikipedia.org/wiki/Comparison_of_Microsoft_Windows_versions
|
||||
# http://en.wikipedia.org/wiki/Windows_NT#Releases
|
||||
# Reference: https://en.wikipedia.org/wiki/Comparison_of_Microsoft_Windows_versions
|
||||
# https://en.wikipedia.org/wiki/Windows_NT#Releases
|
||||
versions = {
|
||||
"NT": ("4.0", (6, 5, 4, 3, 2, 1)),
|
||||
"2000": ("5.0", (4, 3, 2, 1)),
|
||||
|
||||
@@ -26,8 +26,8 @@ class Takeover(GenericTakeover):
|
||||
def spHeapOverflow(self):
|
||||
"""
|
||||
References:
|
||||
* http://www.microsoft.com/technet/security/bulletin/MS09-004.mspx
|
||||
* http://support.microsoft.com/kb/959420
|
||||
* https://docs.microsoft.com/en-us/security-updates/securitybulletins/2009/ms09-004
|
||||
* https://support.microsoft.com/en-us/help/959420/ms09-004-vulnerabilities-in-microsoft-sql-server-could-allow-remote-co
|
||||
"""
|
||||
|
||||
returns = {
|
||||
|
||||
@@ -14,6 +14,7 @@ from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
@@ -81,6 +82,7 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
return result
|
||||
|
||||
@stackedmethod
|
||||
def unionWriteFile(self, wFile, dFile, fileType, forceCheck=False):
|
||||
logger.debug("encoding file to its hexadecimal string value")
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ os.environ["NLS_LANG"] = ".AL32UTF8"
|
||||
|
||||
class Connector(GenericConnector):
|
||||
"""
|
||||
Homepage: http://cx-oracle.sourceforge.net/
|
||||
User guide: http://cx-oracle.sourceforge.net/README.txt
|
||||
API: http://cx-oracle.sourceforge.net/html/index.html
|
||||
License: http://cx-oracle.sourceforge.net/LICENSE.txt
|
||||
Homepage: https://oracle.github.io/python-cx_Oracle/
|
||||
User https://cx-oracle.readthedocs.io/en/latest/
|
||||
API: https://wiki.python.org/moin/DatabaseProgramming
|
||||
License: https://cx-oracle.readthedocs.io/en/latest/license.html#license
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -60,7 +60,7 @@ class Fingerprint(GenericFingerprint):
|
||||
"""
|
||||
References for fingerprint:
|
||||
|
||||
* http://www.postgresql.org/docs/9.1/interactive/release.html (up to 9.1.3)
|
||||
* https://www.postgresql.org/docs/current/static/release.html
|
||||
"""
|
||||
|
||||
if not conf.extensiveFp and Backend.isDbmsWithin(PGSQL_ALIASES):
|
||||
@@ -97,8 +97,12 @@ class Fingerprint(GenericFingerprint):
|
||||
infoMsg = "actively fingerprinting %s" % DBMS.PGSQL
|
||||
logger.info(infoMsg)
|
||||
|
||||
if inject.checkBooleanExpression("TO_JSONB(1) IS NOT NULL"):
|
||||
Backend.setVersion(">= 9.5.0")
|
||||
if inject.checkBooleanExpression("XMLTABLE(NULL) IS NULL"):
|
||||
Backend.setVersion(">= 10.0")
|
||||
elif inject.checkBooleanExpression("SIND(0)=0"):
|
||||
Backend.setVersion(">= 9.6.0", "< 10.0")
|
||||
elif inject.checkBooleanExpression("TO_JSONB(1) IS NOT NULL"):
|
||||
Backend.setVersion(">= 9.5.0", "< 9.6.0")
|
||||
elif inject.checkBooleanExpression("JSON_TYPEOF(NULL) IS NULL"):
|
||||
Backend.setVersionList([">= 9.4.0", "< 9.5.0"])
|
||||
elif inject.checkBooleanExpression("ARRAY_REPLACE(NULL,1,1) IS NULL"):
|
||||
|
||||
@@ -19,7 +19,6 @@ from lib.core.exception import SqlmapConnectionException
|
||||
from lib.core.exception import SqlmapMissingDependence
|
||||
from plugins.generic.connector import Connector as GenericConnector
|
||||
|
||||
|
||||
class Connector(GenericConnector):
|
||||
"""
|
||||
Homepage: http://pysqlite.googlecode.com/ and http://packages.ubuntu.com/quantal/python-sqlite
|
||||
|
||||
@@ -43,6 +43,8 @@ class Connector(GenericConnector):
|
||||
self.connector = pymssql.connect(host="%s:%d" % (self.hostname, self.port), user=self.user, password=self.password, database=self.db, login_timeout=conf.timeout, timeout=conf.timeout)
|
||||
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
|
||||
raise SqlmapConnectionException(msg)
|
||||
except ValueError:
|
||||
raise SqlmapConnectionException
|
||||
|
||||
self.initCursor()
|
||||
self.printConnected()
|
||||
|
||||
@@ -32,6 +32,7 @@ from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import paths
|
||||
from lib.core.data import queries
|
||||
from lib.core.decorators import stackedmethod
|
||||
from lib.core.dicts import FIREBIRD_TYPES
|
||||
from lib.core.dicts import INFORMIX_TYPES
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
@@ -289,6 +290,24 @@ class Databases:
|
||||
db = safeSQLIdentificatorNaming(db)
|
||||
table = safeSQLIdentificatorNaming(unArrayizeValue(table), True)
|
||||
|
||||
if conf.getComments:
|
||||
_ = queries[Backend.getIdentifiedDbms()].table_comment
|
||||
if hasattr(_, "query"):
|
||||
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
|
||||
query = _.query % (unsafeSQLIdentificatorNaming(db.upper()), unsafeSQLIdentificatorNaming(table.upper()))
|
||||
else:
|
||||
query = _.query % (unsafeSQLIdentificatorNaming(db), unsafeSQLIdentificatorNaming(table))
|
||||
|
||||
comment = unArrayizeValue(inject.getValue(query, blind=False, time=False))
|
||||
if not isNoneValue(comment):
|
||||
infoMsg = "retrieved comment '%s' for table '%s' " % (comment, unsafeSQLIdentificatorNaming(table))
|
||||
infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
|
||||
logger.info(infoMsg)
|
||||
else:
|
||||
warnMsg = "on %s it is not " % Backend.getIdentifiedDbms()
|
||||
warnMsg += "possible to get column comments"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
if db not in kb.data.cachedTables:
|
||||
kb.data.cachedTables[db] = [table]
|
||||
else:
|
||||
@@ -352,6 +371,24 @@ class Databases:
|
||||
table = safeSQLIdentificatorNaming(table, True)
|
||||
tables.append(table)
|
||||
|
||||
if conf.getComments:
|
||||
_ = queries[Backend.getIdentifiedDbms()].table_comment
|
||||
if hasattr(_, "query"):
|
||||
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
|
||||
query = _.query % (unsafeSQLIdentificatorNaming(db.upper()), unsafeSQLIdentificatorNaming(table.upper()))
|
||||
else:
|
||||
query = _.query % (unsafeSQLIdentificatorNaming(db), unsafeSQLIdentificatorNaming(table))
|
||||
|
||||
comment = unArrayizeValue(inject.getValue(query, union=False, error=False))
|
||||
if not isNoneValue(comment):
|
||||
infoMsg = "retrieved comment '%s' for table '%s' " % (comment, unsafeSQLIdentificatorNaming(table))
|
||||
infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
|
||||
logger.info(infoMsg)
|
||||
else:
|
||||
warnMsg = "on %s it is not " % Backend.getIdentifiedDbms()
|
||||
warnMsg += "possible to get column comments"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
if tables:
|
||||
kb.data.cachedTables[db] = tables
|
||||
else:
|
||||
@@ -806,6 +843,7 @@ class Databases:
|
||||
|
||||
return kb.data.cachedColumns
|
||||
|
||||
@stackedmethod
|
||||
def getSchema(self):
|
||||
infoMsg = "enumerating database management system schema"
|
||||
logger.info(infoMsg)
|
||||
|
||||
@@ -23,6 +23,7 @@ from lib.core.common import prioritySortColumns
|
||||
from lib.core.common import readInput
|
||||
from lib.core.common import safeSQLIdentificatorNaming
|
||||
from lib.core.common import singleTimeLogMessage
|
||||
from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.common import unArrayizeValue
|
||||
from lib.core.common import unsafeSQLIdentificatorNaming
|
||||
from lib.core.data import conf
|
||||
@@ -184,7 +185,11 @@ class Entries:
|
||||
if not (isTechniqueAvailable(PAYLOAD.TECHNIQUE.UNION) and kb.injection.data[PAYLOAD.TECHNIQUE.UNION].where == PAYLOAD.WHERE.ORIGINAL):
|
||||
table = "%s.%s" % (conf.db, tbl)
|
||||
|
||||
if Backend.isDbms(DBMS.MSSQL):
|
||||
if Backend.isDbms(DBMS.MSSQL) and not conf.forcePivoting:
|
||||
warnMsg = "in case of table dumping problems (e.g. column entry order) "
|
||||
warnMsg += "you are advised to rerun with '--force-pivoting'"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
query = rootQuery.blind.count % table
|
||||
query = agent.whereQuery(query)
|
||||
|
||||
@@ -327,7 +332,11 @@ class Entries:
|
||||
elif Backend.isDbms(DBMS.INFORMIX):
|
||||
table = "%s:%s" % (conf.db, tbl)
|
||||
|
||||
if Backend.isDbms(DBMS.MSSQL):
|
||||
if Backend.isDbms(DBMS.MSSQL) and not conf.forcePivoting:
|
||||
warnMsg = "in case of table dumping problems (e.g. column entry order) "
|
||||
warnMsg += "you are advised to rerun with '--force-pivoting'"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
try:
|
||||
indexRange = getLimitRange(count, plusOne=True)
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ def checkEnvironment():
|
||||
for _ in ("SqlmapBaseException", "SqlmapShellQuitException", "SqlmapSilentQuitException", "SqlmapUserQuitException"):
|
||||
globals()[_] = getattr(sys.modules["lib.core.exception"], _)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main function of sqlmap when running from command line.
|
||||
@@ -265,8 +264,15 @@ def main():
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("twophase", "sqlalchemy")):
|
||||
errMsg = "please update the 'sqlalchemy' package"
|
||||
errMsg += "(Reference: https://github.com/apache/incubator-superset/issues/3447)"
|
||||
errMsg = "please update the 'sqlalchemy' package (>= 1.1.11) "
|
||||
errMsg += "(Reference: https://qiita.com/tkprof/items/7d7b2d00df9c5f16fffe)"
|
||||
logger.error(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif "must be pinned buffer, not bytearray" in excMsg:
|
||||
errMsg = "error occurred at Python interpreter which "
|
||||
errMsg += "is fixed in 2.7.x. Please update accordingly "
|
||||
errMsg += "(Reference: https://bugs.python.org/issue8104)"
|
||||
logger.error(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from lib.core.data import kb
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.NORMAL
|
||||
|
||||
def dependencies():
|
||||
pass
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
Replaces each (MySQL) 0x<hex> encoded string with equivalent CONCAT(CHAR(),...) counterpart
|
||||
|
||||
Tested against:
|
||||
* MySQL 4, 5.0 and 5.5
|
||||
|
||||
Notes:
|
||||
* Useful in cases when web application does the upper casing
|
||||
|
||||
>>> tamper('SELECT 0xdeadbeef')
|
||||
'SELECT CONCAT(CHAR(222),CHAR(173),CHAR(190),CHAR(239))'
|
||||
"""
|
||||
|
||||
retVal = payload
|
||||
|
||||
if payload:
|
||||
for match in re.finditer(r"\b0x([0-9a-f]+)\b", retVal):
|
||||
if len(match.group(1)) > 2:
|
||||
result = "CONCAT(%s)" % ','.join("CHAR(%d)" % ord(_) for _ in match.group(1).decode("hex"))
|
||||
else:
|
||||
result = "CHAR(%d)" % ord(match.group(1).decode("hex"))
|
||||
retVal = retVal.replace(match.group(0), result)
|
||||
|
||||
return retVal
|
||||
Vendored
+305
-667
File diff suppressed because it is too large
Load Diff
+56
-54
@@ -5,7 +5,7 @@ b0eb597c613afeff9d62898cf4c67a56 extra/cloak/cloak.py
|
||||
e0911386106b95d2ba4b12d651b2eb16 extra/dbgtool/dbgtool.py
|
||||
1e5532ede194ac9c083891c2f02bca93 extra/dbgtool/__init__.py
|
||||
acba8b5dc93db0fe6b2b04ff0138c33c extra/icmpsh/icmpsh.exe_
|
||||
2176d964f2d5ba2d871383d6a1868b8f extra/icmpsh/icmpsh_m.py
|
||||
fe39e5c315d63afff5cb99ec42fc883f extra/icmpsh/icmpsh_m.py
|
||||
2d020d2bdcee1170805f48839fdb89df extra/icmpsh/__init__.py
|
||||
1e5532ede194ac9c083891c2f02bca93 extra/__init__.py
|
||||
27629e01ba722271c990ad4b27151917 extra/mssqlsig/update.py
|
||||
@@ -16,22 +16,23 @@ d229479d02d21b29f209143cb0547780 extra/shellcodeexec/linux/shellcodeexec.x32_
|
||||
2fe2f94eebc62f7614f0391a8a90104f extra/shellcodeexec/linux/shellcodeexec.x64_
|
||||
c55b400b72acc43e0e59c87dd8bb8d75 extra/shellcodeexec/windows/shellcodeexec.x32.exe_
|
||||
220745c50d375dad7aefebf8ca3611ef extra/shutils/duplicates.py
|
||||
1f33abe1a67493909d29a35ca72ecedb extra/shutils/newlines.py
|
||||
71b9d4357c31db013ecda27433830090 extra/shutils/pylint.py
|
||||
c88d66597f4aab719bde4542b0a1a6e0 extra/shutils/regressiontest.py
|
||||
1e5532ede194ac9c083891c2f02bca93 extra/sqlharvest/__init__.py
|
||||
b3e60ea4e18a65c48515d04aab28ff68 extra/sqlharvest/sqlharvest.py
|
||||
0f581182871148b0456a691ae85b04c0 lib/controller/action.py
|
||||
8901cbab8f3885c554fe9ac43a1e5f14 lib/controller/checks.py
|
||||
33689bb1b064d4eebc216934795a595f lib/controller/controller.py
|
||||
9682b922fd621d31708d562b15803202 lib/controller/checks.py
|
||||
c414cecdb0472c92cf50ed5b01e4438c lib/controller/controller.py
|
||||
c7443613a0a2505b1faec931cee2a6ef lib/controller/handler.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
|
||||
b1990c7805943f0c973a853bba981d96 lib/core/agent.py
|
||||
fd8f239e259afaf5f24bcf34a0ad187f lib/core/bigarray.py
|
||||
58312f5c2f252145ec4aed01bc7952a0 lib/core/common.py
|
||||
240cb11db16783c6601b1d7de5eadd8d lib/core/common.py
|
||||
0d082da16c388b3445e656e0760fb582 lib/core/convert.py
|
||||
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
|
||||
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
|
||||
12e80071013606f01822c3823fb51054 lib/core/decorators.py
|
||||
93567739d591829c1fb9ff77a50bcc87 lib/core/decorators.py
|
||||
fbb55cc6100318ff922957b6577dc58f lib/core/defaults.py
|
||||
da98f5288aad57855c6d287ba3b397a1 lib/core/dicts.py
|
||||
9ea8a043030796e6faef7f7e957729d5 lib/core/dump.py
|
||||
@@ -40,16 +41,16 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
|
||||
458a194764805cd8312c14ecd4be4d1e lib/core/log.py
|
||||
c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.py
|
||||
b950c8c2f2ae87ad2ec99e1d19b2c03a lib/core/option.py
|
||||
83345a6b0b7e187d2cbcc280a509f03e lib/core/option.py
|
||||
7cfd04e583cca782b843f6f6d973981a lib/core/profiling.py
|
||||
ffa5f01f39b17c8d73423acca6cfe86a lib/core/readlineng.py
|
||||
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
|
||||
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
|
||||
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
|
||||
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
|
||||
88d4f1d18b6919f1ad5f179ed959e7a7 lib/core/settings.py
|
||||
cd402ab35a20d44b7404bcc18f652a16 lib/core/settings.py
|
||||
0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py
|
||||
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
|
||||
a35efa7bec9f1e6cedf17c9830a79241 lib/core/target.py
|
||||
6306284edcccc185b2df085438572b0d lib/core/target.py
|
||||
72d499ca8d792e90a1ebfb2ad2341a51 lib/core/testing.py
|
||||
de9922a29c71a235cb95a916ff925db2 lib/core/threads.py
|
||||
c40758411bb0bd68764d78e0bb72bd0f lib/core/unescaper.py
|
||||
@@ -57,52 +58,52 @@ af2d1810b6a7ebc61689a53c253ddbaa lib/core/update.py
|
||||
e772deb63270375e685fa5a7b775c382 lib/core/wordlist.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/__init__.py
|
||||
7620f1f4b8791e13c7184c06b5421754 lib/parse/banner.py
|
||||
f667710f17b8447358ee7508a9d2faf1 lib/parse/cmdline.py
|
||||
5e46fac7f824ba8ab8003a1cd47d8af3 lib/parse/cmdline.py
|
||||
fb2e2f05dde98caeac6ccf3e67192177 lib/parse/configfile.py
|
||||
3794ff139869f5ae8e81cfdbe5714f56 lib/parse/handler.py
|
||||
8d7321a1bc1a26ac55b2398bf445d78f lib/parse/headers.py
|
||||
33f21b11b7963062df8fa2292229df80 lib/parse/html.py
|
||||
6bab53ea9d75bc9bb8169d3e8f3f149f lib/parse/headers.py
|
||||
1bc6ddaeada0f2425fa9aae226854ca8 lib/parse/html.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/parse/__init__.py
|
||||
ec4e56bbb1349176b2a22e0b99ba6a55 lib/parse/payloads.py
|
||||
492654567e72b6a14584651fcd9f16e6 lib/parse/sitemap.py
|
||||
30eed3a92a04ed2c29770e1b10d39dc0 lib/request/basicauthhandler.py
|
||||
7e8e0a3fdebbe443832c1bab2f8d3869 lib/request/basic.py
|
||||
62e4500ef19f7795a1443897b535b36d lib/request/basic.py
|
||||
c0cabedead14b8a23353b606672cff42 lib/request/comparison.py
|
||||
a42707d6e89312659d3bdc8fb4ad1336 lib/request/connect.py
|
||||
0ad9051e84e8fefe826f1a574b41b1b0 lib/request/connect.py
|
||||
dd4598675027fae99f2e2475b05986da lib/request/direct.py
|
||||
2044fce3f4ffa268fcfaaf63241b1e64 lib/request/dns.py
|
||||
eee965d781546d05f36cfd14af050913 lib/request/httpshandler.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/request/__init__.py
|
||||
cb05d965aa3d5871d14b5e45fe9128b4 lib/request/inject.py
|
||||
c2fb1abbb7127ec6419bbf852c0a458d lib/request/inject.py
|
||||
aaf956c1e9855836c3f372e29d481393 lib/request/methodrequest.py
|
||||
51eeaa8abf5ba62aaaade66d46ff8b00 lib/request/pkihandler.py
|
||||
aa7cb67139bbc57d67a728fd2abf80ed lib/request/rangehandler.py
|
||||
2c3774b72586985719035b195f144d7b lib/request/rangehandler.py
|
||||
aa809d825b33bea76a63ecd97cf7792c lib/request/redirecthandler.py
|
||||
7f12d8f3b6665ed7053954bba70ff718 lib/request/templates.py
|
||||
8d31425f36a7a9c093eb9bef44589593 lib/takeover/abstraction.py
|
||||
747f9941a68361bd779ec760f71568e9 lib/takeover/abstraction.py
|
||||
acc1db3667bf910b809eb279b60595eb lib/takeover/icmpsh.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/takeover/__init__.py
|
||||
b1a6689e92e6ce998337bd41d8b09d6e lib/takeover/metasploit.py
|
||||
46ff5840b29531412bcaa05dac190413 lib/takeover/metasploit.py
|
||||
fb9e34d558293b5d6b9727f440712886 lib/takeover/registry.py
|
||||
48575dde7bb867b7937769f569a98309 lib/takeover/udf.py
|
||||
4584ac6ee5c13d4d395f0a7a21d8478c lib/takeover/web.py
|
||||
79d1ba3ab7b2552c5f09992ce08e765d lib/takeover/xp_cmdshell.py
|
||||
2543e14cc7f6e239b49dd40f41bc34fa lib/techniques/blind/inference.py
|
||||
2665fa7eedb19a1b10ffe949999b75f1 lib/takeover/web.py
|
||||
f1decf0a987bd3a4bc757212cbe6a6c8 lib/takeover/xp_cmdshell.py
|
||||
4a7f231e597f754e9fcd116d13ad1a4d lib/techniques/blind/inference.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/blind/__init__.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/dns/__init__.py
|
||||
855355a1a216f6b267a5f089028f1cd8 lib/techniques/dns/test.py
|
||||
733f3419ff2ea23f75bc24e36f4746d9 lib/techniques/dns/use.py
|
||||
799faf9008527d2e9da9d923e50f685a lib/techniques/dns/test.py
|
||||
bad83c6386adf345fbc982bdafbe3b93 lib/techniques/dns/use.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/error/__init__.py
|
||||
f999f2e88dea9ac8831eb2f468478b5f lib/techniques/error/use.py
|
||||
f5fb02487edaf9adaa81d54324c84f8f lib/techniques/error/use.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/__init__.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/union/__init__.py
|
||||
36c49359a110fe0f797b2eb9e2d694ed lib/techniques/union/test.py
|
||||
94d7a22bb6725a91e84ba2cd9973e96d lib/techniques/union/test.py
|
||||
11ecf2effbe9f40b361843d546c3c521 lib/techniques/union/use.py
|
||||
c552f8d924d962a26f2ded250bcea3b8 lib/utils/api.py
|
||||
8d99c07416df40350ff8836d9d79ebb5 lib/utils/api.py
|
||||
37dfb641358669f62c2acedff241348b lib/utils/brute.py
|
||||
31b1e7eb489eac837db6a2bc1dcb7da7 lib/utils/crawler.py
|
||||
de9620f03231d8329ee8434884b6bacd lib/utils/deps.py
|
||||
635ed692ab141d428d0957b71b25c1aa lib/utils/getch.py
|
||||
f7af65aa47329d021e2b2cc8521b42a4 lib/utils/getch.py
|
||||
7af29f61302c8693cd6436d4b69e22d3 lib/utils/har.py
|
||||
062e4e8fc43ac54305a75ddd0d482f81 lib/utils/hashdb.py
|
||||
cc1cfe36057f1d9bbdcba1bcc03359f9 lib/utils/hash.py
|
||||
@@ -111,10 +112,10 @@ cc1cfe36057f1d9bbdcba1bcc03359f9 lib/utils/hash.py
|
||||
010d8327239d33af4ce9f25683cfc012 lib/utils/pivotdumptable.py
|
||||
5cb78b0e60fd7fd84502d62cf85d2064 lib/utils/progress.py
|
||||
0ec5cec9d93d5ffd1eaeda6e942ecadf lib/utils/purge.py
|
||||
fb6cf3415fbbf117e2dc87aae2f35993 lib/utils/search.py
|
||||
236a8d9e596602b53f8e0aa09c30c0ef lib/utils/sqlalchemy.py
|
||||
2c5a655c8e94cbe2664ee497752ac1f2 lib/utils/search.py
|
||||
571884f530796534f03c49cf3f380a4c lib/utils/sqlalchemy.py
|
||||
dcc25183c6bd85b172c87cfcbc305ab6 lib/utils/timeout.py
|
||||
3d230e342a6c8d60ac7c68c556fbba9b lib/utils/versioncheck.py
|
||||
fad14adffa8b640a15b06db955031695 lib/utils/versioncheck.py
|
||||
7348ee704485651737ddbe3538271be9 lib/utils/xrange.py
|
||||
b9d2761f47fec3d98b88311a263fd5db plugins/dbms/access/connector.py
|
||||
3f1c50a1507d1c2f69c20c706230e2e2 plugins/dbms/access/enumeration.py
|
||||
@@ -123,10 +124,10 @@ c2428c5c73d049abf4442ec1b9404a25 plugins/dbms/access/fingerprint.py
|
||||
e657b1b7a295a38ac9ce515158164f00 plugins/dbms/access/__init__.py
|
||||
77686d7c7e287d5db0a9a87f2c7d4902 plugins/dbms/access/syntax.py
|
||||
2f1d8706b51497623b2b59c07b552bdc plugins/dbms/access/takeover.py
|
||||
ead470b613e52e718a3062b63b518272 plugins/dbms/db2/connector.py
|
||||
0884e475c98701f8e698150aa122fb76 plugins/dbms/db2/enumeration.py
|
||||
8df07c2805aceb7d6fb4add40de84795 plugins/dbms/db2/connector.py
|
||||
4deeda463003ab71e7d2f34a263b5bbf plugins/dbms/db2/enumeration.py
|
||||
da9dccd1f9ec2cf1e53295125dd983a0 plugins/dbms/db2/filesystem.py
|
||||
ba492b2aaa6432b5548c5a8fa5eec435 plugins/dbms/db2/fingerprint.py
|
||||
b54dbf44590a5cbefb2b4f8e9a01a383 plugins/dbms/db2/fingerprint.py
|
||||
95b35cbd859bbced44e7f8fd84486d75 plugins/dbms/db2/__init__.py
|
||||
82d96d8fcfd565129580260040555623 plugins/dbms/db2/syntax.py
|
||||
25f0fb28e9defcab48a2e946fbb7550a plugins/dbms/db2/takeover.py
|
||||
@@ -144,7 +145,7 @@ b7d693a6f5f39fee0a65f2d7b0830c5e plugins/dbms/hsqldb/fingerprint.py
|
||||
fd369161778d6b48d7f1f7fc14dcdb5c plugins/dbms/hsqldb/__init__.py
|
||||
4673ebfdce9859718c19e8a7765da8d3 plugins/dbms/hsqldb/syntax.py
|
||||
7c0535736215ca612756cf589adb249b plugins/dbms/hsqldb/takeover.py
|
||||
9ceb9430031a26ecebe13ea49cb2a5fa plugins/dbms/informix/connector.py
|
||||
97dac442190bd4ffac3ba292e2abfd4c plugins/dbms/informix/connector.py
|
||||
c54d70e4847c6327bd3110c4d8723b04 plugins/dbms/informix/enumeration.py
|
||||
da9dccd1f9ec2cf1e53295125dd983a0 plugins/dbms/informix/filesystem.py
|
||||
35eac2f3837a72940eb50753dc4566e5 plugins/dbms/informix/fingerprint.py
|
||||
@@ -159,21 +160,21 @@ ffd26f64142226d0b1ed1d70f7f294c0 plugins/dbms/maxdb/filesystem.py
|
||||
4321d7018f5121343460ebfd83bb69be plugins/dbms/maxdb/__init__.py
|
||||
e7d44671ae26c0bcd5fe8448be070bbd plugins/dbms/maxdb/syntax.py
|
||||
bf7842bb291e2297c3c8d1023eb3e550 plugins/dbms/maxdb/takeover.py
|
||||
6439d15c1e8cdb069056c4fa725326df plugins/dbms/mssqlserver/connector.py
|
||||
decc645344bb93aca504a71ba2e4cad4 plugins/dbms/mssqlserver/connector.py
|
||||
f1f1541a54faf67440179fa521f99849 plugins/dbms/mssqlserver/enumeration.py
|
||||
177e1d55d28ed3190bc0079b8126c6be plugins/dbms/mssqlserver/filesystem.py
|
||||
51eb413ac62408965be20a812f2412c8 plugins/dbms/mssqlserver/fingerprint.py
|
||||
affef90b1442285da7e89e46603c502e plugins/dbms/mssqlserver/__init__.py
|
||||
08914da79141713bd69a25c3cc7f06a8 plugins/dbms/mssqlserver/fingerprint.py
|
||||
f25c50a95e5390ecd32be5a011637349 plugins/dbms/mssqlserver/__init__.py
|
||||
612be1929108e7b4512a49a4a3837bbc plugins/dbms/mssqlserver/syntax.py
|
||||
08fe8ac7acdfc0e3168b5b069a7c73bf plugins/dbms/mssqlserver/takeover.py
|
||||
3c0845fa526e1bb7bbe636fcfcbcc4a6 plugins/dbms/mssqlserver/takeover.py
|
||||
f6e1f3f09f32b9cb2ca11c016d373423 plugins/dbms/mysql/connector.py
|
||||
445164daf59b890aeacc968af58fcb53 plugins/dbms/mysql/enumeration.py
|
||||
f36e09edc3eafedd989fbe44ec048e71 plugins/dbms/mysql/filesystem.py
|
||||
4578fa29f04d0a75499f9668466ded07 plugins/dbms/mysql/filesystem.py
|
||||
fcbf7ff279c527b4aca0dac94c28d20c plugins/dbms/mysql/fingerprint.py
|
||||
30065993f8300994e4658634121609e9 plugins/dbms/mysql/__init__.py
|
||||
0e2adbee217f5b94dcc124d24b8dde99 plugins/dbms/mysql/syntax.py
|
||||
403591e638b6bfdb840d52bd3138ee56 plugins/dbms/mysql/takeover.py
|
||||
999cb8d0d52820d30bdd4b3d658a765d plugins/dbms/oracle/connector.py
|
||||
f772070dba85976a7894dac5046b93ea plugins/dbms/oracle/connector.py
|
||||
e1ffee36fd18f33f34bb4bac4ae43f14 plugins/dbms/oracle/enumeration.py
|
||||
c326b0d8bed92be67888b0242f565ac8 plugins/dbms/oracle/filesystem.py
|
||||
e16cbf8abda91a906ca7bafb81d8866e plugins/dbms/oracle/fingerprint.py
|
||||
@@ -183,18 +184,18 @@ bcdbd9c04d7d5a911e0e31abe1a24f0f plugins/dbms/oracle/takeover.py
|
||||
f99c23db4ee6a6b8c0edbf684d360ad3 plugins/dbms/postgresql/connector.py
|
||||
7cdb821884e5f15084d1bea7f8a50574 plugins/dbms/postgresql/enumeration.py
|
||||
c8bb829d45752b98e6a03817b92e0fe5 plugins/dbms/postgresql/filesystem.py
|
||||
603d533d924498378eccba4f0f196be6 plugins/dbms/postgresql/fingerprint.py
|
||||
29560cf78211888802c6e5c8681e7d71 plugins/dbms/postgresql/fingerprint.py
|
||||
470860d3e85d11a67f2220bffaa415e7 plugins/dbms/postgresql/__init__.py
|
||||
20e6f48f496348be45f3402ebc265dbb plugins/dbms/postgresql/syntax.py
|
||||
1287acf330da86a93c8e64aff46e3b65 plugins/dbms/postgresql/takeover.py
|
||||
3009438ba259ca159c5ce9799f27dec1 plugins/dbms/sqlite/connector.py
|
||||
80a2083a4fb7809d310c3d5ecc94e3c5 plugins/dbms/sqlite/connector.py
|
||||
5194556e6b1575b1349f8ccfd773952b plugins/dbms/sqlite/enumeration.py
|
||||
90fa97b84998a01dba7cc8c3329a1223 plugins/dbms/sqlite/filesystem.py
|
||||
ed52c198f3346ceabdef676e9f5d3c0f plugins/dbms/sqlite/fingerprint.py
|
||||
f639120d42b33b6ca67930bddbf2ac1f plugins/dbms/sqlite/__init__.py
|
||||
964e59d2eba619b068b0a15cea28efe0 plugins/dbms/sqlite/syntax.py
|
||||
3364b2938d7040c507cd622c323557dc plugins/dbms/sqlite/takeover.py
|
||||
6439d15c1e8cdb069056c4fa725326df plugins/dbms/sybase/connector.py
|
||||
9e64e67291a4c369bad8b8cf2cfa722a plugins/dbms/sybase/connector.py
|
||||
426698152f63504061e5875e64957691 plugins/dbms/sybase/enumeration.py
|
||||
74de450dd6d6d006aa9c7eed56e6b09a plugins/dbms/sybase/filesystem.py
|
||||
c8ee0deaa2309e96d9a409ff1524f3ad plugins/dbms/sybase/fingerprint.py
|
||||
@@ -203,8 +204,8 @@ a3db8618eed5bb2807b6f77605cba9cc plugins/dbms/sybase/__init__.py
|
||||
79f6c7017db4ded8f74a0117188836ff plugins/dbms/sybase/takeover.py
|
||||
34d181a7086d6dfc7e72ae5f8a4cfe0f plugins/generic/connector.py
|
||||
e6cd1c5a5244d83396b401f7db43d323 plugins/generic/custom.py
|
||||
dc07665887191ac977e5377f5a66d288 plugins/generic/databases.py
|
||||
a9c8637f0526d751cd1a6a18f91967f5 plugins/generic/entries.py
|
||||
156c227dbe765da3d0fd2976fbe18d8b plugins/generic/databases.py
|
||||
4e2b366bb9cfdaaed719b219913357c6 plugins/generic/entries.py
|
||||
d82f2c78c1d4d7c6487e94fd3a68a908 plugins/generic/enumeration.py
|
||||
0c8abe66a78edca0660bfb8049d109e2 plugins/generic/filesystem.py
|
||||
f5d5419efddfe04648ea5e953c650793 plugins/generic/fingerprint.py
|
||||
@@ -224,7 +225,8 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_
|
||||
0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_
|
||||
2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_
|
||||
4eaeef94314956e4517e5310a28d579a sqlmapapi.py
|
||||
ecbd0edbb6ea4cb6e1277ceb294d7819 sqlmap.py
|
||||
5c8583dd47f92935ceb41210a10eeebf sqlmap.py
|
||||
b2c2cc55ba4e31bea94494dcafe5d8cc tamper/0x2char.py
|
||||
4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py
|
||||
4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py
|
||||
d7e9a979eff4d7315d804a181e66fc93 tamper/appendnullbyte.py
|
||||
@@ -355,7 +357,7 @@ ff80a22ee858f5331b0c088efa98b3ff thirdparty/prettyprint/prettyprint.py
|
||||
5c70f8e5f7353aedc6d8d21d4fb72b37 thirdparty/pydes/__init__.py
|
||||
a7f735641c5b695f3d6220fe7c91b030 thirdparty/pydes/pyDes.py
|
||||
d41d8cd98f00b204e9800998ecf8427e thirdparty/socks/__init__.py
|
||||
74fcae36f5a2cc440c1717ae8e3f64c4 thirdparty/socks/socks.py
|
||||
afd97f26bffa0532ee4eb4f5f8ec1ab7 thirdparty/socks/socks.py
|
||||
d41d8cd98f00b204e9800998ecf8427e thirdparty/termcolor/__init__.py
|
||||
ea649aae139d8551af513769dd913dbf thirdparty/termcolor/termcolor.py
|
||||
bf55909ad163b58236e44b86e8441b26 thirdparty/wininetpton/__init__.py
|
||||
@@ -416,7 +418,7 @@ eb56ac34775cc3c5f721ec967d04b283 waf/generic.py
|
||||
5a5c9452b9779bf39c208ebe26c98fdb waf/jiasule.py
|
||||
898f53c12133da3e946301f4aa97d538 waf/knownsec.py
|
||||
81e6bf619c7bb73c4b62e2439e60e95a waf/kona.py
|
||||
4906ab7bea7f6715f5796933f1a89381 waf/modsecurity.py
|
||||
b17a154fe7959619eaafffa60e14199f waf/modsecurity.py
|
||||
d09a50713daf3c0a2594ed4f50c57adb waf/naxsi.py
|
||||
bf573d01d56e585f4ad57132bc594934 waf/netcontinuum.py
|
||||
cb2f1516867684042f580e02138463de waf/netscaler.py
|
||||
@@ -450,14 +452,14 @@ a687449cd4e45f69e33b13d41e021480 waf/uspses.py
|
||||
68e332530fab216d017ede506c3fec2f waf/yundun.py
|
||||
bea35ba732ccc9548e6c4023cea6832b waf/yunsuo.py
|
||||
705ac8663513c12150cb5623ef4a04fb waf/zenedge.py
|
||||
e87d59af23b7b18cd56c9883e5f02d5c xml/banner/generic.xml
|
||||
dc394c5b90ada0a5d5853b5ad1f7d56d xml/banner/generic.xml
|
||||
d8925c034263bf1b83e7d8e1c78eec57 xml/banner/mssql.xml
|
||||
b8b56f4aa34bf65365808919b97119a7 xml/banner/mysql.xml
|
||||
7b21aeb3ad66d7686eacd23a6346292c xml/banner/mysql.xml
|
||||
9b262a617b06af56b1267987d694bf6f xml/banner/oracle.xml
|
||||
d90fe5a47b95dff3eb1797764c9db6c5 xml/banner/postgresql.xml
|
||||
b07b5c47c751787e136650ded060197f xml/banner/server.xml
|
||||
c26cd4fa986ddc9f6d92dd87c8fc61cb xml/banner/postgresql.xml
|
||||
4970709ca31bcaea5eb79547a132606a xml/banner/server.xml
|
||||
d48c971769c6131e35bd52d2315a8d58 xml/banner/servlet-engine.xml
|
||||
2d53fdaca0d7b42edad5192661248d76 xml/banner/set-cookie.xml
|
||||
58be20a3b29a9108d043786907700469 xml/banner/set-cookie.xml
|
||||
d989813ee377252bca2103cea524c06b xml/banner/sharepoint.xml
|
||||
350605448f049cd982554123a75f11e1 xml/banner/x-aspnet-version.xml
|
||||
817078783e1edaa492773d3b34d8eef0 xml/banner/x-powered-by.xml
|
||||
@@ -470,4 +472,4 @@ b5b8b0aebce810e6cdda1b7106c96427 xml/payloads/error_based.xml
|
||||
3194e2688a7576e1f877d5b137f7c260 xml/payloads/stacked_queries.xml
|
||||
c2d8dd03db5a663e79eabb4495dd0723 xml/payloads/time_blind.xml
|
||||
ac649aff0e7db413e4937e446e398736 xml/payloads/union_query.xml
|
||||
775ed5c7e1340f76f17f6186abbd8c92 xml/queries.xml
|
||||
a5eecbca03800851635817e0ca832a92 xml/queries.xml
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ def detect(get_page):
|
||||
for vector in WAF_ATTACK_VECTORS:
|
||||
page, headers, code = get_page(get=vector)
|
||||
retval = re.search(r"Mod_Security|NOYB", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
|
||||
retval |= "This error was generated by Mod_Security" in (page or "")
|
||||
retval |= any(_ in (page or "") for _ in ("This error was generated by Mod_Security", "One or more things in your request were suspicious", "rules of the mod_security module"))
|
||||
if retval:
|
||||
break
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
<info sp="4"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Service Pack 5">
|
||||
<info sp="5"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx -->
|
||||
|
||||
<regexp value="Windows.*10\.0">
|
||||
|
||||
@@ -35,6 +35,22 @@
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" release="6.0" codename="squeeze"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="^([\d\.]+)[\-\_]Debian[\-\_][\d\.]+wheezy">
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" release="7.0" codename="wheezy"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="^([\d\.]+)[\-\_]Debian[\-\_][\d\.]+jessie">
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" release="8.0" codename="jessie"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="^([\d\.]+)[\-\_]Debian[\-\_][\d\.]+stretch">
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" release="9.0" codename="stretch"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="^([\d\.]+)[\-\_]Debian[\-\_][\d\.]+buster">
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" release="10.0" codename="buster"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="^([\d\.]+)[\-\_]Debian[\-\_][\d\.]+(sid|unstable)">
|
||||
<info dbms_version="1" type="Linux" distrib="Debian" codename="unstable"/>
|
||||
</regexp>
|
||||
|
||||
@@ -13,13 +13,4 @@
|
||||
<regexp value="mingw([\d]+)">
|
||||
<info type="Windows"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Ubuntu -->
|
||||
<regexp value="PostgreSQL\s+(8\.2\.7)\s+on.*?\(Ubuntu 4\.2\.3-2ubuntu4\)">
|
||||
<info dbms_version="1" type="Linux" distrib="Ubuntu" release="8.04" codename="Hardy Heron"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="PostgreSQL\s+(8\.3\.5)\s+on.*?\(Ubuntu 4\.3\.2-1ubuntu11\)">
|
||||
<info dbms_version="1" type="Linux" distrib="Ubuntu" release="8.10" codename="Intrepid Ibex"/>
|
||||
</regexp>
|
||||
</root>
|
||||
|
||||
+53
-3
@@ -89,6 +89,10 @@
|
||||
<info type="Linux" distrib="CentOS" release="6.8"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.6 \(CentOS\)">
|
||||
<info type="Linux" distrib="CentOS" release="7-1708"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Apache: Debian -->
|
||||
|
||||
<regexp value="Apache/1\.0\.5 \(Unix\) Debian/GNU">
|
||||
@@ -155,8 +159,8 @@
|
||||
<info type="Linux" distrib="Debian" release="8.0" codename="jessie"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.18 \(Debian\)">
|
||||
<info type="Linux" distrib="Debian" release="9.0" codename="jessie (testing)"/>
|
||||
<regexp value="Apache/2\.4\.25 \(Debian\)">
|
||||
<info type="Linux" distrib="Debian" release="9.0" codename="stretch"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Apache: Fedora -->
|
||||
@@ -273,6 +277,22 @@
|
||||
<info type="Linux" distrib="Fedora" release="23"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.18 \(Fedora\)">
|
||||
<info type="Linux" distrib="Fedora" release="24"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.23 \(Fedora\)">
|
||||
<info type="Linux" distrib="Fedora" release="25"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.25 \(Fedora\)">
|
||||
<info type="Linux" distrib="Fedora" release="26"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.28 \(Fedora\)">
|
||||
<info type="Linux" distrib="Fedora" release="27"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Apache: FreeBSD -->
|
||||
|
||||
<regexp value="Apache/2\.0\.16 \(FreeBSD\)">
|
||||
@@ -379,6 +399,14 @@
|
||||
<info type="FreeBSD" release="10.3"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.27 \(FreeBSD\)">
|
||||
<info type="FreeBSD" release="10.4"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.26 \(FreeBSD\)">
|
||||
<info type="FreeBSD" release="11.1"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Apache: Mandrake / Mandriva -->
|
||||
|
||||
<regexp value="Apache/1\.3\.6 \(Unix\)\s+\(Mandrake/Linux\)">
|
||||
@@ -678,6 +706,14 @@
|
||||
<info type="Linux" distrib="SuSE" release="13.2"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.16 \(Linux/SuSE\)">
|
||||
<info type="Linux" distrib="SuSE" release="42.1"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.23 \(Linux/SuSE\)">
|
||||
<info type="Linux" distrib="SuSE" release="42.2|42.3"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Apache: Ubuntu -->
|
||||
|
||||
<regexp value="Apache/2\.0\.50 \(Ubuntu\)">
|
||||
@@ -753,7 +789,15 @@
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.18 \(Ubuntu\)">
|
||||
<info type="Linux" distrib="Ubuntu" release="16.04" codename="xenial"/>
|
||||
<info type="Linux" distrib="Ubuntu" release="16.04|16.10" codename="xenial|yakkety"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.25 \(Ubuntu\)">
|
||||
<info type="Linux" distrib="Ubuntu" release="17.04" codename="zesty"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="Apache/2\.4\.27 \(Ubuntu\)">
|
||||
<info type="Linux" distrib="Ubuntu" release="17.10" codename="artful"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Nginx -->
|
||||
@@ -761,4 +805,10 @@
|
||||
<regexp value="nginx/([\w\.]+)">
|
||||
<info technology="Nginx"/>
|
||||
</regexp>
|
||||
|
||||
<!-- Google Web Server -->
|
||||
|
||||
<regexp value="GWS/([\w\.]+)">
|
||||
<info technology="Google Web Server"/>
|
||||
</regexp>
|
||||
</root>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<info technology="ASP" type="Windows"/>
|
||||
</regexp>
|
||||
|
||||
<regexp value="ASP\.NET_SessionId">
|
||||
<regexp value="ASP\.NET_SessionId|\.ASPXAUTH">
|
||||
<info technology="ASP.NET" type="Windows"/>
|
||||
</regexp>
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
<limitstring query=" LIMIT "/>
|
||||
<order query="ORDER BY %s ASC"/>
|
||||
<count query="COUNT(%s)"/>
|
||||
<comment query="-- " query2="/*" query3="#"/>
|
||||
<comment query="-- -" query2="/*" query3="#"/>
|
||||
<substring query="MID((%s),%d,%d)"/>
|
||||
<concatenate query="CONCAT(%s,%s)"/>
|
||||
<case query="SELECT (CASE WHEN (%s) THEN 1 ELSE 0 END)"/>
|
||||
@@ -711,7 +711,7 @@
|
||||
<inband query="SELECT table_schem FROM INFORMATION_SCHEMA.SYSTEM_SCHEMAS WHERE %s" condition="table_schem"/>
|
||||
</search_db>
|
||||
<search_table>
|
||||
<blind query="SELECT DISTINCT(table_schem) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE %s" count="SELECT COUNT(DISTINCT(table_schem)) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE %s" condition="table_name" condition2="table_schem"/>
|
||||
<blind query="SELECT DISTINCT(table_schem) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE %s" query2="SELECT DISTINCT(table_name) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE table_schem='%s'" count="SELECT COUNT(DISTINCT(table_schem)) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE %s" count2="SELECT COUNT(DISTINCT(table_name)) FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE table_schem='%s'" condition="table_name" condition2="table_schem"/>
|
||||
<inband query="SELECT table_schem,table_name FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE %s" condition="table_name" condition2="table_schem"/>
|
||||
</search_table>
|
||||
<search_column>
|
||||
|
||||
Reference in New Issue
Block a user