Skip to content

Commit 8166a4e

Browse files
committed
Minor PEPing
1 parent ae2b029 commit 8166a4e

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lib/core/common.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,13 +1443,14 @@ def parseTargetUrl():
14431443
conf.hostname = conf.hostname.strip("[]").replace(kb.customInjectionMark, "")
14441444

14451445
try:
1446-
_ = conf.hostname.encode("idna")
1447-
except LookupError:
1448-
_ = conf.hostname.encode(UNICODE_ENCODING)
1449-
except UnicodeError:
1450-
_ = None
1446+
conf.hostname.encode("idna")
1447+
conf.hostname.encode(UNICODE_ENCODING)
1448+
except (LookupError, UnicodeError):
1449+
invalid = True
1450+
else:
1451+
invalid = False
14511452

1452-
if any((_ is None, re.search(r"\s", conf.hostname), '..' in conf.hostname, conf.hostname.startswith('.'), '\n' in originalUrl)):
1453+
if any((invalid, re.search(r"\s", conf.hostname), '..' in conf.hostname, conf.hostname.startswith('.'), '\n' in originalUrl)):
14531454
errMsg = "invalid target URL ('%s')" % originalUrl
14541455
raise SqlmapSyntaxException(errMsg)
14551456

@@ -2994,7 +2995,7 @@ def setOptimize():
29942995
Sets options turned on by switch '-o'
29952996
"""
29962997

2997-
#conf.predictOutput = True
2998+
# conf.predictOutput = True
29982999
conf.keepAlive = True
29993000
conf.threads = 3 if conf.threads < 3 else conf.threads
30003001
conf.nullConnection = not any((conf.data, conf.textOnly, conf.titles, conf.string, conf.notString, conf.regexp, conf.tor))
@@ -3198,9 +3199,7 @@ def showHttpErrorCodes():
31983199

31993200
if kb.httpErrorCodes:
32003201
warnMsg = "HTTP error codes detected during run:\n"
3201-
warnMsg += ", ".join("%d (%s) - %d times" % (code, httplib.responses[code] \
3202-
if code in httplib.responses else '?', count) \
3203-
for code, count in kb.httpErrorCodes.items())
3202+
warnMsg += ", ".join("%d (%s) - %d times" % (code, httplib.responses[code] if code in httplib.responses else '?', count) for code, count in kb.httpErrorCodes.items())
32043203
logger.warn(warnMsg)
32053204
if any((str(_).startswith('4') or str(_).startswith('5')) and _ != httplib.INTERNAL_SERVER_ERROR and _ != kb.originalCode for _ in kb.httpErrorCodes.keys()):
32063205
msg = "too many 4xx and/or 5xx HTTP error codes "
@@ -3216,8 +3215,7 @@ def openFile(filename, mode='r', encoding=UNICODE_ENCODING, errors="replace", bu
32163215
return codecs.open(filename, mode, encoding, errors, buffering)
32173216
except IOError:
32183217
errMsg = "there has been a file opening error for filename '%s'. " % filename
3219-
errMsg += "Please check %s permissions on a file " % ("write" if \
3220-
mode and ('w' in mode or 'a' in mode or '+' in mode) else "read")
3218+
errMsg += "Please check %s permissions on a file " % ("write" if mode and ('w' in mode or 'a' in mode or '+' in mode) else "read")
32213219
errMsg += "and that it's not locked by another process."
32223220
raise SqlmapSystemException(errMsg)
32233221

@@ -4350,7 +4348,9 @@ def prioritySortColumns(columns):
43504348
['userid', 'name', 'password']
43514349
"""
43524350

4353-
_ = lambda x: x and "id" in x.lower()
4351+
def _(column):
4352+
return column and "id" in column.lower()
4353+
43544354
return sorted(sorted(columns, key=len), lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0)
43554355

43564356
def getRequestHeader(request, name):

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

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

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ a7b0c8e5a18a3abe8803999dcfc4664f lib/controller/handler.py
2727
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
2828
052c368ae6ca09362a19376c8483fa85 lib/core/agent.py
2929
591c66fa439a48b7d8b5b581437cd14d lib/core/bigarray.py
30-
6e41ff058eb86b824215c19a3ae4de3c lib/core/common.py
30+
33c03aad7f4c6e7241b6f204560e69ca lib/core/common.py
3131
2910524e4478be6b5893fb9d851a62ec lib/core/convert.py
3232
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
3333
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
@@ -46,7 +46,7 @@ ffa5f01f39b17c8d73423acca6cfe86a lib/core/readlineng.py
4646
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
4747
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
4848
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
49-
aef027eeb51df0bb7330bf35725dba66 lib/core/settings.py
49+
053e81e44a3df054a3ffd39d58de7079 lib/core/settings.py
5050
d0adc28a38e43a787df4471f7f027413 lib/core/shell.py
5151
63491be462c515a1a3880c27c2acc4a2 lib/core/subprocessng.py
5252
3cc852f927833895361973fbcfd156d2 lib/core/target.py

0 commit comments

Comments
 (0)