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

Skip to content

Commit 0e728aa

Browse files
committed
Changing default encoding of sys.argv
1 parent f93c19b commit 0e728aa

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

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.1.6.18"
22+
VERSION = "1.1.6.19"
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)

lib/parse/cmdline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def cmdLineParser(argv=None):
4848

4949
checkSystemEncoding()
5050

51-
_ = getUnicode(os.path.basename(argv[0]), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)
51+
# Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
52+
_ = getUnicode(os.path.basename(argv[0]), encoding=sys.stdin.encoding)
5253

5354
usage = "%s%s [options]" % ("python " if not IS_WIN else "", \
5455
"\"%s\"" % _ if " " in _ else _)
@@ -848,8 +849,9 @@ def _(self, *args):
848849
advancedHelp = True
849850
extraHeaders = []
850851

852+
# Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
851853
for arg in argv:
852-
_.append(getUnicode(arg, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING))
854+
_.append(getUnicode(arg, encoding=sys.stdin.encoding))
853855

854856
argv = _
855857
checkDeprecatedOptions(argv)

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ f1531be15ed98555a9010e2db3c9da75 lib/core/optiondict.py
4646
d8e9250f3775119df07e9070eddccd16 lib/core/replication.py
4747
785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py
4848
40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py
49-
f36001e7b58e9d0681d21d6b53d0255e lib/core/settings.py
49+
78ecca8a3b388fa4c067560a161b4069 lib/core/settings.py
5050
d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py
5151
2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py
5252
037e052b288457a8588a297bd8669ae1 lib/core/target.py
@@ -57,7 +57,7 @@ ad74fc58fc7214802fd27067bce18dd2 lib/core/unescaper.py
5757
4d13ed693401a498b6d073a2a494bd83 lib/core/wordlist.py
5858
310efc965c862cfbd7b0da5150a5ad36 lib/__init__.py
5959
8c4b04062db2245d9e190b413985202a lib/parse/banner.py
60-
4185a1ed8fbec400dd297474ac89c357 lib/parse/cmdline.py
60+
89c837c3b2cb2853839e127978bed8a6 lib/parse/cmdline.py
6161
3a31657bc38f277d0016ff6d50bde61f lib/parse/configfile.py
6262
14539f1be714d4f1ed042067d63bc50a lib/parse/handler.py
6363
64e5bb3ecbdd75144500588b437ba8da lib/parse/headers.py

0 commit comments

Comments
 (0)