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

Function getChar

lib/techniques/blind/inference.py:267–502  ·  view source on GitHub ↗

continuousOrder means that distance between each two neighbour's numerical values is exactly 1

(idx, charTbl=None, continuousOrder=True, expand=charsetType is None, shiftTable=None, retried=None)

Source from the content-addressed store, hash-verified

265 return result
266
267 def getChar(idx, charTbl=None, continuousOrder=True, expand=charsetType is None, shiftTable=None, retried=None):
268 """
269 continuousOrder means that distance between each two neighbour's
270 numerical values is exactly 1
271 """
272
273 threadData = getCurrentThreadData()
274
275 result = tryHint(idx)
276
277 if result:
278 return result
279
280 if charTbl is None:
281 charTbl = type(asciiTbl)(asciiTbl)
282
283 originalTbl = type(charTbl)(charTbl)
284
285 if kb.disableShiftTable:
286 shiftTable = None
287 elif continuousOrder and shiftTable is None:
288 # Used for gradual expanding into unicode charspace
289 shiftTable = [2, 2, 3, 3, 3]
290
291 if "'%s'" % CHAR_INFERENCE_MARK in payload:
292 for char in ('\n', '\r'):
293 if ord(char) in charTbl:
294 if not isinstance(charTbl, list):
295 charTbl = list(charTbl)
296 charTbl.remove(ord(char))
297
298 if not charTbl:
299 return None
300
301 elif len(charTbl) == 1:
302 forgedPayload = safeStringFormat(payload.replace(INFERENCE_GREATER_CHAR, INFERENCE_EQUALS_CHAR), (expressionUnescaped, idx, charTbl[0]))
303 result = Request.queryPage(forgedPayload, timeBasedCompare=timeBasedCompare, raise404=False)
304 incrementCounter(getTechnique())
305
306 if result:
307 return decodeIntToUnicode(charTbl[0])
308 else:
309 return None
310
311 maxChar = maxValue = charTbl[-1]
312 minValue = charTbl[0]
313 firstCheck = False
314 lastCheck = False
315 unexpectedCode = False
316
317 if continuousOrder:
318 while len(charTbl) > 1:
319 position = None
320
321 if charsetType is None:
322 if not firstCheck:
323 try:
324 try:

Callers 2

blindThreadFunction · 0.85
bisectionFunction · 0.85

Calls 15

getCurrentThreadDataFunction · 0.90
safeStringFormatFunction · 0.90
incrementCounterFunction · 0.90
getTechniqueFunction · 0.90
decodeIntToUnicodeFunction · 0.90
getTechniqueDataFunction · 0.90
singleTimeWarnMessageFunction · 0.90
xrangeClass · 0.90
tryHintFunction · 0.85
validateCharFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…