Compare commits

...

15 Commits

Author SHA1 Message Date
Miroslav Stampar
9c103b3dd6 Fixes #5187 2022-10-06 11:50:35 +02:00
Víctor García
7f62572f43 Add files via upload (#5189) 2022-10-06 11:32:31 +02:00
Miroslav Stampar
e846209b87 Update regarding #5092 2022-09-25 16:34:40 +02:00
Miroslav Stampar
a246b8da5e Fixes #5182 2022-09-25 16:02:48 +02:00
Miroslav Stampar
70665c5d2b Improvement regarding #5171 2022-09-13 22:59:34 +02:00
Hoomaan
111620e395 Fixing grammar issues of FA readme (#5172) 2022-09-13 22:24:22 +02:00
Miroslav Stampar
2382d2654e Fixes #5170 2022-09-06 13:00:47 +02:00
Miroslav Stampar
4cdc3af585 Fixes #5165 2022-08-26 20:34:11 +02:00
Miroslav Stampar
212f28d1ad Fixes --check-tor (reported privately) 2022-08-22 16:25:55 +02:00
Miroslav Stampar
e1f7690de4 Fixes #5162 2022-08-10 14:51:35 +02:00
Miroslav Stampar
7e425d4c9b Fixes #5154 2022-08-04 09:20:52 +02:00
Miroslav Stampar
fe2042ea58 Fixes #5152 2022-08-04 08:57:35 +02:00
Miroslav Stampar
54e953d206 Fixes #5147 2022-07-27 22:42:35 +02:00
Miroslav Stampar
8c26c67ce9 Minor patch for privately reported bug 2022-07-20 20:56:49 +02:00
Bernardo Damele A. G
c722f8e3bd Update FUNDING.yml
Updated funding information to point to sqlmap project's sponsors page
2022-07-14 09:29:51 +00:00
14 changed files with 132 additions and 36 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1 +1 @@
custom: 'https://www.paypal.com/donate?hosted_button_id=A34GMDLKA2V7G' github: sqlmapproject

View File

@@ -7,10 +7,10 @@
برنامه `sqlmap`، برنامه‌ی منبع باز هست که برای تست نفوذ پذیزی دربرابر حمله‌های احتمالی `sql injection` (جلوگیری از لو رفتن پایگاه داده) جلو گیری می‌کند. این برنامه مجهز به مکانیزیم تشخیص قدرتمندی می‌باشد. همچنین داری طیف گسترده‌ای از اسکریپت ها می‌باشد که برای متخصص تست نفوذ کار کردن با بانک اطلاعاتی را راحتر می‌کند. از جمع اوری اطلاعات درباره بانک داده تا دسترسی به داده های سیستم و اجرا دستورات از طریق `via out-of-band` درسیستم عامل را امکان پذیر می‌کند. برنامه `sqlmap`، یک برنامه‌ی تست نفوذ منبع باز است که فرآیند تشخیص و اکسپلویت پایگاه های داده با مشکل امنیتی SQL Injection را بطور خودکار انجام می دهد. این برنامه مجهز به موتور تشخیص قدرتمندی می‌باشد. همچنین داری طیف گسترده‌ای از اسکریپت ها می‌باشد که برای متخصصان تست نفوذ کار کردن با بانک اطلاعاتی را راحتر می‌کند. از جمع اوری اطلاعات درباره بانک داده تا دسترسی به داده های سیستم و اجرا دستورات از طریق ارتباط Out Of Band درسیستم عامل را امکان پذیر می‌کند.
عکس تصویر محیط ابزار
---- ----
@@ -23,7 +23,7 @@
<div dir=rtl> <div dir=rtl>
برای دیدن کردن از [مجموعهی از اسکریپت‌ها](https://github.com/sqlmapproject/sqlmap/wiki/Screenshots) می‌توانید از ویکی دیدن کنید. برای نمایش [مجموعه ای از اسکریپت‌ها](https://github.com/sqlmapproject/sqlmap/wiki/Screenshots) می‌توانید از دانشنامه دیدن کنید.
نصب نصب
@@ -32,11 +32,11 @@
برای دانلود اخرین نسخه tarball، با کلیک در [اینجا](https://github.com/sqlmapproject/sqlmap/tarball/master) یا دانلود اخرین نسخه zipball با کلیک در [اینجا](https://github.com/sqlmapproject/sqlmap/zipball/master) میتوانید این کار را انجام دهید. برای دانلود اخرین نسخه tarball، با کلیک در [اینجا](https://github.com/sqlmapproject/sqlmap/tarball/master) یا دانلود اخرین نسخه zipball با کلیک در [اینجا](https://github.com/sqlmapproject/sqlmap/zipball/master) میتوانید این کار را انجام دهید.
طرز استفاده نحوه استفاده
---- ----
برای گرفتن لیست ارگومان‌های اساسی می‌توانید از دستور زیر استفاده کنید: برای دریافت لیست ارگومان‌های اساسی می‌توانید از دستور زیر استفاده کنید:
@@ -53,7 +53,7 @@
<div dir=rtl> <div dir=rtl>
برای گرفتن لیست تمامی ارگومان‌های می‌توانید از دستور زیر استفاده کنید: برای دریافت لیست تمامی ارگومان‌ها می‌توانید از دستور زیر استفاده کنید:
<div dir=ltr> <div dir=ltr>
@@ -66,7 +66,7 @@
<div dir=rtl> <div dir=rtl>
برای اطلاعات بیشتر برای اجرا از [اینجا](https://asciinema.org/a/46601) می‌توانید استفاده کنید. برای گرفتن اطلاعات بیشتر توسعه می‌شود به [راهنمای](https://github.com/sqlmapproject/sqlmap/wiki/Usage) `sqlmap` سر بزنید. برای اجرای سریع و ساده ابزار می توانید از [اینجا](https://asciinema.org/a/46601) استفاده کنید. برای دریافت اطلاعات بیشتر در رابطه با قابلیت ها ، امکانات قابل پشتیبانی و لیست کامل امکانات و دستورات همراه با مثال می‌ توانید به [راهنمای](https://github.com/sqlmapproject/sqlmap/wiki/Usage) `sqlmap` سر بزنید.
لینک‌ها لینک‌ها
@@ -74,11 +74,11 @@
* خانه: https://sqlmap.org * خانه: https://sqlmap.org
* دانلود: [.tar.gz](https://github.com/sqlmapproject/sqlmap/tarball/master) or [.zip](https://github.com/sqlmapproject/sqlmap/zipball/master) * دانلود: [.tar.gz](https://github.com/sqlmapproject/sqlmap/tarball/master) یا [.zip](https://github.com/sqlmapproject/sqlmap/zipball/master)
* کایمت و نظرات: https://github.com/sqlmapproject/sqlmap/commits/master.atom * نظرات: https://github.com/sqlmapproject/sqlmap/commits/master.atom
* پیگری مشکلات: https://github.com/sqlmapproject/sqlmap/issues * پیگیری مشکلات: https://github.com/sqlmapproject/sqlmap/issues
* راهنمای کاربران: https://github.com/sqlmapproject/sqlmap/wiki * راهنمای کاربران: https://github.com/sqlmapproject/sqlmap/wiki
* سوالات متداول: https://github.com/sqlmapproject/sqlmap/wiki/FAQ * سوالات متداول: https://github.com/sqlmapproject/sqlmap/wiki/FAQ
* تویتر: [@sqlmap](https://twitter.com/sqlmap) * توییتر: [@sqlmap](https://twitter.com/sqlmap)
* رسانه: [https://www.youtube.com/user/inquisb/videos](https://www.youtube.com/user/inquisb/videos) * رسانه: [https://www.youtube.com/user/inquisb/videos](https://www.youtube.com/user/inquisb/videos)
* عکس‌ها: https://github.com/sqlmapproject/sqlmap/wiki/Screenshots * تصاویر: https://github.com/sqlmapproject/sqlmap/wiki/Screenshots

View File

@@ -271,15 +271,18 @@ def checkSqlInjection(place, parameter, value):
logger.debug(debugMsg) logger.debug(debugMsg)
continue continue
if kb.dbmsFilter and not intersect(payloadDbms, kb.dbmsFilter, True): elif kb.dbmsFilter and not intersect(payloadDbms, kb.dbmsFilter, True):
debugMsg = "skipping test '%s' because " % title debugMsg = "skipping test '%s' because " % title
debugMsg += "its declared DBMS is different than provided" debugMsg += "its declared DBMS is different than provided"
logger.debug(debugMsg) logger.debug(debugMsg)
continue continue
elif kb.reduceTests == False:
pass
# Skip DBMS-specific test if it does not match the # Skip DBMS-specific test if it does not match the
# previously identified DBMS (via DBMS-specific payload) # previously identified DBMS (via DBMS-specific payload)
if injection.dbms and not intersect(payloadDbms, injection.dbms, True): elif injection.dbms and not intersect(payloadDbms, injection.dbms, True):
debugMsg = "skipping test '%s' because " % title debugMsg = "skipping test '%s' because " % title
debugMsg += "its declared DBMS is different than identified" debugMsg += "its declared DBMS is different than identified"
logger.debug(debugMsg) logger.debug(debugMsg)
@@ -287,7 +290,7 @@ def checkSqlInjection(place, parameter, value):
# Skip DBMS-specific test if it does not match the # Skip DBMS-specific test if it does not match the
# previously identified DBMS (via DBMS-specific error message) # previously identified DBMS (via DBMS-specific error message)
if kb.reduceTests and not intersect(payloadDbms, kb.reduceTests, True): elif kb.reduceTests and not intersect(payloadDbms, kb.reduceTests, True):
debugMsg = "skipping test '%s' because the heuristic " % title debugMsg = "skipping test '%s' because the heuristic " % title
debugMsg += "tests showed that the back-end DBMS " debugMsg += "tests showed that the back-end DBMS "
debugMsg += "could be '%s'" % unArrayizeValue(kb.reduceTests) debugMsg += "could be '%s'" % unArrayizeValue(kb.reduceTests)

View File

@@ -196,9 +196,9 @@ class Agent(object):
if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER): if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER):
_ = "%s%s" % (origValue, kb.customInjectionMark) _ = "%s%s" % (origValue, kb.customInjectionMark)
if kb.postHint == POST_HINT.JSON and not isNumber(newValue) and '"%s"' % _ not in paramString: if kb.postHint == POST_HINT.JSON and isNumber(origValue) and not isNumber(newValue) and '"%s"' % _ not in paramString:
newValue = '"%s"' % self.addPayloadDelimiters(newValue) newValue = '"%s"' % self.addPayloadDelimiters(newValue)
elif kb.postHint == POST_HINT.JSON_LIKE and not isNumber(newValue) and re.search(r"['\"]%s['\"]" % re.escape(_), paramString) is None: elif kb.postHint == POST_HINT.JSON_LIKE and isNumber(origValue) and not isNumber(newValue) and re.search(r"['\"]%s['\"]" % re.escape(_), paramString) is None:
newValue = "'%s'" % self.addPayloadDelimiters(newValue) newValue = "'%s'" % self.addPayloadDelimiters(newValue)
else: else:
newValue = self.addPayloadDelimiters(newValue) newValue = self.addPayloadDelimiters(newValue)

View File

@@ -3708,7 +3708,7 @@ def getSortedInjectionTests():
if test.stype == PAYLOAD.TECHNIQUE.UNION: if test.stype == PAYLOAD.TECHNIQUE.UNION:
retVal = SORT_ORDER.LAST retVal = SORT_ORDER.LAST
elif "details" in test and "dbms" in test.details: elif "details" in test and "dbms" in (test.details or {}):
if intersect(test.details.dbms, Backend.getIdentifiedDbms()): if intersect(test.details.dbms, Backend.getIdentifiedDbms()):
retVal = SORT_ORDER.SECOND retVal = SORT_ORDER.SECOND
else: else:
@@ -4693,7 +4693,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
else: else:
url = urldecode(request.get_full_url(), kb.pageEncoding) url = urldecode(request.get_full_url(), kb.pageEncoding)
method = request.get_method() method = request.get_method()
data = request.data data = unArrayizeValue(request.data)
data = urldecode(data, kb.pageEncoding, spaceplus=False) data = urldecode(data, kb.pageEncoding, spaceplus=False)
if not data and method and method.upper() == HTTPMETHOD.POST: if not data and method and method.upper() == HTTPMETHOD.POST:

View File

@@ -2045,6 +2045,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.delayCandidates = TIME_DELAY_CANDIDATES * [0] kb.delayCandidates = TIME_DELAY_CANDIDATES * [0]
kb.dep = None kb.dep = None
kb.disableHtmlDecoding = False kb.disableHtmlDecoding = False
kb.disableShiftTable = False
kb.dnsMode = False kb.dnsMode = False
kb.dnsTest = None kb.dnsTest = None
kb.docRoot = None kb.docRoot = None

View File

@@ -20,7 +20,7 @@ from thirdparty import six
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.6.7.0" VERSION = "1.6.10.0"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@@ -120,7 +120,10 @@ def _setRequestParams():
while True: while True:
_ = re.search(r"\\g<([^>]+)>", retVal) _ = re.search(r"\\g<([^>]+)>", retVal)
if _: if _:
retVal = retVal.replace(_.group(0), match.group(int(_.group(1)) if _.group(1).isdigit() else _.group(1))) try:
retVal = retVal.replace(_.group(0), match.group(int(_.group(1)) if _.group(1).isdigit() else _.group(1)))
except IndexError:
break
else: else:
break break
if kb.customInjectionMark in retVal: if kb.customInjectionMark in retVal:

View File

@@ -161,8 +161,12 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
infoMsg = "starting %d threads" % numThreads infoMsg = "starting %d threads" % numThreads
logger.info(infoMsg) logger.info(infoMsg)
else: else:
_threadFunction() try:
return _threadFunction()
except (SqlmapUserQuitException, SqlmapSkipTargetException):
pass
finally:
return
kb.multiThreadMode = True kb.multiThreadMode = True

View File

@@ -501,6 +501,9 @@ class Connect(object):
headers[HTTP_HEADER.HOST] = "localhost" headers[HTTP_HEADER.HOST] = "localhost"
for key, value in list(headers.items()): for key, value in list(headers.items()):
if key.upper() == HTTP_HEADER.ACCEPT_ENCODING.upper():
value = re.sub(r"(?i)(,)br(,)?", lambda match: ',' if match.group(1) and match.group(2) else "", value) or "identity"
del headers[key] del headers[key]
if isinstance(value, six.string_types): if isinstance(value, six.string_types):
for char in (r"\r", r"\n"): for char in (r"\r", r"\n"):
@@ -584,8 +587,14 @@ class Connect(object):
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj: if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
conf.cj._policy._now = conf.cj._now = int(time.time()) conf.cj._policy._now = conf.cj._now = int(time.time())
cookies = conf.cj._cookies_for_request(req) while True:
requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies)) try:
cookies = conf.cj._cookies_for_request(req)
except RuntimeError: # NOTE: https://github.com/sqlmapproject/sqlmap/issues/5187
time.sleep(1)
else:
requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies))
break
if post is not None: if post is not None:
if not getRequestHeader(req, HTTP_HEADER.CONTENT_LENGTH) and not chunked: if not getRequestHeader(req, HTTP_HEADER.CONTENT_LENGTH) and not chunked:
@@ -1008,9 +1017,10 @@ class Connect(object):
if (kb.postHint or conf.skipUrlEncode) and postUrlEncode: if (kb.postHint or conf.skipUrlEncode) and postUrlEncode:
postUrlEncode = False postUrlEncode = False
conf.httpHeaders = [_ for _ in conf.httpHeaders if _[1] != contentType] if not (conf.skipUrlEncode and contentType): # NOTE: https://github.com/sqlmapproject/sqlmap/issues/5092
contentType = POST_HINT_CONTENT_TYPES.get(kb.postHint, PLAIN_TEXT_CONTENT_TYPE) conf.httpHeaders = [_ for _ in conf.httpHeaders if _[1] != contentType]
conf.httpHeaders.append((HTTP_HEADER.CONTENT_TYPE, contentType)) contentType = POST_HINT_CONTENT_TYPES.get(kb.postHint, PLAIN_TEXT_CONTENT_TYPE)
conf.httpHeaders.append((HTTP_HEADER.CONTENT_TYPE, contentType))
if payload: if payload:
delimiter = conf.paramDel or (DEFAULT_GET_POST_DELIMITER if place != PLACE.COOKIE else DEFAULT_COOKIE_DELIMITER) delimiter = conf.paramDel or (DEFAULT_GET_POST_DELIMITER if place != PLACE.COOKIE else DEFAULT_COOKIE_DELIMITER)
@@ -1541,7 +1551,10 @@ class Connect(object):
if payload is None: if payload is None:
value = value.replace(kb.customInjectionMark, "") value = value.replace(kb.customInjectionMark, "")
else: else:
value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), payload, value) try:
value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), payload, value)
except re.error:
value = re.sub(r"\w*%s" % re.escape(kb.customInjectionMark), re.escape(payload), value)
return value return value
page, headers, code = Connect.getPage(url=_(kb.secondReq[0]), post=_(kb.secondReq[2]), method=kb.secondReq[1], cookie=kb.secondReq[3], silent=silent, auxHeaders=dict(auxHeaders, **dict(kb.secondReq[4])), response=response, raise404=False, ignoreTimeout=timeBasedCompare, refreshing=True) page, headers, code = Connect.getPage(url=_(kb.secondReq[0]), post=_(kb.secondReq[2]), method=kb.secondReq[1], cookie=kb.secondReq[3], silent=silent, auxHeaders=dict(auxHeaders, **dict(kb.secondReq[4])), response=response, raise404=False, ignoreTimeout=timeBasedCompare, refreshing=True)

