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

Function getCharset

lib/core/common.py:2047–2093  ·  view source on GitHub ↗

Returns list with integers representing characters of a given charset type appropriate for inference techniques >>> getCharset(CHARSET_TYPE.BINARY) [0, 1, 47, 48, 49]

(charsetType=None)

Source from the content-addressed store, hash-verified

2045 return "text" if any(_ in desc.lower() for _ in ("ascii", "text")) else "binary"
2046
2047def getCharset(charsetType=None):
2048 """
2049 Returns list with integers representing characters of a given
2050 charset type appropriate for inference techniques
2051
2052 >>> getCharset(CHARSET_TYPE.BINARY)
2053 [0, 1, 47, 48, 49]
2054 """
2055
2056 asciiTbl = []
2057
2058 if charsetType is None:
2059 asciiTbl.extend(xrange(0, 128))
2060
2061 # Binary
2062 elif charsetType == CHARSET_TYPE.BINARY:
2063 asciiTbl.extend((0, 1))
2064 asciiTbl.extend(xrange(47, 50))
2065
2066 # Digits
2067 elif charsetType == CHARSET_TYPE.DIGITS:
2068 asciiTbl.extend((0, 9))
2069 asciiTbl.extend(xrange(47, 58))
2070
2071 # Hexadecimal
2072 elif charsetType == CHARSET_TYPE.HEXADECIMAL:
2073 asciiTbl.extend((0, 1))
2074 asciiTbl.extend(xrange(47, 58))
2075 asciiTbl.extend(xrange(64, 71))
2076 asciiTbl.extend((87, 88)) # X
2077 asciiTbl.extend(xrange(96, 103))
2078 asciiTbl.extend((119, 120)) # x
2079
2080 # Characters
2081 elif charsetType == CHARSET_TYPE.ALPHA:
2082 asciiTbl.extend((0, 1))
2083 asciiTbl.extend(xrange(64, 91))
2084 asciiTbl.extend(xrange(96, 123))
2085
2086 # Characters and digits
2087 elif charsetType == CHARSET_TYPE.ALPHANUM:
2088 asciiTbl.extend((0, 1))
2089 asciiTbl.extend(xrange(47, 58))
2090 asciiTbl.extend(xrange(64, 91))
2091 asciiTbl.extend(xrange(96, 123))
2092
2093 return asciiTbl
2094
2095def directoryPath(filepath):
2096 """

Callers 1

bisectionFunction · 0.90

Calls 2

xrangeClass · 0.85
extendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…