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

Function unionThread

lib/techniques/union/use.py:362–435  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

360
361 try:
362 def unionThread():
363 threadData = getCurrentThreadData()
364
365 while kb.threadContinue:
366 with kb.locks.limit:
367 try:
368 threadData.shared.counter += 1
369 num = next(threadData.shared.limits)
370 except StopIteration:
371 break
372
373 if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE):
374 field = expressionFieldsList[0]
375 elif Backend.isDbms(DBMS.ORACLE):
376 field = expressionFieldsList
377 else:
378 field = None
379
380 limitedExpr = agent.limitQuery(num, expression, field)
381 output = _oneShotUnionUse(limitedExpr, unpack, True)
382
383 if not kb.threadContinue:
384 break
385
386 if output:
387 with kb.locks.value:
388 if all(_ in output for _ in (kb.chars.start, kb.chars.stop)):
389 items = parseUnionPage(output)
390
391 if threadData.shared.showEta:
392 threadData.shared.progress.progress(threadData.shared.counter)
393 if isListLike(items):
394 # in case that we requested N columns and we get M!=N then we have to filter a bit
395 if len(items) > 1 and len(expressionFieldsList) > 1:
396 items = [item for item in items if isListLike(item) and len(item) == len(expressionFieldsList)]
397 items = [_ for _ in flattenValue(items)]
398 if len(items) > len(expressionFieldsList):
399 filtered = OrderedDict()
400 for item in items:
401 key = re.sub(r"[^A-Za-z0-9]", "", item).lower()
402 if key not in filtered or re.search(r"[^A-Za-z0-9]", item):
403 filtered[key] = item
404 items = list(six.itervalues(filtered))
405 items = [items]
406 index = None
407 for index in xrange(1 + len(threadData.shared.buffered)):
408 if index < len(threadData.shared.buffered) and threadData.shared.buffered[index][0] >= num:
409 break
410 threadData.shared.buffered.insert(index or 0, (num, items))
411 else:
412 index = None
413 if threadData.shared.showEta:
414 threadData.shared.progress.progress(threadData.shared.counter)
415 for index in xrange(1 + len(threadData.shared.buffered)):
416 if index < len(threadData.shared.buffered) and threadData.shared.buffered[index][0] >= num:
417 break
418 threadData.shared.buffered.insert(index or 0, (num, None))
419

Callers

nothing calls this directly

Calls 15

getCurrentThreadDataFunction · 0.90
parseUnionPageFunction · 0.90
isListLikeFunction · 0.90
flattenValueFunction · 0.90
OrderedDictClass · 0.90
isNoneValueFunction · 0.90
arrayizeValueFunction · 0.90
safecharencodeFunction · 0.90
dataToStdoutFunction · 0.90
_oneShotUnionUseFunction · 0.85
xrangeClass · 0.85
getIdentifiedDbmsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…