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

Skip to content

Commit 220c1be

Browse files
committed
Fixes #3144
1 parent 6b06332 commit 220c1be

5 files changed

Lines changed: 33 additions & 16 deletions

File tree

lib/core/option.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import glob
1111
import inspect
1212
import logging
13-
import httplib
1413
import os
1514
import random
1615
import re
@@ -1816,16 +1815,6 @@ def _cleanupEnvironment():
18161815
if hasattr(socket, "_ready"):
18171816
socket._ready.clear()
18181817

1819-
def _dirtyPatches():
1820-
"""
1821-
Place for "dirty" Python related patches
1822-
"""
1823-
1824-
httplib._MAXLINE = 1 * 1024 * 1024 # accept overly long result lines (e.g. SQLi results in HTTP header responses)
1825-
1826-
if IS_WIN:
1827-
from thirdparty.wininetpton import win_inet_pton # add support for inet_pton() on Windows OS
1828-
18291818
def _purgeOutput():
18301819
"""
18311820
Safely removes (purges) output directory.
@@ -2633,7 +2622,6 @@ def init():
26332622
_setRequestFromFile()
26342623
_cleanupOptions()
26352624
_cleanupEnvironment()
2636-
_dirtyPatches()
26372625
_purgeOutput()
26382626
_checkDependencies()
26392627
_createTemporaryDirectory()

lib/core/patch.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
import codecs
9+
import httplib
10+
11+
from lib.core.settings import IS_WIN
12+
13+
def dirtyPatches():
14+
"""
15+
Place for "dirty" Python related patches
16+
"""
17+
18+
# accept overly long result lines (e.g. SQLi results in HTTP header responses)
19+
httplib._MAXLINE = 1 * 1024 * 1024
20+
21+
# add support for inet_pton() on Windows OS
22+
if IS_WIN:
23+
from thirdparty.wininetpton import win_inet_pton
24+
25+
# Reference: https://github.com/nodejs/node/issues/12786#issuecomment-298652440
26+
codecs.register(lambda name: codecs.lookup("utf-8") if name == "cp65001" else None)

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.6.17"
22+
VERSION = "1.2.6.18"
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)

sqlmap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from lib.core.exception import SqlmapUserQuitException
5858
from lib.core.option import initOptions
5959
from lib.core.option import init
60+
from lib.core.patch import dirtyPatches
6061
from lib.core.settings import GIT_PAGE
6162
from lib.core.settings import IS_WIN
6263
from lib.core.settings import LEGAL_DISCLAIMER
@@ -114,6 +115,7 @@ def main():
114115
"""
115116

116117
try:
118+
dirtyPatches()
117119
checkEnvironment()
118120
setPaths(modulePath())
119121
banner()

txt/checksum.md5

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py
4141
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
4242
458a194764805cd8312c14ecd4be4d1e lib/core/log.py
4343
c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.py
44-
718646541f2b446f40533149fc0f1b30 lib/core/option.py
44+
332d4bb299a0edbc42100e3cfbead285 lib/core/option.py
45+
c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
4546
7cfd04e583cca782b843f6f6d973981a lib/core/profiling.py
4647
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
4748
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
4849
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
4950
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
50-
8a43d5859fe5a416edcbe75f9570f909 lib/core/settings.py
51+
76cfa95c6b52dbdc3fb5396f8d9d57dc lib/core/settings.py
5152
0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py
5253
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
5354
36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py
@@ -225,7 +226,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_
225226
0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_
226227
2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_
227228
4eaeef94314956e4517e5310a28d579a sqlmapapi.py
228-
2cc55aaabe5b5acb29745c3832d16aaa sqlmap.py
229+
c5ecca109867f7ce4d325f487cf7badd sqlmap.py
229230
1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py
230231
4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py
231232
4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py

0 commit comments

Comments
 (0)