mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-31 16:07:55 +03:00 
			
		
		
		
	Fixes #3680
This commit is contained in:
		
							parent
							
								
									03224401ab
								
							
						
					
					
						commit
						4cc13d3c1e
					
				|  | @ -58,7 +58,7 @@ from lib.core.convert import getBytes | ||||||
| from lib.core.convert import getText | from lib.core.convert import getText | ||||||
| from lib.core.convert import getUnicode | from lib.core.convert import getUnicode | ||||||
| from lib.core.convert import htmlunescape | from lib.core.convert import htmlunescape | ||||||
| from lib.core.convert import stdoutencode | from lib.core.convert import stdoutEncode | ||||||
| from lib.core.data import conf | from lib.core.data import conf | ||||||
| from lib.core.data import kb | from lib.core.data import kb | ||||||
| from lib.core.data import logger | from lib.core.data import logger | ||||||
|  | @ -968,9 +968,9 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status= | ||||||
| 
 | 
 | ||||||
|             try: |             try: | ||||||
|                 if conf.get("api"): |                 if conf.get("api"): | ||||||
|                     sys.stdout.write(stdoutencode(clearColors(data)), status, content_type) |                     sys.stdout.write(stdoutEncode(clearColors(data)), status, content_type) | ||||||
|                 else: |                 else: | ||||||
|                     sys.stdout.write(stdoutencode(setColor(data, bold=bold))) |                     sys.stdout.write(stdoutEncode(setColor(data, bold=bold))) | ||||||
| 
 | 
 | ||||||
|                 sys.stdout.flush() |                 sys.stdout.flush() | ||||||
|             except IOError: |             except IOError: | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								lib/core/convert.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										32
									
								
								lib/core/convert.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							|  | @ -23,6 +23,7 @@ from lib.core.settings import INVALID_UNICODE_PRIVATE_AREA | ||||||
| from lib.core.settings import IS_WIN | from lib.core.settings import IS_WIN | ||||||
| from lib.core.settings import NULL | from lib.core.settings import NULL | ||||||
| from lib.core.settings import PICKLE_PROTOCOL | from lib.core.settings import PICKLE_PROTOCOL | ||||||
|  | from lib.core.settings import PYVERSION | ||||||
| from lib.core.settings import SAFE_HEX_MARKER | from lib.core.settings import SAFE_HEX_MARKER | ||||||
| from lib.core.settings import UNICODE_ENCODING | from lib.core.settings import UNICODE_ENCODING | ||||||
| from thirdparty import six | from thirdparty import six | ||||||
|  | @ -100,27 +101,34 @@ def filterNone(values):  # Cross-referenced function | ||||||
| def isListLike(value):  # Cross-referenced function | def isListLike(value):  # Cross-referenced function | ||||||
|     raise NotImplementedError |     raise NotImplementedError | ||||||
| 
 | 
 | ||||||
| def stdoutencode(data): | def stdoutEncode(value): | ||||||
|     retVal = data |     value = value or "" | ||||||
| 
 | 
 | ||||||
|     if six.PY2: |     if isinstance(value, six.text_type) and PYVERSION < "3.6": | ||||||
|         try: |         encoding = sys.stdout.encoding or UNICODE_ENCODING | ||||||
|             retVal = getBytes(data or "", sys.stdout.encoding, unsafe=False) |  | ||||||
| 
 | 
 | ||||||
|             # Reference: http://bugs.python.org/issue1602 |         while True: | ||||||
|             if IS_WIN: |             try: | ||||||
|                 if '?' in retVal and '?' not in retVal: |                 retVal = value.encode(encoding) | ||||||
|                     warnMsg = "cannot properly display Unicode characters " |                 break | ||||||
|  |             except UnicodeEncodeError as ex: | ||||||
|  |                 value = value[:ex.start] + "?" + value[ex.end:] | ||||||
|  | 
 | ||||||
