mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 04:53:48 +03:00
Fixes #4082
This commit is contained in:
parent
e8be9e4af4
commit
6b1f4965ed
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
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.4.1.39"
|
VERSION = "1.4.1.40"
|
||||||
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)
|
||||||
|
|
|
@ -17,13 +17,6 @@ import time
|
||||||
|
|
||||||
class DNSQuery(object):
|
class DNSQuery(object):
|
||||||
"""
|
"""
|
||||||
Used for making fake DNS resolution responses based on received
|
|
||||||
raw request
|
|
||||||
|
|
||||||
Reference(s):
|
|
||||||
http://code.activestate.com/recipes/491264-mini-fake-dns-server/
|
|
||||||
https://code.google.com/p/marlon-tools/source/browse/tools/dnsproxy/dnsproxy.py
|
|
||||||
|
|
||||||
>>> 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."
|
>>> 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
|
True
|
||||||
"""
|
"""
|
||||||
|
@ -32,9 +25,9 @@ class DNSQuery(object):
|
||||||
self._raw = raw
|
self._raw = raw
|
||||||
self._query = b""
|
self._query = b""
|
||||||
|
|
||||||
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
|
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
|
||||||
|
|
||||||
if type_ == 0: # Standard query
|
if type_ == 0: # Standard query
|
||||||
i = 12
|
i = 12
|
||||||
j = ord(raw[i:i + 1])
|
j = ord(raw[i:i + 1])
|
||||||
|
|
||||||
|
@ -65,6 +58,15 @@ class DNSQuery(object):
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
class DNSServer(object):
|
class DNSServer(object):
|
||||||
|
"""
|
||||||
|
Used for making fake DNS resolution responses based on received
|
||||||
|
raw request
|
||||||
|
|
||||||
|
Reference(s):
|
||||||
|
http://code.activestate.com/recipes/491264-mini-fake-dns-server/
|
||||||
|
https://code.google.com/p/marlon-tools/source/browse/tools/dnsproxy/dnsproxy.py
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._check_localhost()
|
self._check_localhost()
|
||||||
self._requests = []
|
self._requests = []
|
||||||
|
@ -99,9 +101,15 @@ class DNSServer(object):
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
|
if prefix and hasattr(prefix, "encode"):
|
||||||
|
prefix = prefix.encode()
|
||||||
|
|
||||||
|
if suffix and hasattr(suffix, "encode"):
|
||||||
|
suffix = suffix.encode()
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
for _ in self._requests:
|
for _ in self._requests:
|
||||||
if prefix is None and suffix is None or re.search(r"%s\..+\.%s" % (prefix, suffix), _, re.I):
|
if prefix is None and suffix is None or re.search(b"%s\..+\.%s" % (prefix, suffix), _, re.I):
|
||||||
retVal = _
|
retVal = _
|
||||||
self._requests.remove(_)
|
self._requests.remove(_)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue
Block a user