()
Selection function for injection place, parameters and type.
Selection function for injection place, parameters and type.
Selection function for injection place parameters and type .
def _selectInjection():
    """
    Selection function for injection place, parameters and type.
    """

    points = {}

    for injection in kb.injections:
        place = injection.place
        parameter = injection.parameter
        ptype = injection.ptype

        point = (place, parameter, ptype)

        if point not in points:
            points[point] = injection
        else:
            for key in points[point].keys():
                if key != 'data':
                    points[point][key] = points[point][key] or injection[key]
            points[point]['data'].update(injection['data'])

    if len(points) == 1:
        kb.injection = kb.injections[0]

    elif len(points) > 1:
        message = "there were multiple injection points, please select "
        message += "the one to use for following injections:\n"

        points = []

        for i in xrange(0, len(kb.injections)):
            place = kb.injections[i].place
            parameter = kb.injections[i].parameter
            ptype = kb.injections[i].ptype
            point = (place, parameter, ptype)

            if point not in points:
                points.append(point)
                ptype = PAYLOAD.PARAMETER[ptype] if isinstance(ptype, int) else ptype

                message += "[%d] place: %s, parameter: " % (i, place)
                message += "%s, type: %s" % (parameter, ptype)

                if i == 0:
                    message += " (default)"

                message += "\n"

        message += "[q] Quit"
        select = readInput(message, default="0")

        if select.isdigit() and int(select) < len(kb.injections) and int(select) >= 0:
            index = int(select)
        elif select[0] in ("Q", "q"):
            raise SqlmapUserQuitException
        else:
            errMsg = "invalid choice"
            raise SqlmapValueException(errMsg)

        kb.injection = kb.injections[index]
def _selectInjection ( ) : points = { } for injection in kb . injections : place = injection . place parameter = injection . parameter ptype = injection . ptype point = ( place , parameter , ptype ) if point not in points : points [ point ] = injection else : for key in points [ point ] . keys ( ) : if key != 'data' : points [ point ] [ key ] = points [ point ] [ key ] or injection [ key ] points [ point ] [ 'data' ] . update ( injection [ 'data' ] ) if len ( points ) == 1 : kb . injection = kb . injections [ 0 ] elif len ( points ) > 1 : message = "there were multiple injection points, please select " message += "the one to use for following injections:\n" points = [ ] for i in xrange ( 0 , len ( kb . injections ) ) : place = kb . injections [ i ] . place parameter = kb . injections [ i ] . parameter ptype = kb . injections [ i ] . ptype point = ( place , parameter , ptype ) if point not in points : points . append ( point ) ptype = PAYLOAD . PARAMETER [ ptype ] if isinstance ( ptype , int ) else ptype message += "[%d] place: %s, parameter: " % ( i , place ) message += "%s, type: %s" % ( parameter , ptype ) if i == 0 : message += " (default)" message += "\n" message += "[q] Quit" select = readInput ( message , default = "0" ) if select . isdigit ( ) and int ( select ) < len ( kb . injections ) and int ( select ) >= 0 : index = int ( select ) elif select [ 0 ] in ( "Q" , "q" ) : raise SqlmapUserQuitException else : errMsg = "invalid choice" raise SqlmapValueException ( errMsg ) kb . injection = kb . injections [ index ]