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

Skip to content

Commit ec4e49d

Browse files
committed
Minor refactoring
1 parent 1363f26 commit ec4e49d

8 files changed

Lines changed: 9 additions & 9 deletions

File tree

lib/core/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@ def parseTargetDirect():
10111011
conf.hostname = "localhost"
10121012
conf.port = 0
10131013
elif not remote:
1014-
errMsg = "missing remote connection details"
1015-
raise SqlmapSyntaxException(errMsg)
1014+
errMsg = "missing remote connection details"
1015+
raise SqlmapSyntaxException(errMsg)
10161016

10171017
if dbmsName in (DBMS.MSSQL, DBMS.SYBASE):
10181018
import _mssql

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ def _setOS():
750750

751751
def _setTechnique():
752752
validTechniques = sorted(getPublicTypeMembers(PAYLOAD.TECHNIQUE), key=lambda x: x[1])
753-
validLetters = map(lambda x: x[0][0].upper(), validTechniques)
753+
validLetters = (_[0][0].upper() for _ in validTechniques)
754754

755755
if conf.tech and isinstance(conf.tech, basestring):
756756
_ = []

lib/core/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _setRequestParams():
130130

131131
kb.processUserMarks = True if kb.postHint else kb.processUserMarks
132132

133-
if re.search(URI_INJECTABLE_REGEX, conf.url, re.I) and not any(map(lambda place: place in conf.parameters, [PLACE.GET, PLACE.POST])):
133+
if re.search(URI_INJECTABLE_REGEX, conf.url, re.I) and not any(place in conf.parameters for place in (PLACE.GET, PLACE.POST)):
134134
warnMsg = "you've provided target url without any GET "
135135
warnMsg += "parameters (e.g. www.site.com/article.php?id=1) "
136136
warnMsg += "and without providing any POST parameters "

lib/core/threads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
104104
kb.threadContinue = True
105105
kb.threadException = False
106106

107-
if threadChoice and numThreads == 1 and any(map(lambda _: _ in kb.injection.data, (PAYLOAD.TECHNIQUE.BOOLEAN, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY, PAYLOAD.TECHNIQUE.UNION))):
107+
if threadChoice and numThreads == 1 and any(_ in kb.injection.data for _ in (PAYLOAD.TECHNIQUE.BOOLEAN, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY, PAYLOAD.TECHNIQUE.UNION)):
108108
while True:
109109
message = "please enter number of threads? [Enter for %d (current)] " % numThreads
110110
choice = readInput(message, default=str(numThreads))

lib/techniques/blind/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def blindThread():
423423
abortedFlag = True
424424

425425
finally:
426-
value = map(lambda _: partialValue[_] if _ < len(partialValue) else threadData.shared.value[_], xrange(length))
426+
value = (partialValue[_] if _ < len(partialValue) else threadData.shared.value[_] for _ in xrange(length))
427427

428428
infoMsg = None
429429

lib/techniques/brute/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def tableExistsThread():
127127
else:
128128
kb.data.cachedTables[conf.db].append(item)
129129

130-
for _ in map(lambda x: (conf.db, x), threadData.shared.value):
130+
for _ in ((conf.db, item) for item in threadData.shared.value):
131131
if _ not in kb.brute.tables:
132132
kb.brute.tables.append(_)
133133

plugins/dbms/sybase/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def getColumns(self, onlyColNames=False):
221221

222222
if colList:
223223
table = {}
224-
table[safeSQLIdentificatorNaming(tbl)] = dict(map(lambda x: (x, None), colList))
224+
table[safeSQLIdentificatorNaming(tbl)] = dict((_, None) for _ in colList)
225225
kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)] = table
226226
continue
227227

plugins/generic/databases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def getTables(self, bruteForce=None):
275275
values = filter(None, arrayizeValue(values))
276276

277277
if len(values) > 0 and not isListLike(values[0]):
278-
values = map(lambda x: (dbs[0], x), values)
278+
values = ((dbs[0], _) for _ in values)
279279

280280
for db, table in filterPairValues(values):
281281
db = safeSQLIdentificatorNaming(db)

0 commit comments

Comments
 (0)