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

Skip to content

Commit 984808c

Browse files
committed
Fixes #4081
1 parent 6b1f496 commit 984808c

2 files changed

Lines changed: 14 additions & 9 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.40"
21+
VERSION = "1.4.1.41"
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: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,28 @@ class DNSQuery(object):
1919
"""
2020
>>> 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."
2121
True
22+
>>> DNSQuery(b'\\x00')._query == b""
23+
True
2224
"""
2325

2426
def __init__(self, raw):
2527
self._raw = raw
2628
self._query = b""
2729

28-
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
29-
30-
if type_ == 0: # Standard query
31-
i = 12
32-
j = ord(raw[i:i + 1])
30+
try:
31+
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
3332

34-
while j != 0:
35-
self._query += raw[i + 1:i + j + 1] + b'.'
36-
i = i + j + 1
33+
if type_ == 0: # Standard query
34+
i = 12
3735
j = ord(raw[i:i + 1])
3836

37+
while j != 0:
38+
self._query += raw[i + 1:i + j + 1] + b'.'
39+
i = i + j + 1
40+
j = ord(raw[i:i + 1])
41+
except TypeError:
42+
pass
43+
3944
def response(self, resolution):
4045
"""
4146
Crafts raw DNS resolution response packet

0 commit comments

Comments
 (0)