mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-28 20:43:49 +03:00
Some PEP8 related style cleaning
This commit is contained in:
parent
6cfa9cb0b3
commit
ca3d35a878
|
@ -18,7 +18,7 @@ def check(module):
|
||||||
if module[-3:] == ".py":
|
if module[-3:] == ".py":
|
||||||
|
|
||||||
print "CHECKING ", module
|
print "CHECKING ", module
|
||||||
pout = os.popen('pylint --rcfile=/dev/null %s'% module, 'r')
|
pout = os.popen("pylint --rcfile=/dev/null %s" % module, 'r')
|
||||||
for line in pout:
|
for line in pout:
|
||||||
if re.match("E....:.", line):
|
if re.match("E....:.", line):
|
||||||
print line
|
print line
|
||||||
|
|
|
@ -617,3 +617,4 @@ def start():
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -1489,7 +1489,7 @@ def getConsoleWidth(default=80):
|
||||||
if os.getenv("COLUMNS", "").isdigit():
|
if os.getenv("COLUMNS", "").isdigit():
|
||||||
width = int(os.getenv("COLUMNS"))
|
width = int(os.getenv("COLUMNS"))
|
||||||
else:
|
else:
|
||||||
output=execute('stty size', shell=True, stdout=PIPE, stderr=PIPE).stdout.read()
|
output = execute("stty size", shell=True, stdout=PIPE, stderr=PIPE).stdout.read()
|
||||||
items = output.split()
|
items = output.split()
|
||||||
|
|
||||||
if len(items) == 2 and items[1].isdigit():
|
if len(items) == 2 and items[1].isdigit():
|
||||||
|
|
|
@ -1373,8 +1373,9 @@ def _cleanupOptions():
|
||||||
conf.data = re.sub(INJECT_HERE_MARK.replace(" ", r"[^A-Za-z]*"), CUSTOM_INJECTION_MARK_CHAR, conf.data, re.I)
|
conf.data = re.sub(INJECT_HERE_MARK.replace(" ", r"[^A-Za-z]*"), CUSTOM_INJECTION_MARK_CHAR, conf.data, re.I)
|
||||||
|
|
||||||
if re.search(r'%[0-9a-f]{2}', conf.data, re.I):
|
if re.search(r'%[0-9a-f]{2}', conf.data, re.I):
|
||||||
|
class _(unicode):
|
||||||
|
pass
|
||||||
original = conf.data
|
original = conf.data
|
||||||
class _(unicode): pass
|
|
||||||
conf.data = _(urldecode(conf.data))
|
conf.data = _(urldecode(conf.data))
|
||||||
setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
|
setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -110,7 +110,7 @@ def checkCharEncoding(encoding, warn=True):
|
||||||
else:
|
else:
|
||||||
return encoding
|
return encoding
|
||||||
|
|
||||||
# http://www.destructor.de/charsets/index.htm
|
# Reference: http://www.destructor.de/charsets/index.htm
|
||||||
translate = { "windows-874": "iso-8859-11", "en_us": "utf8", "macintosh": "iso-8859-1", "euc_tw": "big5_tw", "th": "tis-620", "unicode": "utf8", "utc8": "utf8", "ebcdic": "ebcdic-cp-be"}
|
translate = { "windows-874": "iso-8859-11", "en_us": "utf8", "macintosh": "iso-8859-1", "euc_tw": "big5_tw", "th": "tis-620", "unicode": "utf8", "utc8": "utf8", "ebcdic": "ebcdic-cp-be"}
|
||||||
|
|
||||||
for delimiter in (';', ',', '('):
|
for delimiter in (';', ',', '('):
|
||||||
|
@ -149,14 +149,14 @@ def checkCharEncoding(encoding, warn=True):
|
||||||
elif encoding.find("utf8") > 0:
|
elif encoding.find("utf8") > 0:
|
||||||
encoding = "utf8"
|
encoding = "utf8"
|
||||||
|
|
||||||
# http://philip.html5.org/data/charsets-2.html
|
# Reference: http://philip.html5.org/data/charsets-2.html
|
||||||
if encoding in translate:
|
if encoding in translate:
|
||||||
encoding = translate[encoding]
|
encoding = translate[encoding]
|
||||||
elif encoding in ("null", "{charset}", "*"):
|
elif encoding in ("null", "{charset}", "*"):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# http://www.iana.org/assignments/character-sets
|
# Reference: http://www.iana.org/assignments/character-sets
|
||||||
# http://docs.python.org/library/codecs.html
|
# Reference: http://docs.python.org/library/codecs.html
|
||||||
try:
|
try:
|
||||||
codecs.lookup(encoding)
|
codecs.lookup(encoding)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
|
@ -216,7 +216,7 @@ def decodePage(page, contentEncoding, contentType):
|
||||||
if not conf.charset:
|
if not conf.charset:
|
||||||
httpCharset, metaCharset = None, None
|
httpCharset, metaCharset = None, None
|
||||||
|
|
||||||
# http://stackoverflow.com/questions/1020892/python-urllib2-read-to-unicode
|
# Reference: http://stackoverflow.com/questions/1020892/python-urllib2-read-to-unicode
|
||||||
if contentType and (contentType.find("charset=") != -1):
|
if contentType and (contentType.find("charset=") != -1):
|
||||||
httpCharset = checkCharEncoding(contentType.split("charset=")[-1])
|
httpCharset = checkCharEncoding(contentType.split("charset=")[-1])
|
||||||
|
|
||||||
|
|
|
@ -137,4 +137,3 @@ if __name__ == "__main__":
|
||||||
finally:
|
finally:
|
||||||
if server:
|
if server:
|
||||||
server._running = False
|
server._running = False
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ class _Getch(object):
|
||||||
except(AttributeError, ImportError):
|
except(AttributeError, ImportError):
|
||||||
self.impl = _GetchUnix()
|
self.impl = _GetchUnix()
|
||||||
|
|
||||||
def __call__(self): return self.impl()
|
def __call__(self):
|
||||||
|
return self.impl()
|
||||||
|
|
||||||
|
|
||||||
class _GetchUnix(object):
|
class _GetchUnix(object):
|
||||||
|
@ -77,3 +78,4 @@ class _GetchMacCarbon(object):
|
||||||
|
|
||||||
|
|
||||||
getch = _Getch()
|
getch = _Getch()
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,4 @@ class Enumeration(GenericEnumeration):
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Connector(GenericConnector):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.connector = kinterbasdb.connect(host=self.hostname.encode(UNICODE_ENCODING), database=self.db.encode(UNICODE_ENCODING), \
|
self.connector = kinterbasdb.connect(host=self.hostname.encode(UNICODE_ENCODING), database=self.db.encode(UNICODE_ENCODING), \
|
||||||
user=self.user.encode(UNICODE_ENCODING), password=self.password.encode(UNICODE_ENCODING), charset="UTF8") #http://www.daniweb.com/forums/thread248499.html
|
user=self.user.encode(UNICODE_ENCODING), password=self.password.encode(UNICODE_ENCODING), charset="UTF8") # Reference: http://www.daniweb.com/forums/thread248499.html
|
||||||
except kinterbasdb.OperationalError, msg:
|
except kinterbasdb.OperationalError, msg:
|
||||||
raise SqlmapConnectionException(msg[1])
|
raise SqlmapConnectionException(msg[1])
|
||||||
self.setCursor()
|
self.setCursor()
|
||||||
|
|
|
@ -70,10 +70,10 @@ class Fingerprint(GenericFingerprint):
|
||||||
def _sysTablesCheck(self):
|
def _sysTablesCheck(self):
|
||||||
retVal = None
|
retVal = None
|
||||||
table = (
|
table = (
|
||||||
("1.0", ["EXISTS(SELECT CURRENT_USER FROM RDB$DATABASE)"]),
|
("1.0", ("EXISTS(SELECT CURRENT_USER FROM RDB$DATABASE)",)),
|
||||||
("1.5", ["NULLIF(%d,%d) IS NULL", "EXISTS(SELECT CURRENT_TRANSACTION FROM RDB$DATABASE)"]),
|
("1.5", ("NULLIF(%d,%d) IS NULL", "EXISTS(SELECT CURRENT_TRANSACTION FROM RDB$DATABASE)")),
|
||||||
("2.0", ["EXISTS(SELECT CURRENT_TIME(0) FROM RDB$DATABASE)", "BIT_LENGTH(%d)>0", "CHAR_LENGTH(%d)>0"]),
|
("2.0", ("EXISTS(SELECT CURRENT_TIME(0) FROM RDB$DATABASE)", "BIT_LENGTH(%d)>0", "CHAR_LENGTH(%d)>0")),
|
||||||
("2.1", ["BIN_XOR(%d,%d)=0", "PI()>0.%d", "RAND()<1.%d", "FLOOR(1.%d)>=0"])
|
("2.1", ("BIN_XOR(%d,%d)=0", "PI()>0.%d", "RAND()<1.%d", "FLOOR(1.%d)>=0"))
|
||||||
)
|
)
|
||||||
|
|
||||||
for i in xrange(len(table)):
|
for i in xrange(len(table)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user