Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 285482b

Browse files
committed
Couple of drei patches
1 parent 4d028c7 commit 285482b

14 files changed

Lines changed: 20 additions & 15 deletions

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty import six
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.41"
21+
VERSION = "1.3.5.42"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ class _(dict):
803803
responseMsg += "[#%d] (%s %s):\r\n" % (threadData.lastRequestUID, code, status)
804804

805805
if responseHeaders:
806-
logHeaders = getUnicode("".join(responseHeaders.headers).strip() if six.PY2 else responseHeaders.__bytes__())
806+
logHeaders = getUnicode("".join(responseHeaders.headers).strip())
807807

808808
logHTTPTraffic(requestMsg, "%s%s\r\n\r\n%s" % (responseMsg, logHeaders, (page or "")[:MAX_CONNECTION_CHUNK_SIZE]), start, time.time())
809809

lib/utils/purge.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import functools
89
import os
910
import random
1011
import shutil
@@ -14,6 +15,7 @@
1415
from lib.core.common import getSafeExString
1516
from lib.core.compat import xrange
1617
from lib.core.data import logger
18+
from thirdparty import six
1719

1820
def purge(directory):
1921
"""
@@ -66,7 +68,10 @@ def purge(directory):
6668
except:
6769
pass
6870

69-
dirpaths.sort(cmp=lambda x, y: y.count(os.path.sep) - x.count(os.path.sep))
71+
if six.PY2:
72+
dirpaths.sort(cmp=lambda x, y: y.count(os.path.sep) - x.count(os.path.sep))
73+
else:
74+
dirpaths.sort(key=functools.cmp_to_key(lambda x, y: y.count(os.path.sep) - x.count(os.path.sep)))
7075

7176
logger.debug("renaming directory names to random values")
7277
for dirpath in dirpaths:

waf/chinacache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def detect(get_page):
1414

1515
for vector in WAF_ATTACK_VECTORS:
1616
page, headers, code = get_page(get=vector)
17-
retval |= code >= 400 and headers.get("Powered-By-ChinaCache") is not None
17+
retval |= (code or 0) >= 400 and headers.get("Powered-By-ChinaCache") is not None
1818

1919
if retval:
2020
break

waf/cloudbric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def detect(get_page):
1414

1515
for vector in WAF_ATTACK_VECTORS:
1616
page, headers, code = get_page(get=vector)
17-
retval |= code >= 400 and all(_ in (page or "") for _ in ("Cloudbric", "Malicious Code Detected"))
17+
retval |= (code or 0) >= 400 and all(_ in (page or "") for _ in ("Cloudbric", "Malicious Code Detected"))
1818
if retval:
1919
break
2020

waf/cloudflare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def detect(get_page):
1818
for vector in WAF_ATTACK_VECTORS:
1919
page, headers, code = get_page(get=vector)
2020

21-
if code >= 400:
21+
if (code or 0) >= 400:
2222
retval |= re.search(r"cloudflare", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
2323
retval |= re.search(r"\A__cfduid=", headers.get(HTTP_HEADER.SET_COOKIE, ""), re.I) is not None
2424
retval |= headers.get("cf-ray") is not None

waf/crawlprotect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def detect(get_page):
1414

1515
for vector in WAF_ATTACK_VECTORS:
1616
page, _, code = get_page(get=vector)
17-
retval |= code >= 400 and "This site is protected by CrawlProtect" in (page or "")
17+
retval |= (code or 0) >= 400 and "This site is protected by CrawlProtect" in (page or "")
1818
retval |= "<title>CrawlProtect" in (page or "")
1919
if retval:
2020
break

waf/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def detect(get_page):
1919
retval = False
2020

2121
original, _, code = get_page()
22-
if original is None or code >= 400:
22+
if original is None or (code or 0) >= 400:
2323
return False
2424

2525
for vector in WAF_ATTACK_VECTORS:
2626
page, headers, code = get_page(get=vector)
2727

28-
if code >= 400 or (IPS_WAF_CHECK_PAYLOAD in vector and (code is None or re.search(GENERIC_PROTECTION_REGEX, page or "") and not re.search(GENERIC_PROTECTION_REGEX, original or ""))):
28+
if (code or 0) >= 400 or (IPS_WAF_CHECK_PAYLOAD in vector and (code is None or re.search(GENERIC_PROTECTION_REGEX, page or "") and not re.search(GENERIC_PROTECTION_REGEX, original or ""))):
2929
if code is not None:
3030
kb.wafSpecificResponse = "HTTP/1.1 %s\n%s\n%s" % (code, "".join(getUnicode(_) for _ in (headers.headers if headers else {}) or [] if not _.startswith("URI")), getUnicode(page or ""))
3131

waf/kona.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def detect(get_page):
1717

1818
for vector in WAF_ATTACK_VECTORS:
1919
page, headers, code = get_page(get=vector)
20-
retval |= code >= 400 and re.search(r"AkamaiGHost", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
20+
retval |= (code or 0) >= 400 and re.search(r"AkamaiGHost", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
2121
if retval:
2222
break
2323

waf/secureentry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def detect(get_page):
1717

1818
for vector in WAF_ATTACK_VECTORS:
1919
page, headers, code = get_page(get=vector)
20-
retval |= code >= 400 and re.search(r"Secure Entry Server", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
20+
retval |= (code or 0) >= 400 and re.search(r"Secure Entry Server", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
2121
if retval:
2222
break
2323

0 commit comments

Comments
 (0)