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

Function decodeHex

lib/core/convert.py:141–167  ·  view source on GitHub ↗

Returns a decoded representation of the provided hexadecimal value >>> decodeHex("313233") == b"123" True >>> decodeHex("313233", binary=False) == u"123" True

(value, binary=True)

Source from the content-addressed store, hash-verified

139 return json.loads(data)
140
141def decodeHex(value, binary=True):
142 """
143 Returns a decoded representation of the provided hexadecimal value
144
145 >>> decodeHex("313233") == b"123"
146 True
147 >>> decodeHex("313233", binary=False) == u"123"
148 True
149 """
150
151 retVal = value
152
153 if isinstance(value, six.binary_type):
154 value = getText(value)
155
156 if value.lower().startswith("0x"):
157 value = value[2:]
158
159 try:
160 retVal = codecs.decode(value, "hex")
161 except LookupError:
162 retVal = binascii.unhexlify(value)
163
164 if not binary:
165 retVal = getText(retVal)
166
167 return retVal
168
169def encodeHex(value, binary=True):
170 """

Callers 12

mssql_new_passwdFunction · 0.90
mssql_passwdFunction · 0.90
mssql_old_passwdFunction · 0.90
oracle_passwdFunction · 0.90
oracle_old_passwdFunction · 0.90
decodePageFunction · 0.90
_Function · 0.90
decodeIntToUnicodeFunction · 0.90
unsafeVariableNamingFunction · 0.90
_formatPartialContentFunction · 0.90
tamperFunction · 0.90
getBytesFunction · 0.85

Calls 2

getTextFunction · 0.85
decodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…