mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 18:07:46 +03:00 
			
		
		
		
	Proper (safe) showing of safe encoded data
This commit is contained in:
		
							parent
							
								
									2b57b4b54b
								
							
						
					
					
						commit
						4d028c7230
					
				| 
						 | 
				
			
			@ -103,7 +103,7 @@ def stdoutencode(data):
 | 
			
		|||
 | 
			
		||||
    if six.PY2:
 | 
			
		||||
        try:
 | 
			
		||||
            retVal = getBytes(data or "", sys.stdout.encoding)
 | 
			
		||||
            retVal = getBytes(data or "", sys.stdout.encoding, unsafe=False)
 | 
			
		||||
 | 
			
		||||
            # Reference: http://bugs.python.org/issue1602
 | 
			
		||||
            if IS_WIN:
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ def stdoutencode(data):
 | 
			
		|||
                    singleTimeWarnMessage(warnMsg)
 | 
			
		||||
 | 
			
		||||
        except:
 | 
			
		||||
            retVal = getBytes(data or "")
 | 
			
		||||
            retVal = getBytes(data or "", unsafe=False)
 | 
			
		||||
 | 
			
		||||
    return retVal
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +224,7 @@ def encodeBase64(value, binary=True):
 | 
			
		|||
 | 
			
		||||
    return retVal
 | 
			
		||||
 | 
			
		||||
def getBytes(value, encoding=UNICODE_ENCODING, errors="strict"):
 | 
			
		||||
def getBytes(value, encoding=UNICODE_ENCODING, errors="strict", unsafe=True):
 | 
			
		||||
    """
 | 
			
		||||
    Returns byte representation of provided Unicode value
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -236,13 +236,18 @@ def getBytes(value, encoding=UNICODE_ENCODING, errors="strict"):
 | 
			
		|||
 | 
			
		||||
    if isinstance(value, six.text_type):
 | 
			
		||||
        if INVALID_UNICODE_PRIVATE_AREA:
 | 
			
		||||
            if unsafe:
 | 
			
		||||
                for char in xrange(0xF0000, 0xF00FF + 1):
 | 
			
		||||
                    value = value.replace(six.unichr(char), "%s%02x" % (SAFE_HEX_MARKER, char - 0xF0000))
 | 
			
		||||
 | 
			
		||||
            retVal = value.encode(encoding, errors)
 | 
			
		||||
 | 
			
		||||
            if unsafe:
 | 
			
		||||
                retVal = re.sub(r"%s([0-9a-f]{2})" % SAFE_HEX_MARKER, lambda _: decodeHex(_.group(1)), retVal)
 | 
			
		||||
        else:
 | 
			
		||||
            retVal = value.encode(encoding, errors)
 | 
			
		||||
 | 
			
		||||
            if unsafe:
 | 
			
		||||
                retVal = re.sub(b"\\\\x([0-9a-f]{2})", lambda _: decodeHex(_.group(1)), retVal)
 | 
			
		||||
 | 
			
		||||
    return retVal
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ from lib.core.enums import OS
 | 
			
		|||
from thirdparty import six
 | 
			
		||||
 | 
			
		||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
 | 
			
		||||
VERSION = "1.3.5.40"
 | 
			
		||||
VERSION = "1.3.5.41"
 | 
			
		||||
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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user