mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Minor style updates
This commit is contained in:
parent
6bcf9987a6
commit
57dbbefd92
|
@ -3646,7 +3646,6 @@ def createGithubIssue(errMsg, excMsg):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
data = {"title": "Unhandled exception (#%s)" % key, "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)}
|
data = {"title": "Unhandled exception (#%s)" % key, "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)}
|
||||||
req = _urllib.request.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=getBytes(json.dumps(data)), headers={HTTP_HEADER.AUTHORIZATION: "token %s" % decodeBase64(GITHUB_REPORT_OAUTH_TOKEN, binary=False), HTTP_HEADER.USER_AGENT: fetchRandomAgent()})
|
req = _urllib.request.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=getBytes(json.dumps(data)), headers={HTTP_HEADER.AUTHORIZATION: "token %s" % decodeBase64(GITHUB_REPORT_OAUTH_TOKEN, binary=False), HTTP_HEADER.USER_AGENT: fetchRandomAgent()})
|
||||||
|
|
||||||
|
|
|
@ -198,30 +198,39 @@ def round(x, d=0):
|
||||||
|
|
||||||
p = 10 ** d
|
p = 10 ** d
|
||||||
if x > 0:
|
if x > 0:
|
||||||
return float(math.floor((x * p) + 0.5))/p
|
return float(math.floor((x * p) + 0.5)) / p
|
||||||
else:
|
else:
|
||||||
return float(math.ceil((x * p) - 0.5))/p
|
return float(math.ceil((x * p) - 0.5)) / p
|
||||||
|
|
||||||
def cmp_to_key(mycmp):
|
def cmp_to_key(mycmp):
|
||||||
"""Convert a cmp= function into a key= function"""
|
"""Convert a cmp= function into a key= function"""
|
||||||
class K(object):
|
class K(object):
|
||||||
__slots__ = ['obj']
|
__slots__ = ['obj']
|
||||||
|
|
||||||
def __init__(self, obj, *args):
|
def __init__(self, obj, *args):
|
||||||
self.obj = obj
|
self.obj = obj
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return mycmp(self.obj, other.obj) < 0
|
return mycmp(self.obj, other.obj) < 0
|
||||||
|
|
||||||
def __gt__(self, other):
|
def __gt__(self, other):
|
||||||
return mycmp(self.obj, other.obj) > 0
|
return mycmp(self.obj, other.obj) > 0
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return mycmp(self.obj, other.obj) == 0
|
return mycmp(self.obj, other.obj) == 0
|
||||||
|
|
||||||
def __le__(self, other):
|
def __le__(self, other):
|
||||||
return mycmp(self.obj, other.obj) <= 0
|
return mycmp(self.obj, other.obj) <= 0
|
||||||
|
|
||||||
def __ge__(self, other):
|
def __ge__(self, other):
|
||||||
return mycmp(self.obj, other.obj) >= 0
|
return mycmp(self.obj, other.obj) >= 0
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return mycmp(self.obj, other.obj) != 0
|
return mycmp(self.obj, other.obj) != 0
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
raise TypeError('hash not implemented')
|
raise TypeError('hash not implemented')
|
||||||
|
|
||||||
return K
|
return K
|
||||||
|
|
||||||
# Note: patch for Python 2.6
|
# Note: patch for Python 2.6
|
||||||
|
|
|
@ -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.71"
|
VERSION = "1.3.5.72"
|
||||||
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)
|
||||||
|
|
|
@ -174,7 +174,7 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
k = self.parse_pi(i)
|
k = self.parse_pi(i)
|
||||||
if k < 0:
|
if k < 0:
|
||||||
break
|
break
|
||||||
i = i+k
|
i = i + k
|
||||||
continue
|
continue
|
||||||
if rawdata.startswith("<!", i):
|
if rawdata.startswith("<!", i):
|
||||||
# This is some sort of declaration; in "HTML as
|
# This is some sort of declaration; in "HTML as
|
||||||
|
@ -195,16 +195,16 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
name = match.group(1)
|
name = match.group(1)
|
||||||
self.handle_charref(name)
|
self.handle_charref(name)
|
||||||
i = match.end(0)
|
i = match.end(0)
|
||||||
if rawdata[i-1] != ';':
|
if rawdata[i - 1] != ';':
|
||||||
i = i-1
|
i = i - 1
|
||||||
continue
|
continue
|
||||||
match = entityref.match(rawdata, i)
|
match = entityref.match(rawdata, i)
|
||||||
if match:
|
if match:
|
||||||
name = match.group(1)
|
name = match.group(1)
|
||||||
self.handle_entityref(name)
|
self.handle_entityref(name)
|
||||||
i = match.end(0)
|
i = match.end(0)
|
||||||
if rawdata[i-1] != ';':
|
if rawdata[i - 1] != ';':
|
||||||
i = i-1
|
i = i - 1
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self.error('neither < nor & ??')
|
self.error('neither < nor & ??')
|
||||||
|
@ -233,15 +233,15 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
# Internal -- parse processing instr, return length or -1 if not terminated
|
# Internal -- parse processing instr, return length or -1 if not terminated
|
||||||
def parse_pi(self, i):
|
def parse_pi(self, i):
|
||||||
rawdata = self.rawdata
|
rawdata = self.rawdata
|
||||||
if rawdata[i:i+2] != '<?':
|
if rawdata[i:i + 2] != '<?':
|
||||||
self.error('unexpected call to parse_pi()')
|
self.error('unexpected call to parse_pi()')
|
||||||
match = piclose.search(rawdata, i+2)
|
match = piclose.search(rawdata, i + 2)
|
||||||
if not match:
|
if not match:
|
||||||
return -1
|
return -1
|
||||||
j = match.start(0)
|
j = match.start(0)
|
||||||
self.handle_pi(rawdata[i+2: j])
|
self.handle_pi(rawdata[i + 2: j])
|
||||||
j = match.end(0)
|
j = match.end(0)
|
||||||
return j-i
|
return j - i
|
||||||
|
|
||||||
def get_starttag_text(self):
|
def get_starttag_text(self):
|
||||||
return self.__starttag_text
|
return self.__starttag_text
|
||||||
|
@ -276,7 +276,7 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
j = match.start(0)
|
j = match.start(0)
|
||||||
# Now parse the data between i + 1 and j into a tag and attrs
|
# Now parse the data between i + 1 and j into a tag and attrs
|
||||||
attrs = []
|
attrs = []
|
||||||
if rawdata[i:i+2] == '<>':
|
if rawdata[i:i + 2] == '<>':
|
||||||
# SGML shorthand: <> == <last open tag seen>
|
# SGML shorthand: <> == <last open tag seen>
|
||||||
k = j
|
k = j
|
||||||
tag = self.lasttag
|
tag = self.lasttag
|
||||||
|
@ -327,7 +327,7 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
if not match:
|
if not match:
|
||||||
return -1
|
return -1
|
||||||
j = match.start(0)
|
j = match.start(0)
|
||||||
tag = rawdata[i+2:j].strip().lower()
|
tag = rawdata[i + 2:j].strip().lower()
|
||||||
if rawdata[j] == '>':
|
if rawdata[j] == '>':
|
||||||
j = j + 1
|
j = j + 1
|
||||||
self.finish_endtag(tag)
|
self.finish_endtag(tag)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Syntax(GenericSyntax):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def escaper(value):
|
def escaper(value):
|
||||||
return "||".join("ASCII_CHAR(%d)" %_ for _ in getOrds(value))
|
return "||".join("ASCII_CHAR(%d)" % _ for _ in getOrds(value))
|
||||||
|
|
||||||
retVal = expression
|
retVal = expression
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
1#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
|
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user