Couple of trivialities

This commit is contained in:
Miroslav Stampar 2020-05-15 12:58:03 +02:00
parent 9077734ec5
commit a851dc486a
4 changed files with 9 additions and 7 deletions

View File

@ -1274,7 +1274,7 @@ def checkPipedInput():
# Reference: https://stackoverflow.com/a/33873570 # Reference: https://stackoverflow.com/a/33873570
""" """
return not os.isatty(sys.stdin.fileno()) if hasattr(sys.stdin, "fileno") else False return hasattr(sys.stdin, "fileno") and not os.isatty(sys.stdin.fileno())
def isZipFile(filename): def isZipFile(filename):
""" """
@ -1364,9 +1364,9 @@ def parsePasswordHash(password):
>>> kb.forcedDbms = popValue() >>> kb.forcedDbms = popValue()
""" """
blank = " " * 8 blank = ' ' * 8
if isNoneValue(password) or password == " ": if isNoneValue(password) or password == ' ':
retVal = NULL retVal = NULL
else: else:
retVal = password retVal = password
@ -1510,7 +1510,7 @@ def parseTargetDirect():
if details: if details:
conf.dbms = details.group("dbms") conf.dbms = details.group("dbms")
if details.group('credentials'): if details.group("credentials"):
conf.dbmsUser = details.group("user") conf.dbmsUser = details.group("user")
conf.dbmsPass = details.group("pass") conf.dbmsPass = details.group("pass")
else: else:
@ -1622,7 +1622,7 @@ def parseTargetUrl():
originalUrl = conf.url originalUrl = conf.url
if re.search(r"\[.+\]", conf.url) and not socket.has_ipv6: if re.search(r"://\[.+\]", conf.url) and not socket.has_ipv6:
errMsg = "IPv6 communication is not supported " errMsg = "IPv6 communication is not supported "
errMsg += "on this platform" errMsg += "on this platform"
raise SqlmapGenericException(errMsg) raise SqlmapGenericException(errMsg)

View File

@ -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.5.23" VERSION = "1.4.5.24"
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

@ -154,6 +154,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
except AttributeError: except AttributeError:
def _(self): def _(self):
return getattr(self, "hdrs") or {} return getattr(self, "hdrs") or {}
result.info = types.MethodType(_, result) result.info = types.MethodType(_, result)
if not hasattr(result, "read"): if not hasattr(result, "read"):
@ -164,6 +165,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
retVal = "" retVal = ""
finally: finally:
return retVal return retVal
result.read = types.MethodType(_, result) result.read = types.MethodType(_, result)
if not getattr(result, "url", None): if not getattr(result, "url", None):

View File

@ -534,4 +534,4 @@ if __name__ == "__main__":
sys.exit(getattr(os, "_exitcode", 0)) sys.exit(getattr(os, "_exitcode", 0))
else: else:
# cancelling postponed imports (because of Travis CI checks) # cancelling postponed imports (because of Travis CI checks)
from lib.controller.controller import start __import__("lib.controller.controller")