This commit is contained in:
Miroslav Stampar 2018-06-12 23:02:38 +02:00
parent 6b06332896
commit 220c1be162
5 changed files with 33 additions and 16 deletions

View File

@ -10,7 +10,6 @@ import cookielib
import glob import glob
import inspect import inspect
import logging import logging
import httplib
import os import os
import random import random
import re import re
@ -1816,16 +1815,6 @@ def _cleanupEnvironment():
if hasattr(socket, "_ready"): if hasattr(socket, "_ready"):
socket._ready.clear() 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(): def _purgeOutput():
""" """
Safely removes (purges) output directory. Safely removes (purges) output directory.
@ -2633,7 +2622,6 @@ def init():
_setRequestFromFile() _setRequestFromFile()
_cleanupOptions() _cleanupOptions()
_cleanupEnvironment() _cleanupEnvironment()
_dirtyPatches()
_purgeOutput() _purgeOutput()
_checkDependencies() _checkDependencies()
_createTemporaryDirectory() _createTemporaryDirectory()

26
lib/core/patch.py Normal file
View File

@ -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)

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.2.6.17" VERSION = "1.2.6.18"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -57,6 +57,7 @@ try:
from lib.core.exception import SqlmapUserQuitException from lib.core.exception import SqlmapUserQuitException
from lib.core.option import initOptions from lib.core.option import initOptions
from lib.core.option import init from lib.core.option import init
from lib.core.patch import dirtyPatches
from lib.core.settings import GIT_PAGE from lib.core.settings import GIT_PAGE
from lib.core.settings import IS_WIN from lib.core.settings import IS_WIN
from lib.core.settings import LEGAL_DISCLAIMER from lib.core.settings import LEGAL_DISCLAIMER
@ -114,6 +115,7 @@ def main():
""" """
try: try:
dirtyPatches()
checkEnvironment() checkEnvironment()
setPaths(modulePath()) setPaths(modulePath())
banner() banner()

View File

@ -41,13 +41,14 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py 1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
458a194764805cd8312c14ecd4be4d1e lib/core/log.py 458a194764805cd8312c14ecd4be4d1e lib/core/log.py
c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.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 7cfd04e583cca782b843f6f6d973981a lib/core/profiling.py
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py 6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
fcb74fcc9577523524659ec49e2e964b lib/core/session.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py
8a43d5859fe5a416edcbe75f9570f909 lib/core/settings.py 76cfa95c6b52dbdc3fb5396f8d9d57dc lib/core/settings.py
0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py 0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py 36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py
@ -225,7 +226,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_
0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_ 0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_
2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_ 2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_
4eaeef94314956e4517e5310a28d579a sqlmapapi.py 4eaeef94314956e4517e5310a28d579a sqlmapapi.py
2cc55aaabe5b5acb29745c3832d16aaa sqlmap.py c5ecca109867f7ce4d325f487cf7badd sqlmap.py
1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py 1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py
4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py 4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py
4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py 4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py