diff --git a/lib/techniques/inband/union/use.py b/lib/techniques/inband/union/use.py index 599ce6de2..2939817ec 100644 --- a/lib/techniques/inband/union/use.py +++ b/lib/techniques/inband/union/use.py @@ -33,31 +33,31 @@ from lib.utils.resume import resume reqCount = 0 -def __configUnionChar(char): - if char.isdigit() or char == "NULL": - conf.uChar = char - elif not char.startswith("'") or not char.endswith("'"): - conf.uChar = "'%s'" % char - -def __configUnionCols(columns): - if "-" not in columns or len(columns.split("-")) != 2: - raise sqlmapSyntaxException, "--union-cols must be a range with hyphon (e.g. 1-10)" - - columns = columns.replace(" ", "") - conf.uColsStart, conf.uColsStop = columns.split("-") - - if not conf.uColsStart.isdigit() or not conf.uColsStop.isdigit(): - raise sqlmapSyntaxException, "--union-cols must be a range of integers" - - conf.uColsStart = int(conf.uColsStart) - conf.uColsStop = int(conf.uColsStop) - - if conf.uColsStart > conf.uColsStop: - errMsg = "--union-cols range has to be from lower to " - errMsg += "higher number of columns" - raise sqlmapSyntaxException, errMsg - def configUnion(char=None, columns=None): + def __configUnionChar(char): + if char.isdigit() or char == "NULL": + conf.uChar = char + elif not char.startswith("'") or not char.endswith("'"): + conf.uChar = "'%s'" % char + + def __configUnionCols(columns): + if "-" not in columns or len(columns.split("-")) != 2: + raise sqlmapSyntaxException, "--union-cols must be a range with hyphon (e.g. 1-10)" + + columns = columns.replace(" ", "") + conf.uColsStart, conf.uColsStop = columns.split("-") + + if not conf.uColsStart.isdigit() or not conf.uColsStop.isdigit(): + raise sqlmapSyntaxException, "--union-cols must be a range of integers" + + conf.uColsStart = int(conf.uColsStart) + conf.uColsStop = int(conf.uColsStop) + + if conf.uColsStart > conf.uColsStop: + errMsg = "--union-cols range has to be from lower to " + errMsg += "higher number of columns" + raise sqlmapSyntaxException, errMsg + if isinstance(conf.uChar, basestring): __configUnionChar(conf.uChar) elif isinstance(char, basestring):