View File

@@ -36,6 +36,8 @@ class HTTPSConnection(_http_client.HTTPSConnection):
Connection class that enables usage of newer SSL protocols. Connection class that enables usage of newer SSL protocols.
Reference: http://bugs.python.org/msg128686 Reference: http://bugs.python.org/msg128686
NOTE: use https://check-tls.akamaized.net/ to check if (e.g.) TLS/SNI is working properly
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@@ -61,7 +63,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext # Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni # https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
if re.search(r"\A[\d.]+\Z", conf.hostname or "") is None and kb.tlsSNI.get(conf.hostname) is not False and hasattr(ssl, "SSLContext"): if re.search(r"\A[\d.]+\Z", self.host or "") is None and kb.tlsSNI.get(self.host) is not False and hasattr(ssl, "SSLContext"):
for protocol in (_ for _ in _protocols if _ >= ssl.PROTOCOL_TLSv1): for protocol in (_ for _ in _protocols if _ >= ssl.PROTOCOL_TLSv1):
try: try:
sock = create_sock() sock = create_sock()
@@ -73,7 +75,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
_contexts[protocol].set_ciphers("DEFAULT@SECLEVEL=1") _contexts[protocol].set_ciphers("DEFAULT@SECLEVEL=1")
except ssl.SSLError: except ssl.SSLError:
pass pass
result = _contexts[protocol].wrap_socket(sock, do_handshake_on_connect=True, server_hostname=conf.hostname) result = _contexts[protocol].wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host)
if result: if result:
success = True success = True
self.sock = result self.sock = result
@@ -86,8 +88,8 @@ class HTTPSConnection(_http_client.HTTPSConnection):
self._tunnel_host = None self._tunnel_host = None
logger.debug("SSL connection error occurred for '%s' ('%s')" % (_lut[protocol], getSafeExString(ex))) logger.debug("SSL connection error occurred for '%s' ('%s')" % (_lut[protocol], getSafeExString(ex)))
if kb.tlsSNI.get(conf.hostname) is None: if kb.tlsSNI.get(self.host) is None:
kb.tlsSNI[conf.hostname] = success kb.tlsSNI[self.host] = success
if not success: if not success:
for protocol in _protocols: for protocol in _protocols:

