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

Skip to content

Commit 6b1f496

Browse files
committed
Fixes #4082
1 parent e8be9e4 commit 6b1f496

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

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.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.1.39"
21+
VERSION = "1.4.1.40"
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/dns.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717

1818
class DNSQuery(object):
1919
"""
20-
Used for making fake DNS resolution responses based on received
21-
raw request
22-
23-
Reference(s):
24-
http://code.activestate.com/recipes/491264-mini-fake-dns-server/
25-
https://code.google.com/p/marlon-tools/source/browse/tools/dnsproxy/dnsproxy.py
26-
2720
>>> DNSQuery(b'|K\\x01 \\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x01\\x03www\\x06google\\x03com\\x00\\x00\\x01\\x00\\x01\\x00\\x00)\\x10\\x00\\x00\\x00\\x00\\x00\\x00\\x0c\\x00\\n\\x00\\x08O4|Np!\\x1d\\xb3')._query == b"www.google.com."
2821
True
2922
"""
@@ -32,9 +25,9 @@ def __init__(self, raw):
3225
self._raw = raw
3326
self._query = b""
3427

35-
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
28+
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
3629

37-
if type_ == 0: # Standard query
30+
if type_ == 0: # Standard query
3831
i = 12
3932
j = ord(raw[i:i + 1])
4033

@@ -65,6 +58,15 @@ def response(self, resolution):
6558
return retVal
6659

6760
class DNSServer(object):
61+
"""
62+
Used for making fake DNS resolution responses based on received
63+
raw request
64+
65+
Reference(s):
66+
http://code.activestate.com/recipes/491264-mini-fake-dns-server/
67+
https://code.google.com/p/marlon-tools/source/browse/tools/dnsproxy/dnsproxy.py
68+
"""
69+
6870
def __init__(self):
6971
self._check_localhost()
7072
self._requests = []
@@ -99,9 +101,15 @@ def pop(self, prefix=None, suffix=None):
99101

100102
retVal = None
101103

104+
if prefix and hasattr(prefix, "encode"):
105+
prefix = prefix.encode()
106+
107+
if suffix and hasattr(suffix, "encode"):
108+
suffix = suffix.encode()
109+
102110
with self._lock:
103111
for _ in self._requests:
104-
if prefix is None and suffix is None or re.search(r"%s\..+\.%s" % (prefix, suffix), _, re.I):
112+
if prefix is None and suffix is None or re.search(b"%s\..+\.%s" % (prefix, suffix), _, re.I):
105113
retVal = _
106114
self._requests.remove(_)
107115
break

0 commit comments

Comments
 (0)