|  |                 if IS_WIN and PYVERSION < "3.6": | ||||||
|  |                     warnMsg = "cannot properly display (some) Unicode characters " | ||||||
|                     warnMsg += "inside Windows OS command prompt " |                     warnMsg += "inside Windows OS command prompt " | ||||||
|                     warnMsg += "(http://bugs.python.org/issue1602). All " |                     warnMsg += "(https://bugs.python.org/issue1602). All " | ||||||
|                     warnMsg += "unhandled occurrences will result in " |                     warnMsg += "unhandled occurrences will result in " | ||||||
|                     warnMsg += "replacement with '?' character. Please, find " |                     warnMsg += "replacement with '?' character. Please, find " | ||||||
|                     warnMsg += "proper character representation inside " |                     warnMsg += "proper character representation inside " | ||||||
|                     warnMsg += "corresponding output files. " |                     warnMsg += "corresponding output files. " | ||||||
|                     singleTimeWarnMessage(warnMsg) |                     singleTimeWarnMessage(warnMsg) | ||||||
| 
 | 
 | ||||||
|         except: |         if six.PY3: | ||||||
|             retVal = getBytes(data or "", unsafe=False) |             retVal = getUnicode(retVal, encoding) | ||||||
|  | 
 | ||||||
|  |     else: | ||||||
|  |         retVal = value | ||||||
| 
 | 
 | ||||||
|     return retVal |     return retVal | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ from lib.core.common import getSafeExString | ||||||
| from lib.core.common import isListLike | from lib.core.common import isListLike | ||||||
| from lib.core.common import singleTimeWarnMessage | from lib.core.common import singleTimeWarnMessage | ||||||
| from lib.core.common import readInput | from lib.core.common import readInput | ||||||
| from lib.core.convert import stdoutencode | from lib.core.convert import stdoutEncode | ||||||
| from lib.core.option import _setHTTPHandlers | from lib.core.option import _setHTTPHandlers | ||||||
| from lib.core.option import setVerbosity | from lib.core.option import setVerbosity | ||||||
| from lib.core.option import _setWafFunctions | from lib.core.option import _setWafFunctions | ||||||
|  | @ -70,7 +70,7 @@ def resolveCrossReferences(): | ||||||
|     lib.controller.checks.setVerbosity = setVerbosity |     lib.controller.checks.setVerbosity = setVerbosity | ||||||
|     lib.controller.checks.setWafFunctions = _setWafFunctions |     lib.controller.checks.setWafFunctions = _setWafFunctions | ||||||
|     lib.utils.sqlalchemy.getSafeExString = getSafeExString |     lib.utils.sqlalchemy.getSafeExString = getSafeExString | ||||||
|     thirdparty.ansistrm.ansistrm.stdoutencode = stdoutencode |     thirdparty.ansistrm.ansistrm.stdoutEncode = stdoutEncode | ||||||
| 
 | 
 | ||||||
| def pympTempLeakPatch(tempDir): | def pympTempLeakPatch(tempDir): | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ from lib.core.enums import OS | ||||||
| from thirdparty.six import unichr as _unichr | from thirdparty.six import unichr as _unichr | ||||||
| 
 | 
 | ||||||
| # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | ||||||
| VERSION = "1.3.5.109" | VERSION = "1.3.5.110" | ||||||
| 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) | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								thirdparty/ansistrm/ansistrm.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								thirdparty/ansistrm/ansistrm.py
									
									
									
									
										vendored
									
									
								
							|  | @ -20,7 +20,7 @@ if IS_WIN: | ||||||
|     ctypes.windll.kernel32.SetConsoleTextAttribute.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.WORD] |     ctypes.windll.kernel32.SetConsoleTextAttribute.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.WORD] | ||||||
|     ctypes.windll.kernel32.SetConsoleTextAttribute.restype = ctypes.wintypes.BOOL |     ctypes.windll.kernel32.SetConsoleTextAttribute.restype = ctypes.wintypes.BOOL | ||||||
| 
 | 
 | ||||||
| def stdoutencode(data):  # Cross-referenced function | def stdoutEncode(data):  # Cross-referenced function | ||||||
|     raise NotImplementedError |     raise NotImplementedError | ||||||
| 
 | 
 | ||||||
| class ColorizingStreamHandler(logging.StreamHandler): | class ColorizingStreamHandler(logging.StreamHandler): | ||||||
|  | @ -56,7 +56,7 @@ class ColorizingStreamHandler(logging.StreamHandler): | ||||||
| 
 | 
 | ||||||
|     def emit(self, record): |     def emit(self, record): | ||||||
|         try: |         try: | ||||||
|             message = stdoutencode(self.format(record)) |             message = stdoutEncode(self.format(record)) | ||||||
|             stream = self.stream |             stream = self.stream | ||||||
| 
 | 
 | ||||||
|             if not self.is_tty: |             if not self.is_tty: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user