MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / decodeIntToUnicode

Function decodeIntToUnicode

lib/core/common.py:3830–3867  ·  view source on GitHub ↗

Decodes inferenced integer value to an unicode character >>> decodeIntToUnicode(35) == '#' True >>> decodeIntToUnicode(64) == '@' True

(value)

Source from the content-addressed store, hash-verified

3828 raise SqlmapSystemException(errMsg)
3829
3830def decodeIntToUnicode(value):
3831 """
3832 Decodes inferenced integer value to an unicode character
3833
3834 >>> decodeIntToUnicode(35) == '#'
3835 True
3836 >>> decodeIntToUnicode(64) == '@'
3837 True
3838 """
3839 retVal = value
3840
3841 if isinstance(value, int):
3842 try:
3843 if value > 255:
3844 _ = "%x" % value
3845
3846 if len(_) % 2 == 1:
3847 _ = "0%s" % _
3848
3849 raw = decodeHex(_)
3850
3851 if Backend.isDbms(DBMS.MYSQL):
3852 # Reference: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ord
3853 # Note: https://github.com/sqlmapproject/sqlmap/issues/1531
3854 retVal = getUnicode(raw, conf.encoding or UNICODE_ENCODING)
3855 elif Backend.isDbms(DBMS.MSSQL):
3856 # Reference: https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-2017 and https://stackoverflow.com/a/14488478
3857 retVal = getUnicode(raw, "UTF-16-BE")
3858 elif Backend.getIdentifiedDbms() in (DBMS.PGSQL, DBMS.ORACLE, DBMS.SQLITE): # Note: cases with Unicode code points (e.g. http://www.postgresqltutorial.com/postgresql-ascii/)
3859 retVal = _unichr(value)
3860 else:
3861 retVal = getUnicode(raw, conf.encoding)
3862 else:
3863 retVal = _unichr(value)
3864 except:
3865 retVal = INFERENCE_UNKNOWN_CHAR
3866
3867 return retVal
3868
3869def getDaysFromLastUpdate():
3870 """

Callers 3

tryHintFunction · 0.90
validateCharFunction · 0.90
getCharFunction · 0.90

Calls 4

decodeHexFunction · 0.90
getUnicodeFunction · 0.90
isDbmsMethod · 0.80
getIdentifiedDbmsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…