mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 04:31:30 +00:00
Fixes #4081
This commit is contained in:
@@ -19,23 +19,28 @@ class DNSQuery(object):
|
||||
"""
|
||||
>>> 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."
|
||||
True
|
||||
>>> DNSQuery(b'\\x00')._query == b""
|
||||
True
|
||||
"""
|
||||
|
||||
def __init__(self, raw):
|
||||
self._raw = raw
|
||||
self._query = b""
|
||||
|
||||
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
|
||||
try:
|
||||
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
|
||||
|
||||
if type_ == 0: # Standard query
|
||||
i = 12
|
||||
j = ord(raw[i:i + 1])
|
||||
|
||||
while j != 0:
|
||||
self._query += raw[i + 1:i + j + 1] + b'.'
|
||||
i = i + j + 1
|
||||
if type_ == 0: # Standard query
|
||||
i = 12
|
||||
j = ord(raw[i:i + 1])
|
||||
|
||||
while j != 0:
|
||||
self._query += raw[i + 1:i + j + 1] + b'.'
|
||||
i = i + j + 1
|
||||
j = ord(raw[i:i + 1])
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
def response(self, resolution):
|
||||
"""
|
||||
Crafts raw DNS resolution response packet
|
||||
|
||||
Reference in New Issue
Block a user