mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-06-28 04:20:58 +00:00
Potential patch for CI/CD issue
This commit is contained in:
parent
4ba8edef1d
commit
b66840eb2e
3 changed files with 48 additions and 34 deletions
|
|
@ -189,7 +189,7 @@ ccc4a717e887652b1fcce073d9409d9c59a3b28548c703a9e453d15845f90cd7 lib/core/patch
|
|||
9bf174058f15d14e24e94f9aaf42df045119d3617c6c54bd2f3af79b462f331d lib/core/replication.py
|
||||
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
|
||||
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
|
||||
4df19d4b5ce21922573c387d9f4a2a228a44a4f7c07c9a0d4c38048b04e1912b lib/core/settings.py
|
||||
8a424d4e91d0d5b57502d2699e95acbb12e1378330fbbb4ffa75b507141aec36 lib/core/settings.py
|
||||
c7804223319e18eb0b8e2cbf0a8b6896d1cefb7b0b1a2e9f1cf826a8a3b56750 lib/core/shell.py
|
||||
a2e98a94b231432736d6b304fc75525c8b5fdb4768c418387c5b4c1a610dad64 lib/core/subprocessng.py
|
||||
19f1e3c5e3ba703d28d510cd7a9ab8284d5fbe9df5ce7e77c86e5931571364b7 lib/core/target.py
|
||||
|
|
@ -214,7 +214,7 @@ bc61bc944b81a7670884f82231033a6ac703324b34b071c9834886a92e249d0e lib/request/ch
|
|||
d4bb0869b03602a0c8f9e0e0fd217753f14ddadf848fc9f3c65a74d03feb9958 lib/request/comparison.py
|
||||
b9e2db44d265909792f6cc821ff910727b14aa2d5063c74b0f2ea6d40c4f3d9d lib/request/connect.py
|
||||
8e06682280fce062eef6174351bfebcb6040e19976acff9dc7b3699779783498 lib/request/direct.py
|
||||
676d59c53de4d119f79a8b32c4d9282c1e48833dca688f743d8a0c06433aa502 lib/request/dns.py
|
||||
a6b37b436838caeb197fea858d0a39fadbff4736256e741b5fcec1f28fcf1ce0 lib/request/dns.py
|
||||
92c81cc31ff4a396723242058fb2152c9e9745f8412d01ea74480b048a53af6c lib/request/httpshandler.py
|
||||
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/request/__init__.py
|
||||
7a0ac2522213e756348fd871a7af74cc963bdc82f9d7ade57be5de42b5bf7cab lib/request/inject.py
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.6.146"
|
||||
VERSION = "1.10.6.147"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from __future__ import print_function
|
|||
|
||||
import binascii
|
||||
import collections
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
|
|
@ -34,41 +35,35 @@ class DNSQuery(object):
|
|||
self._query = b""
|
||||
|
||||
try:
|
||||
# Minimum DNS header length is 12 bytes, followed by at least a
|
||||
# root label terminator. Shorter packets are malformed/no-op.
|
||||
if len(raw) <= 12:
|
||||
if len(raw) < 13:
|
||||
return
|
||||
|
||||
type_ = (ord(raw[2:3]) >> 3) & 15 # Opcode bits
|
||||
|
||||
if type_ == 0: # Standard query
|
||||
i = 12
|
||||
parts = []
|
||||
labels = []
|
||||
|
||||
while True:
|
||||
if i >= len(raw):
|
||||
return
|
||||
|
||||
while i < len(raw):
|
||||
j = ord(raw[i:i + 1])
|
||||
|
||||
if j == 0:
|
||||
break
|
||||
|
||||
# Compression pointers are not expected in the question name
|
||||
# here. Treat them as malformed instead of walking arbitrary
|
||||
# offsets or creating a partial query.
|
||||
if j & 0xc0:
|
||||
parts = []
|
||||
break
|
||||
i += 1
|
||||
|
||||
i = i + 1
|
||||
if i + j > len(raw):
|
||||
parts = []
|
||||
break
|
||||
return
|
||||
|
||||
parts.append(raw[i:i + j])
|
||||
i = i + j
|
||||
labels.append(raw[i:i + j])
|
||||
i += j
|
||||
|
||||
if parts:
|
||||
self._query = b".".join(parts) + b'.'
|
||||
except Exception:
|
||||
if labels:
|
||||
self._query = b".".join(labels) + b'.'
|
||||
except (TypeError, ValueError, IndexError):
|
||||
self._query = b""
|
||||
|
||||
def response(self, resolution):
|
||||
|
|
@ -79,19 +74,21 @@ class DNSQuery(object):
|
|||
retVal = b""
|
||||
|
||||
if self._query:
|
||||
offset = self._raw[12:].find(b"\x00")
|
||||
end = self._raw[12:].find(b"\x00")
|
||||
|
||||
if offset >= 0:
|
||||
retVal += self._raw[:2] # Transaction ID
|
||||
retVal += b"\x85\x80" # Flags (Standard query response, No error)
|
||||
retVal += self._raw[4:6] + self._raw[4:6] + b"\x00\x00\x00\x00" # Questions and Answers Counts
|
||||
retVal += self._raw[12:(12 + offset + 5)] # Original Domain Name Query
|
||||
retVal += b"\xc0\x0c" # Pointer to domain name
|
||||
retVal += b"\x00\x01" # Type A
|
||||
retVal += b"\x00\x01" # Class IN
|
||||
retVal += b"\x00\x00\x00\x20" # TTL (32 seconds)
|
||||
retVal += b"\x00\x04" # Data length
|
||||
retVal += b"".join(struct.pack('B', int(_)) for _ in resolution.split('.')) # 4 bytes of IP
|
||||
if end < 0 or len(self._raw) < 12 + end + 5:
|
||||
return retVal
|
||||
|
||||
retVal += self._raw[:2] # Transaction ID
|
||||
retVal += b"\x85\x80" # Flags (Standard query response, No error)
|
||||
retVal += self._raw[4:6] + self._raw[4:6] + b"\x00\x00\x00\x00" # Questions and Answers Counts
|
||||
retVal += self._raw[12:(12 + end + 5)] # Original Domain Name Query
|
||||
retVal += b"\xc0\x0c" # Pointer to domain name
|
||||
retVal += b"\x00\x01" # Type A
|
||||
retVal += b"\x00\x01" # Class IN
|
||||
retVal += b"\x00\x00\x00\x20" # TTL (32 seconds)
|
||||
retVal += b"\x00\x04" # Data length
|
||||
retVal += b"".join(struct.pack('B', int(_)) for _ in resolution.split('.')) # 4 bytes of IP
|
||||
|
||||
return retVal
|
||||
|
||||
|
|
@ -168,15 +165,31 @@ class DNSServer(object):
|
|||
"""
|
||||
|
||||
def _():
|
||||
def _is_udp_connreset(ex):
|
||||
return getattr(ex, "winerror", None) == 10054 or getattr(ex, "errno", None) in (errno.ECONNRESET, 10054)
|
||||
|
||||
try:
|
||||
self._running = True
|
||||
self._initialized = True
|
||||
|
||||
try:
|
||||
if hasattr(socket, "SIO_UDP_CONNRESET") and hasattr(self._socket, "ioctl"):
|
||||
# Windows reports ICMP "port unreachable" for UDP as WSAECONNRESET on
|
||||
# recvfrom(). DNS clients in tests and in the wild can disappear before
|
||||
# reading our fake response; that must not kill the server thread.
|
||||
self._socket.ioctl(socket.SIO_UDP_CONNRESET, False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
while True:
|
||||
try:
|
||||
data, addr = self._socket.recvfrom(1024)
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except socket.error as ex:
|
||||
if _is_udp_connreset(ex):
|
||||
continue
|
||||
break # socket closed/broken - stop serving (e.g. program exit)
|
||||
except Exception:
|
||||
break # socket closed/broken - stop serving (e.g. program exit)
|
||||
|
||||
|
|
@ -194,6 +207,7 @@ class DNSServer(object):
|
|||
self._requests.append(_._query)
|
||||
|
||||
response = _.response("127.0.0.1")
|
||||
|
||||
if response:
|
||||
self._socket.sendto(response, addr)
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue