diff --git a/lib/core/option.py b/lib/core/option.py index 75bd66eac..761ac15d5 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -10,7 +10,6 @@ import cookielib import glob import inspect import logging -import httplib import os import random import re @@ -1816,16 +1815,6 @@ def _cleanupEnvironment(): if hasattr(socket, "_ready"): socket._ready.clear() -def _dirtyPatches(): - """ - Place for "dirty" Python related patches - """ - - httplib._MAXLINE = 1 * 1024 * 1024 # accept overly long result lines (e.g. SQLi results in HTTP header responses) - - if IS_WIN: - from thirdparty.wininetpton import win_inet_pton # add support for inet_pton() on Windows OS - def _purgeOutput(): """ Safely removes (purges) output directory. @@ -2633,7 +2622,6 @@ def init(): _setRequestFromFile() _cleanupOptions() _cleanupEnvironment() - _dirtyPatches() _purgeOutput() _checkDependencies() _createTemporaryDirectory() diff --git a/lib/core/patch.py b/lib/core/patch.py new file mode 100644 index 000000000..f55ab7b4a --- /dev/null +++ b/lib/core/patch.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +""" +Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/) +See the file 'LICENSE' for copying permission +""" + +import codecs +import httplib + +from lib.core.settings import IS_WIN + +def dirtyPatches(): + """ + Place for "dirty" Python related patches + """ + + # accept overly long result lines (e.g. SQLi results in HTTP header responses) + httplib._MAXLINE = 1 * 1024 * 1024 + + # add support for inet_pton() on Windows OS + if IS_WIN: + from thirdparty.wininetpton import win_inet_pton + + # Reference: https://github.com/nodejs/node/issues/12786#issuecomment-298652440 + codecs.register(lambda name: codecs.lookup("utf-8") if name == "cp65001" else None) diff --git a/lib/core/settings.py b/lib/core/settings.py index 72907db34..b2e11a8d1 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.2.6.17" +VERSION = "1.2.6.18" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/sqlmap.py b/sqlmap.py index 618ea99fb..75272136e 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -57,6 +57,7 @@ try: from lib.core.exception import SqlmapUserQuitException from lib.core.option import initOptions from lib.core.option import init + from lib.core.patch import dirtyPatches from lib.core.settings import GIT_PAGE from lib.core.settings import IS_WIN from lib.core.settings import LEGAL_DISCLAIMER @@ -114,6 +115,7 @@ def main(): """ try: + dirtyPatches() checkEnvironment() setPaths(modulePath()) banner() diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 7ce69f98e..8898eb6df 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -41,13 +41,14 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py 1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py 458a194764805cd8312c14ecd4be4d1e lib/core/log.py c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.py -718646541f2b446f40533149fc0f1b30 lib/core/option.py +332d4bb299a0edbc42100e3cfbead285 lib/core/option.py +c8c386d644d57c659d74542f5f57f632 lib/core/patch.py 7cfd04e583cca782b843f6f6d973981a lib/core/profiling.py 6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py -8a43d5859fe5a416edcbe75f9570f909 lib/core/settings.py +76cfa95c6b52dbdc3fb5396f8d9d57dc lib/core/settings.py 0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py 36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py @@ -225,7 +226,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_ 0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_ 2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_ 4eaeef94314956e4517e5310a28d579a sqlmapapi.py -2cc55aaabe5b5acb29745c3832d16aaa sqlmap.py +c5ecca109867f7ce4d325f487cf7badd sqlmap.py 1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py 4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py 4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py