View File

@@ -274,9 +274,11 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
originalTbl = type(charTbl)(charTbl) originalTbl = type(charTbl)(charTbl)
if continuousOrder and shiftTable is None: if kb.disableShiftTable:
shiftTable = None
elif continuousOrder and shiftTable is None:
# Used for gradual expanding into unicode charspace # Used for gradual expanding into unicode charspace
shiftTable = [2, 2, 3, 3, 5, 4] shiftTable = [2, 2, 3, 3, 3]
if "'%s'" % CHAR_INFERENCE_MARK in payload: if "'%s'" % CHAR_INFERENCE_MARK in payload:
for char in ('\n', '\r'): for char in ('\n', '\r'):
@@ -358,6 +360,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
kb.responseTimePayload = None kb.responseTimePayload = None
result = Request.queryPage(forgedPayload, timeBasedCompare=timeBasedCompare, raise404=False) result = Request.queryPage(forgedPayload, timeBasedCompare=timeBasedCompare, raise404=False)
incrementCounter(getTechnique()) incrementCounter(getTechnique())
if not timeBasedCompare and getTechniqueData() is not None: if not timeBasedCompare and getTechniqueData() is not None:
@@ -405,6 +408,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
maxChar = maxValue = charTbl[-1] maxChar = maxValue = charTbl[-1]
minValue = charTbl[0] minValue = charTbl[0]
else: else:
kb.disableShiftTable = True
return None return None
else: else:
retVal = minValue + 1 retVal = minValue + 1

33
tamper/decentities.py Normal file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python
"""
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
"""
HTML encode in decimal (using code points) all characters (e.g. ' -> &#39;)
>>> tamper("1' AND SLEEP(5)#")
'&#49;&#39;&#32;&#65;&#78;&#68;&#32;&#83;&#76;&#69;&#69;&#80;&#40;&#53;&#41;&#35;'
"""
retVal = payload
if payload:
retVal = ""
i = 0
while i < len(payload):
retVal += "&#%s;" % ord(payload[i])
i += 1
return retVal

33
tamper/hexentities.py Normal file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python
"""
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
"""
HTML encode in hexadecimal (using code points) all characters (e.g. ' -> &#x31;)
>>> tamper("1' AND SLEEP(5)#")
'&#x31;&#x27;&#x20;&#x41;&#x4e;&#x44;&#x20;&#x53;&#x4c;&#x45;&#x45;&#x50;&#x28;&#x35;&#x29;&#x23;'
"""
retVal = payload
if payload:
retVal = ""
i = 0
while i < len(payload):
retVal += "&#x%s;" % format(ord(payload[i]), "x")
i += 1
return retVal