mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 05:01:30 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc2ace094 | ||
|
|
e1043173d7 | ||
|
|
12c472cef5 | ||
|
|
037a07ddde | ||
|
|
0e8940b0be | ||
|
|
3ad6727d0c | ||
|
|
4191b06f58 | ||
|
|
60bb973c11 | ||
|
|
0fba9b13b3 | ||
|
|
17688f6711 | ||
|
|
3b3c2a5d04 | ||
|
|
4f7614412f | ||
|
|
4efb3ea840 | ||
|
|
c2bac51c4f |
@@ -23,7 +23,7 @@ Veya tercihen, [Git](https://github.com/sqlmapproject/sqlmap) reposunu klonlayar
|
||||
|
||||
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
|
||||
|
||||
sqlmap [Python](https://www.python.org/download/) sitesinde bulunan **2.6**, **2.7** and **3.x** versiyonları ile bütün platformlarda çalışabilmektedir.
|
||||
sqlmap [Python](https://www.python.org/download/) sitesinde bulunan **2.6**, **2.7** ve **3.x** versiyonları ile bütün platformlarda çalışabilmektedir.
|
||||
|
||||
Kullanım
|
||||
----
|
||||
|
||||
@@ -1769,7 +1769,7 @@ def parseTargetUrl():
|
||||
errMsg = "invalid target URL port (%d)" % conf.port
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
conf.url = getUnicode("%s://%s:%d%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, conf.port, conf.path))
|
||||
conf.url = getUnicode("%s://%s%s%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, (":%d" % conf.port) if not (conf.port == 80 and conf.scheme == "http" or conf.port == 443 and conf.scheme == "https") else "", conf.path))
|
||||
conf.url = conf.url.replace(URI_QUESTION_MARKER, '?')
|
||||
|
||||
if urlSplit.query:
|
||||
@@ -5385,11 +5385,12 @@ def parseRequestFile(reqFile, checkParams=True):
|
||||
elif key.upper() == HTTP_HEADER.HOST.upper():
|
||||
if '://' in value:
|
||||
scheme, value = value.split('://')[:2]
|
||||
splitValue = value.split(":")
|
||||
host = splitValue[0]
|
||||
|
||||
if len(splitValue) > 1:
|
||||
port = filterStringValue(splitValue[1], "[0-9]")
|
||||
port = extractRegexResult(r":(?P<result>\d+)\Z", value)
|
||||
if port:
|
||||
value = value[:-(1 + len(port))]
|
||||
|
||||
host = value
|
||||
|
||||
# Avoid to add a static content length header to
|
||||
# headers and consider the following lines as
|
||||
|
||||
@@ -9,7 +9,6 @@ from __future__ import division
|
||||
|
||||
import binascii
|
||||
import functools
|
||||
import inspect
|
||||
import math
|
||||
import os
|
||||
import random
|
||||
@@ -313,22 +312,3 @@ def LooseVersion(version):
|
||||
result = float("NaN")
|
||||
|
||||
return result
|
||||
|
||||
# Reference: https://github.com/bottlepy/bottle/blob/df67999584a0e51ec5b691146c7fa4f3c87f5aac/bottle.py
|
||||
if not hasattr(inspect, "getargspec") and hasattr(inspect, "getfullargspec"):
|
||||
from inspect import getfullargspec
|
||||
|
||||
def makelist(data):
|
||||
if isinstance(data, (tuple, list, set, dict)):
|
||||
return list(data)
|
||||
elif data:
|
||||
return [data]
|
||||
else:
|
||||
return []
|
||||
|
||||
def getargspec(func):
|
||||
spec = getfullargspec(func)
|
||||
kwargs = makelist(spec[0]) + makelist(spec.kwonlyargs)
|
||||
return kwargs, spec[1], spec[2], spec[3]
|
||||
|
||||
inspect.getargspec = getargspec
|
||||
|
||||
@@ -6,6 +6,8 @@ See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import codecs
|
||||
import collections
|
||||
import inspect
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
@@ -93,6 +95,26 @@ def dirtyPatches():
|
||||
else:
|
||||
os.urandom = lambda size: "".join(chr(random.randint(0, 255)) for _ in xrange(size))
|
||||
|
||||
# Reference: https://github.com/bottlepy/bottle/blob/df67999584a0e51ec5b691146c7fa4f3c87f5aac/bottle.py
|
||||
# Reference: https://python.readthedocs.io/en/v2.7.2/library/inspect.html#inspect.getargspec
|
||||
if not hasattr(inspect, "getargspec") and hasattr(inspect, "getfullargspec"):
|
||||
ArgSpec = collections.namedtuple("ArgSpec", ("args", "varargs", "keywords", "defaults"))
|
||||
|
||||
def makelist(data):
|
||||
if isinstance(data, (tuple, list, set, dict)):
|
||||
return list(data)
|
||||
elif data:
|
||||
return [data]
|
||||
else:
|
||||
return []
|
||||
|
||||
def getargspec(func):
|
||||
spec = inspect.getfullargspec(func)
|
||||
kwargs = makelist(spec[0]) + makelist(spec.kwonlyargs)
|
||||
return ArgSpec(kwargs, spec[1], spec[2], spec[3])
|
||||
|
||||
inspect.getargspec = getargspec
|
||||
|
||||
def resolveCrossReferences():
|
||||
"""
|
||||
Place for cross-reference resolution
|
||||
|
||||
@@ -20,7 +20,7 @@ from thirdparty import six
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.7.4.0"
|
||||
VERSION = "1.7.5.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)
|
||||
|
||||
@@ -157,6 +157,7 @@ def _setRequestParams():
|
||||
conf.data = getattr(conf.data, UNENCODED_ORIGINAL_VALUE, conf.data)
|
||||
conf.data = conf.data.replace(kb.customInjectionMark, ASTERISK_MARKER)
|
||||
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*".*?)"(?<!\\")', functools.partial(process, repl=r'\g<1>%s"' % kb.customInjectionMark), conf.data)
|
||||
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*")"', functools.partial(process, repl=r'\g<1>%s"' % kb.customInjectionMark), conf.data)
|
||||
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)(-?\d[\d\.]*)\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data)
|
||||
conf.data = re.sub(r'("(?P<name>[^"]+)"\s*:\s*)((true|false|null))\b', functools.partial(process, repl=r'\g<1>\g<3>%s' % kb.customInjectionMark), conf.data)
|
||||
for match in re.finditer(r'(?P<name>[^"]+)"\s*:\s*\[([^\]]+)\]', conf.data):
|
||||
|
||||
@@ -71,7 +71,7 @@ def update():
|
||||
logger.warning(warnMsg)
|
||||
|
||||
if VERSION == getLatestRevision():
|
||||
logger.info("already at the latest revision '%s'" % getRevisionNumber())
|
||||
logger.info("already at the latest revision '%s'" % (getRevisionNumber() or VERSION))
|
||||
return
|
||||
|
||||
message = "do you want to try to fetch the latest 'zipball' from repository and extract it (experimental) ? [y/N]"
|
||||
|
||||
@@ -814,7 +814,7 @@ class Connect(object):
|
||||
debugMsg = "got HTTP error code: %d ('%s')" % (code, status)
|
||||
logger.debug(debugMsg)
|
||||
|
||||
except (_urllib.error.URLError, socket.error, socket.timeout, _http_client.HTTPException, struct.error, binascii.Error, ProxyError, SqlmapCompressionException, WebSocketException, TypeError, ValueError, OverflowError, AttributeError, OSError):
|
||||
except (_urllib.error.URLError, socket.error, socket.timeout, _http_client.HTTPException, struct.error, binascii.Error, ProxyError, SqlmapCompressionException, WebSocketException, TypeError, ValueError, OverflowError, AttributeError, OSError, AssertionError):
|
||||
tbMsg = traceback.format_exc()
|
||||
|
||||
if conf.debug:
|
||||
|
||||
@@ -27,7 +27,7 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
_protocols = filterNone(getattr(ssl, _, None) for _ in ("PROTOCOL_TLSv1_2", "PROTOCOL_TLSv1_1", "PROTOCOL_TLSv1", "PROTOCOL_SSLv3", "PROTOCOL_SSLv23", "PROTOCOL_SSLv2"))
|
||||
_protocols = filterNone(getattr(ssl, _, None) for _ in ("PROTOCOL_TLS_CLIENT", "PROTOCOL_TLSv1_2", "PROTOCOL_TLSv1_1", "PROTOCOL_TLSv1", "PROTOCOL_SSLv3", "PROTOCOL_SSLv23", "PROTOCOL_SSLv2"))
|
||||
_lut = dict((getattr(ssl, _), _) for _ in dir(ssl) if _.startswith("PROTOCOL_"))
|
||||
_contexts = {}
|
||||
|
||||
@@ -69,6 +69,11 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
||||
sock = create_sock()
|
||||
if protocol not in _contexts:
|
||||
_contexts[protocol] = ssl.SSLContext(protocol)
|
||||
|
||||
# Disable certificate and hostname validation enabled by default with PROTOCOL_TLS_CLIENT
|
||||
_contexts[protocol].check_hostname = False
|
||||
_contexts[protocol].verify_mode = ssl.CERT_NONE
|
||||
|
||||
if getattr(self, "cert_file", None) and getattr(self, "key_file", None):
|
||||
_contexts[protocol].load_cert_chain(certfile=self.cert_file, keyfile=self.key_file)
|
||||
try:
|
||||
|
||||
@@ -66,7 +66,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
|
||||
self.redirect_request = self._redirect_request
|
||||
|
||||
def _redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
return _urllib.request.Request(newurl.replace(' ', '%20'), data=req.data, headers=req.headers, origin_req_host=req.get_origin_req_host())
|
||||
return _urllib.request.Request(newurl.replace(' ', '%20'), data=req.data, headers=req.headers, origin_req_host=req.get_origin_req_host() if hasattr(req, "get_origin_req_host") else req.origin_req_host)
|
||||
|
||||
def http_error_302(self, req, fp, code, msg, headers):
|
||||
start = time.time()
|
||||
|
||||
@@ -7,7 +7,6 @@ See the file 'LICENSE' for copying permission
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import logging
|
||||
import time
|
||||
|
||||
from lib.core.common import Backend
|
||||
@@ -387,9 +386,6 @@ def fileExists(pathFile):
|
||||
kb.locks.io.release()
|
||||
|
||||
try:
|
||||
pushValue(logger.getEffectiveLevel())
|
||||
logger.setLevel(logging.CRITICAL)
|
||||
|
||||
runThreads(conf.threads, fileExistsThread, threadChoice=True)
|
||||
except KeyboardInterrupt:
|
||||
warnMsg = "user aborted during file existence "
|
||||
@@ -397,7 +393,6 @@ def fileExists(pathFile):
|
||||
logger.warning(warnMsg)
|
||||
finally:
|
||||
kb.bruteMode = False
|
||||
logger.setLevel(popValue())
|
||||
|
||||
clearConsoleLine(True)
|
||||
dataToStdout("\n")
|
||||
|
||||
@@ -222,13 +222,13 @@ class Filesystem(object):
|
||||
|
||||
if conf.direct or isStackingAvailable():
|
||||
if isStackingAvailable():
|
||||
debugMsg = "going to read the file with stacked query SQL "
|
||||
debugMsg = "going to try to read the file with stacked query SQL "
|
||||
debugMsg += "injection technique"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
fileContent = self.stackedReadFile(remoteFile)
|
||||
elif Backend.isDbms(DBMS.MYSQL):
|
||||
debugMsg = "going to read the file with a non-stacked query "
|
||||
debugMsg = "going to try to read the file with non-stacked query "
|
||||
debugMsg += "SQL injection technique"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
|
||||
@@ -472,6 +472,11 @@ def main():
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("FileNotFoundError: [Errno 2] No such file or directory", "cwd = os.getcwd()")):
|
||||
errMsg = "invalid runtime environment ('%s')" % excMsg.split("Error: ")[-1].strip()
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("PermissionError: [WinError 5]", "multiprocessing")):
|
||||
errMsg = "there is a permission problem in running multiprocessing on this system. "
|
||||
errMsg += "Please rerun with '--disable-multi'"
|
||||
@@ -548,7 +553,7 @@ def main():
|
||||
finally:
|
||||
kb.threadContinue = False
|
||||
|
||||
if getDaysFromLastUpdate() > LAST_UPDATE_NAGGING_DAYS:
|
||||
if (getDaysFromLastUpdate() or 0) > LAST_UPDATE_NAGGING_DAYS:
|
||||
warnMsg = "your sqlmap version is outdated"
|
||||
logger.warning(warnMsg)
|
||||
|
||||
|
||||
2
thirdparty/socks/socks.py
vendored
2
thirdparty/socks/socks.py
vendored
@@ -195,7 +195,7 @@ class socksocket(socket.socket):
|
||||
elif chosenauth[1:2] == chr(0x02).encode():
|
||||
# Okay, we need to perform a basic username/password
|
||||
# authentication.
|
||||
self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])
|
||||
self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])).encode() + self.__proxy[4].encode() + chr(len(self.__proxy[5])).encode() + self.__proxy[5].encode())
|
||||
authstat = self.__recvall(2)
|
||||
if authstat[0:1] != chr(0x01).encode():
|
||||
# Bad response
|
||||
|
||||
Reference in New Issue
Block a user