Minor update (drei DeprecationWarnings)

This commit is contained in:
Miroslav Stampar 2019-05-08 14:53:08 +02:00
parent 1a089ccec7
commit 0bbd7fdcad
4 changed files with 16 additions and 16 deletions

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty import six from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.5.54" VERSION = "1.3.5.55"
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)

View File

@ -449,9 +449,7 @@ class PageElement(object):
s = self.toEncoding(str(s), encoding or "utf8") s = self.toEncoding(str(s), encoding or "utf8")
return s return s
BARE_AMPERSAND_OR_BRACKET = re.compile("([<>]|" BARE_AMPERSAND_OR_BRACKET = re.compile(r"([<>]|&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;))")
+ "&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)"
+ ")")
def _sub_entity(self, x): def _sub_entity(self, x):
"""Used with a regular expression to substitute the """Used with a regular expression to substitute the
@ -574,7 +572,7 @@ class Tag(PageElement):
# Convert any HTML, XML, or numeric entities in the attribute values. # Convert any HTML, XML, or numeric entities in the attribute values.
# Reference: https://github.com/pkrumins/xgoogle/pull/16/commits/3dba1165c436b0d6e5bdbd09e53ca0dbf8a043f8 # Reference: https://github.com/pkrumins/xgoogle/pull/16/commits/3dba1165c436b0d6e5bdbd09e53ca0dbf8a043f8
convert = lambda k_val: (k_val[0], convert = lambda k_val: (k_val[0],
re.sub("&(#\d+|#x[0-9a-fA-F]+|\w+);", re.sub(r"&(#\d+|#x[0-9a-fA-F]+|\w+);",
self._convertEntities, self._convertEntities,
k_val[1])) k_val[1]))
self.attrs = map(convert, self.attrs) self.attrs = map(convert, self.attrs)
@ -1079,9 +1077,9 @@ class BeautifulStoneSoup(Tag, sgmllib.SGMLParser):
QUOTE_TAGS = {} QUOTE_TAGS = {}
PRESERVE_WHITESPACE_TAGS = [] PRESERVE_WHITESPACE_TAGS = []
MARKUP_MASSAGE = [(re.compile('(<[^<>]*)/>'), MARKUP_MASSAGE = [(re.compile(r'(<[^<>]*)/>'),
lambda x: x.group(1) + ' />'), lambda x: x.group(1) + ' />'),
(re.compile('<!\s+([^<>]*)>'), (re.compile(r'<!\s+([^<>]*)>'),
lambda x: '<!' + x.group(1) + '>') lambda x: '<!' + x.group(1) + '>')
] ]
@ -1590,7 +1588,7 @@ class BeautifulSoup(BeautifulStoneSoup):
NESTABLE_LIST_TAGS, NESTABLE_TABLE_TAGS) NESTABLE_LIST_TAGS, NESTABLE_TABLE_TAGS)
# Used to detect the charset in a META tag; see start_meta # Used to detect the charset in a META tag; see start_meta
CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)", re.M) CHARSET_RE = re.compile(r"((^|;)\s*charset=)([^;]*)", re.M)
def start_meta(self, attrs): def start_meta(self, attrs):
"""Beautiful Soup can detect a charset included in a META tag, """Beautiful Soup can detect a charset included in a META tag,
@ -1934,9 +1932,9 @@ class UnicodeDammit:
except: except:
xml_encoding_match = None xml_encoding_match = None
xml_encoding_match = re.compile( xml_encoding_match = re.compile(
'^<\?.*encoding=[\'"](.*?)[\'"].*\?>').match(xml_data) r'^<\?.*encoding=[\'"](.*?)[\'"].*\?>').match(xml_data)
if not xml_encoding_match and isHTML: if not xml_encoding_match and isHTML:
regexp = re.compile('<\s*meta[^>]+charset=([^>]*?)[;\'">]', re.I) regexp = re.compile(r'<\s*meta[^>]+charset=([^>]*?)[;\'">]', re.I)
xml_encoding_match = regexp.search(xml_data) xml_encoding_match = regexp.search(xml_data)
if xml_encoding_match is not None: if xml_encoding_match is not None:
xml_encoding = xml_encoding_match.groups()[0].lower() xml_encoding = xml_encoding_match.groups()[0].lower()

View File

@ -46,8 +46,8 @@ class AnsiToWin32(object):
sequences from the text, and if outputting to a tty, will convert them into sequences from the text, and if outputting to a tty, will convert them into
win32 function calls. win32 function calls.
''' '''
ANSI_CSI_RE = re.compile('\001?\033\[((?:\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer
ANSI_OSC_RE = re.compile('\001?\033\]((?:.|;)*?)(\x07)\002?') # Operating System Command ANSI_OSC_RE = re.compile('\001?\033\\]((?:.|;)*?)(\x07)\002?') # Operating System Command
def __init__(self, wrapped, convert=None, strip=None, autoreset=False): def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
# The wrapped stream (normally sys.stdout or sys.stderr) # The wrapped stream (normally sys.stdout or sys.stderr)

View File

@ -1042,7 +1042,7 @@ class CallgrindParser(LineParser):
- http://valgrind.org/docs/manual/cl-Format.html - http://valgrind.org/docs/manual/cl-Format.html
""" """
_call_re = re.compile('^calls=\s*(\d+)\s+((\d+|\+\d+|-\d+|\*)\s+)+$') _call_re = re.compile(r'^calls=\s*(\d+)\s+((\d+|\+\d+|-\d+|\*)\s+)+$')
def __init__(self, infile): def __init__(self, infile):
LineParser.__init__(self, infile) LineParser.__init__(self, infile)
@ -1204,7 +1204,7 @@ class CallgrindParser(LineParser):
return True return True
_position_re = re.compile('^(?P<position>c?(?:ob|fl|fi|fe|fn))=\s*(?:\((?P<id>\d+)\))?(?:\s*(?P<name>.+))?') _position_re = re.compile(r'^(?P<position>c?(?:ob|fl|fi|fe|fn))=\s*(?:\((?P<id>\d+)\))?(?:\s*(?P<name>.+))?')
_position_table_map = { _position_table_map = {
'ob': 'ob', 'ob': 'ob',
@ -2071,7 +2071,8 @@ class PstatsParser:
self.profile = Profile() self.profile = Profile()
self.function_ids = {} self.function_ids = {}
def get_function_name(self, (filename, line, name)): def get_function_name(self, args):
filename, line, name = args
module = os.path.splitext(filename)[0] module = os.path.splitext(filename)[0]
module = os.path.basename(module) module = os.path.basename(module)
return "%s:%d:%s" % (module, line, name) return "%s:%d:%s" % (module, line, name)
@ -2406,7 +2407,8 @@ class DotWriter:
raise TypeError raise TypeError
self.write(s) self.write(s)
def color(self, (r, g, b)): def color(self, args):
r, g, b = args
def float2int(f): def float2int(f):
if f <= 0.0: if f <= 0.0: