Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dad4879

Browse files
committed
Couple of trivial refactorings
1 parent 2cba4e2 commit dad4879

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

lib/core/common.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,9 +1213,9 @@ def randomStr(length=4, lowercase=False, alphabet=None, seed=None):
12131213
"""
12141214

12151215
if seed is not None:
1216-
_ = getCurrentThreadData().random
1217-
_.seed(seed)
1218-
choice = _.choice
1216+
_random = getCurrentThreadData().random
1217+
_random.seed(seed)
1218+
choice = _random.choice
12191219
else:
12201220
choice = random.choice
12211221

@@ -1247,10 +1247,12 @@ def getHeader(headers, key):
12471247
"""
12481248

12491249
retVal = None
1250-
for _ in (headers or {}):
1251-
if _.upper() == key.upper():
1252-
retVal = headers[_]
1250+
1251+
for header in (headers or {}):
1252+
if header.upper() == key.upper():
1253+
retVal = headers[header]
12531254
break
1255+
12541256
return retVal
12551257

12561258
def checkPipedInput():
@@ -1431,6 +1433,7 @@ def setPaths(rootPath):
14311433
checkFile(path)
14321434

14331435
if IS_WIN:
1436+
# Reference: https://pureinfotech.com/list-environment-variables-windows-10/
14341437
if os.getenv("LOCALAPPDATA"):
14351438
paths.SQLMAP_HOME_PATH = os.path.expandvars("%LOCALAPPDATA%\\sqlmap")
14361439
elif os.getenv("USERPROFILE"):
@@ -1444,7 +1447,7 @@ def setPaths(rootPath):
14441447
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
14451448
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")
14461449

1447-
# history files
1450+
# History files
14481451
paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(paths.SQLMAP_HOME_PATH, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)
14491452
paths.API_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "api.hst")
14501453
paths.OS_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "os.hst")
@@ -1601,7 +1604,7 @@ def parseTargetUrl():
16011604
originalUrl = conf.url
16021605

16031606
if re.search(r"\[.+\]", conf.url) and not socket.has_ipv6:
1604-
errMsg = "IPv6 addressing is not supported "
1607+
errMsg = "IPv6 communication is not supported "
16051608
errMsg += "on this platform"
16061609
raise SqlmapGenericException(errMsg)
16071610

@@ -1658,7 +1661,7 @@ def parseTargetUrl():
16581661
conf.port = 80
16591662

16601663
if conf.port < 1 or conf.port > 65535:
1661-
errMsg = "invalid target URL's port (%d)" % conf.port
1664+
errMsg = "invalid target URL port (%d)" % conf.port
16621665
raise SqlmapSyntaxException(errMsg)
16631666

16641667
conf.url = getUnicode("%s://%s:%d%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, conf.port, conf.path))

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.3.12"
21+
VERSION = "1.4.4.0"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

0 commit comments

Comments
 (0)